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

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


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Fri, 12 Jun 2026 19:53:39 +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=XAwUhyzwlywENjHgFMhMKyoKocmktssWzq8DspHt9hM=; b=co3hEnH5HmbD8Os05Vnh8zjC6ai1nKD/+TmrZ5JqSKMRDZH8zxSS/Y/movZYw9RcLi0m7OpD8CulrbjFsJtlPGqQwA4XjRwzvKxK2y1N4Isd0nrjQ+5LkUfmekU23DTB0FiFMXLPqckU5JbKJXoz0Xd1p+urQgkJ4pxv0JnZTfMKaLyjCSmtJR2tIVnBXkiMkscy6lCjECDriPcoCtF1An6W2e2DmkCq0S3TL4Df4t1KYgcmcZ/QBSKmiRksoTE/S3kPjZa5s9beXqll4k7/ulLlYibi9ydi0ZU82YS4n15hkkL5SwtQ7vgatOXnHOHsg7SIjpfb1Qs53mJWhtPx5Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=q/1G+triCT8JkXqnC5MpZeBluuQGZTvlKIxpCqbXuvgQzHCIJeanQZfzvBVsa5+GoVHxG5iBlT52nufGQa+p3SAvYngSvMiEfdPUC4Tfwza+JRy//h4CgdvHBthq5jmeZk9ODmW+dWi/QIWM0ePy2JholVjj9f8FycADqbvghuaIyenuUlmfLRgotB+ZQuJAA7voM63T2SyMCLfutHuS21F4cvA9rYO54HOUK0EJ8X1Grsu6Zj+CpKK1RKXAcHI4Ex5iO06g/LS1AE2tnxXR5vkPJ0TRT/IveKlUBOvb1mavzVdwAPKDudU5NshMuBk7kYhYdObB9AogSZbc2tQviA==
  • 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>, Dario Faggioli <dfaggioli@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, George Dunlap <gwd@xxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 12 Jun 2026 19:54:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHc+Mopz/Cks6fKlk2NBrgno/uZs7Y5ZxkAgAHeKMA=
  • Thread-topic: [PATCH 2/3] xen/sched: Link CPU topology to scheduler

Hello,

> Subject: Re: [PATCH 2/3] xen/sched: Link CPU topology to scheduler
> 
> On 10.06.2026 13:13, Hirokazu Takahashi wrote:
> > Make CPU topology information available to the Xen scheduler.
> > Additionally, ensure that this topology information is displayed
> > when executing the 'xl info -n' command.
> 
> Both in title and description you're pretty generic, yet then ...
> 
> >  xen/arch/arm/include/asm/processor.h  |  4 ---
> >  xen/arch/arm/smpboot.c                | 10 ++++--
> >  xen/common/device-tree/cpu-topology.c | 51
> +++++++++++++++++++++++++++
> >  xen/common/sched/credit2.c            |  3 ++
> >  xen/common/sysctl.c                   |  1 +
> >  xen/include/xen/cpu-topology.h        | 10 ++++++
> >  6 files changed, 72 insertions(+), 7 deletions(-)
> 
> ... only the credit2 scheduler is actually enabled.

While it is true that this patch is focused on Credit2, the CPU topology
information is also reflected in `cpu_sibling_mask` and `cpu_core_mask`.
These masks are globally populated and are already referenced by other
schedulers' code as well.

> > --- a/xen/common/device-tree/cpu-topology.c
> > +++ b/xen/common/device-tree/cpu-topology.c
> > @@ -325,6 +325,55 @@ int __init parse_dt_topology(void)
> >      return parse_socket(map);
> >  }
> >
> > +static void __init setup_cpu_topology_ids(void)
> > +{
> > +    unsigned int cpu;
> > +    unsigned int next_core_id = 0U;
> > +    unsigned int next_cluster_id = 0U;
> > +    unsigned int next_socket_id = 0U;
> > +
> > +    for_each_possible_cpu( cpu )
> 
> Nit (style): Either you deem for_each_possible_cpu a (pseudo-)keyword
> (then there's a blank missing) or you don't (then there are excess
> blanks).

Okay, I will fix them.

> > +    {
> > +        unsigned int first_cpu;
> > +        struct cpu_topology *topo = &cpu_topology[cpu];
> > +
> > +        first_cpu = cpumask_first(&topo->thread_sibling);
> > +        if ( first_cpu == cpu )
> > +        {
> > +            topo->phys_core_id = next_core_id;
> > +            next_core_id++;
> > +        }
> > +        else
> > +        {
> > +            topo->phys_core_id = cpu_topology[first_cpu].phys_core_id;
> > +        }
> 
> Nit, here and below: Please omit unnecessary figure braces.

Okay, I will remove them.

> > @@ -339,4 +388,6 @@ void __init dt_init_cpu_topology(void)
> >
> >      for_each_possible_cpu( cpu )
> >          setup_siblings_masks(cpu);
> As to the earlier remark: Bad pre-existing examples don't count.

Okay.

> > @@ -19,11 +23,17 @@ extern struct cpu_topology *cpu_topology;
> >  void map_cpuid_to_node(unsigned int cpuid, struct dt_device_node
> *cpu_node);
> >  void dt_init_cpu_topology(void);
> >
> > +#define cpu_to_core(_cpu)   (cpu_topology[_cpu].phys_core_id)
> > +#define cpu_to_socket(_cpu)   (cpu_topology[_cpu].phys_socket_id)
> 
> Please can you avoid introducing new name space violations (identifiers
> with leading underscores should name file scope entities); also again
> below.

Ok, I will remove the leading underscores from the macro, which were
originally defined in xen/arch/arm/include/asm/processor.h.
Is it okay to leave the macro definitions in x86's 
`xen/arch/x86/include/asm/processor.h` untouched?

Thank you,
Hirokazu Takahashi.

 


Rackspace

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