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

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


  • To: "Orzel, Michal" <michal.orzel@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Fri, 23 Oct 2026 05:25:24 +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=ICqv5QkNvvUXkN0vbU1X7eA7aanhGm/joJd7RjGdd1s=; b=hIFRWmkXeu6GIaduSJwUdCW7x6icByJyXDRkfiNmkn0zjmeDMBylG5mHBeZhj/+HfQ+vKmcYRJ3vd4k0t7GUl4BFlRYnCrEBjZK6qoYPBxaxuk6ObOGDc96EsWne6elBgFX3XXWWBG8BVmZR/tnH7OAvvD0KgEOem7brPP/fC9EDk7uPtM5kAyAHXxRxtVI5/imo02mb9lqnHU7rSimgdIFzjK6l1/5BPww6zCl5bsb49rF2XRu67bv6BleYpzANuSzA4oEQAym6eEgKXFkaQpr/ZB5s3X0lNWV3JnkGMReYQzKJelNTCH74gvZsu5uM+9fZUIVy2biUOvyAqSOTeA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nHlyzNtgnQJmsIJGgNPnHkb11MzfM6KenXOELPuMhDNAWEOwjF0fY4ieLOUGd0RNi5Xqe7ISoBO3jmM7mJi/8y/dL1X2UGa6K5q60CddlGXXrk/2mEJc2yMIneQ8khC9fm8gzD7flSOWJE05azPvxIYfGDgByk+PkP6S6YU2KkJTs7KLu+qTASFTc4bN64Mm8pl16Fq0XwB1gi8Ia0H7L0q1B491dqLyDm3wZe967w6MAQSa5luvHvI7KYoCHDheFmPZo03EWTyTVpzVGQYxzn83GrT1ZvIfPI985hJokR1+UTY38a004SsRH3+myr5M/jZkzEdvISdbqGGrHWMGfw==
  • 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: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=valinux.co.jp;
  • Cc: "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, "Mykyta_Poturai@xxxxxxxx" <Mykyta_Poturai@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Timothy Pearson <tpearson@xxxxxxxxxxxxxxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, George Dunlap <gwd@xxxxxxxxxxxxxx>
  • Delivery-date: Fri, 23 Oct 2026 05:25:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHdX21XXIwRdrvZbEe9C8R0UTfp8LcH/XMAgAKWagA=
  • Thread-topic: [PATCH v12 2/4] xen/sched: Link CPU topology to scheduler

Hi Michal,

Thank you for the review.

> > diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
> > index d34396f9b1..cf4858eb37 100644
> > --- a/xen/arch/arm/smpboot.c
> > +++ b/xen/arch/arm/smpboot.c
> > @@ -93,13 +93,7 @@ static int setup_cpu_sibling_map(int cpu)
> >           !zalloc_cpumask_var(&per_cpu(cpu_core_mask, cpu)) )
> >          return -ENOMEM;
> >
> > -    /*
> > -     * Currently we assume there is no multithread and NUMA, so
> > -     * a CPU is a sibling with itself, and the all possible CPUs
> > -     * are supposed to belong to the same socket (NUMA node).
> > -     */
> > -    cpumask_set_cpu(cpu, per_cpu(cpu_sibling_mask, cpu));
> > -    cpumask_copy(per_cpu(cpu_core_mask, cpu), &cpu_possible_map);
> > +    init_cpu_sibling_map(cpu);
> The comment above the cpu_sibling_mask definition is now stale.

Yes. This patch removes the comment.


> > +    for_each_possible_cpu(cpu)
> > +    {
> > +        unsigned int first_cpu;
> > +        struct cpu_topology *topo = &cpu_topology[cpu];
> > +
> > +        first_cpu = cpumask_first(topo->thread_sibling);
> > +        ASSERT(first_cpu < nr_cpu_ids);
> > +
> > +        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;
> > +        }
> No braces for single line statements.

Okay.

> > +
> > +        first_cpu = cpumask_first(topo->cluster_sibling);
> > +        if ( first_cpu >= nr_cpu_ids )
> > +        {
> > +            /* Clustering is not supported */
> > +            topo->phys_cluster_id = 0;
> > +        }
> > +        else
> > +        {
> > +            if ( first_cpu == cpu )
> > +            {
> > +                topo->phys_cluster_id = next_cluster_id;
> > +                next_cluster_id++;
> > +            }
> > +            else
> > +            {
> > +                topo->phys_cluster_id = 
> > cpu_topology[first_cpu].phys_cluster_id;
> > +            }
> No braces for single line statements.

Okay.

> > +        }
> > +
> > +        first_cpu = cpumask_first(topo->core_sibling);
> > +        ASSERT(first_cpu < nr_cpu_ids);
> > +
> > +        if ( first_cpu == cpu )
> > +        {
> > +            topo->phys_socket_id = next_socket_id;
> > +            next_socket_id++;
> > +        }
> > +        else
> > +        {
> > +            topo->phys_socket_id = cpu_topology[first_cpu].phys_socket_id;
> > +        }
> No braces for single line statements.

Okay.

> >  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;
> phys_cluster_id and cluster_sibling are only used to compute each other. Are
> they really needed?

I kept them because I plan to make it possible to specify "cluster" for the
credit2_runqueue parameter.


> > +    unsigned int phys_socket_id;
> > +    unsigned int num_siblings;
> >  };
> >
> >  extern struct cpu_topology *cpu_topology;
> > +
> > +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);
> cpu_topology[] is built from all CPUs, so a CPU that then fails to boot
> stays in its siblings masks. I think a CPU should be added to these masks only
> once it is online.

The original code prior to this patch initialized the CPU sibling map in the 
CPU_UP_PREPARE
Notifier before bringing up a secondary core. I agree that it is appropriate to 
initialize it after
the core is actually brought up, similar to how x86 Xen does it.

Thank you,
Hirokazu Takahashi

 


Rackspace

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