[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH v6 2/5] xen/sched: Link CPU topology to scheduler


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Sun, 19 Jul 2026 02:15:14 +0000
  • Accept-language: ja-JP, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=valinux.co.jp; dmarc=pass action=none header.from=valinux.co.jp; dkim=pass header.d=valinux.co.jp; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oM/FaKbIxlxUpyXSIcvmURf3x0q+w1RIkxcerdwIumU=; b=dPOyzkyXCjtflsYxfseD1y76rSA37x1JEBhqfU56nJBDZQooU+95KTrSFM9sXPYuKiK3tjNl3mVtNOAbinjMOPoWjqmLzwt4RtWbhT1cY1m7IYWOZJNMA216Oqg+A1TvJzjfVtU5ZHDOLUu0qaQvw9vHsJcIa7R751AZYAgx2vhsenegHHUCYhK7oW3xbRjbsBrU7eiDAd4v32GoQuWS9RH8N9pyd4YIT1Oi4SEImW6kynwrC59J6GjzHVIgaKoG4Qb2G/EiFaT3A04yWG9OzROU1LWgOE0URYVgOA6/DFxw5okjfNd3kqJDPnfjCZgrsLCcXJFbuKMJA2GDAqb+jQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LknGb/qyf5vBOd1fCk9UazlRtpVRl8+cfVXgw4Wk4Xjd3wJq83VwN7/jRojWf8NVhY81e9Ayr91FbJorZsKt+HWb/09Qje0pct3WoxKDpjk1GHVX2vGzDbbnkDm4f+MBa8/JWHlvl/0Xv9wgnJPcvYpoWGzx0F21whwRg0A6V9eyyRMPmGGYsTxRrl/D2r4+7TT2yc4MDHHpKrI96XH6Ji5xMnXbCXfm78VUIGFlV4038T5QFiryXfyu4J8GEMCAtx82WsZjfOYVfUPRrV8e+kgJa/NRim2F8cBjTAk+WF9uUgoSEwvaG8AYoLZmwRcuzsQ5hwyVVXOPmdKIoEq5NQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=valinux.co.jp header.i="@valinux.co.jp" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=valinux.co.jp;
  • Cc: "Mykyta_Poturai@xxxxxxxx" <Mykyta_Poturai@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Timothy Pearson <tpearson@xxxxxxxxxxxxxxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, George Dunlap <gwd@xxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Sun, 19 Jul 2026 02:15:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHdE33qeUxN/5yCh0euzob8dSpsrLZwJoMAgAP6kJA=
  • Thread-topic: [PATCH v6 2/5] xen/sched: Link CPU topology to scheduler

Hi Jan,

> >  static unsigned int cpu_nr_siblings(unsigned int cpu)
> >  {
> > -#ifdef CONFIG_X86
> > +#if defined(CONFIG_GENERIC_CPU_TOPOLOGY)
> > +    return cpu_topology ? cpu_topology[cpu].num_siblings : 1;
> > +#elif defined(CONFIG_X86)
> >      return cpu_data[cpu].x86_num_siblings;
> >  #else
> >      return 1;
> 
> Now that this is ordered more sensibly, an issue is becoming apparent: If and
> when x86 also supports GENERIC_CPU_TOPOLOGY, the present x86 logic
> should also
> be engaged when !cpu_topology. By re-arranging accordingly, you also avoid the
> need to duplicate the literal 1.

Okay.

> > @@ -11,15 +22,48 @@ struct cpu_topology {
> >      cpumask_var_t thread_sibling;
> >      cpumask_var_t core_sibling;
> >      cpumask_var_t cluster_sibling;
> > +    unsigned int phys_core_id;
> > +    unsigned int phys_cluster_id;
> > +    unsigned int phys_socket_id;
> > +    unsigned int num_siblings;
> >  };
> >
> >  extern struct cpu_topology *cpu_topology;
> >  void init_cpu_topology(void);
> >
> > +static inline void init_cpu_sibling_map(unsigned int cpu)
> > +{
> > +    if ( cpu_topology )
> > +    {
> > +        cpumask_copy(per_cpu(cpu_sibling_mask, cpu),
> > +                     cpu_topology[cpu].thread_sibling);
> > +        cpumask_copy(per_cpu(cpu_core_mask, cpu),
> > +                     cpu_topology[cpu].core_sibling);
> > +    }
> > +    else
> > +        init_cpu_sibling_map_default(cpu);
> > +}
> 
> Personally I consider this already being too redundant with ...
> 
> > +#define cpu_to_core(cpu) (cpu_topology ? cpu_topology[cpu].phys_core_id : 
> > 0)
> > +#define cpu_to_socket(cpu) (cpu_topology ? 
> > cpu_topology[cpu].phys_socket_id : 0)
> > +
> >  #else /* CONFIG_GENERIC_CPU_TOPOLOGY */
> >
> >  static inline void init_cpu_topology(void) {}
> >
> > +static inline void init_cpu_sibling_map(unsigned int cpu)
> > +{
> > +    init_cpu_sibling_map_default(cpu);
> > +}
> 
> ... this. Imo it would better be
> 
> static inline void init_cpu_sibling_map(unsigned int cpu)
> {
>     if ( IS_ENABLED(CONFIG_GENERIC_CPU_TOPOLOGY) && cpu_topology )
>     {
>         cpumask_copy(per_cpu(cpu_sibling_mask, cpu),
>                      cpu_topology[cpu].thread_sibling);
>         cpumask_copy(per_cpu(cpu_core_mask, cpu),
>                      cpu_topology[cpu].core_sibling);
>     }
>     else
>         init_cpu_sibling_map_default(cpu);
> }

Okay, I will use this approach.
 
> Which then of course requires the decl of cpu_topology (not its definition) to
> always be visible.

Thank you,
Hirokazu Takahashi.

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.