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

RE: [PATCH v3] xen/arm: Fix sibling mask setup to only include online CPUs


  • To: "Orzel, Michal" <michal.orzel@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Fri, 27 Nov 2026 00:56:30 +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=OL06gi2P6qEBoqtnSFpOIi2KMo0Eq58Rsfg0B1wIXIs=; b=Fcjkq4WjoU8VL3OhWNqrQ726Z+knZhO+mjRYPSwzozn9gLYBTIATPEepvww5Ss/gJ00wUXq5eB7FJX3T5dBFz5iFaZ+GRPdTaAMZW2tKZciH8YGPNXkTt55fY74m+p6abJVxOtufNZWLrdczFg3zELAPcSL7z+qi99Dhh23ZBBstr2rg8yunLhzS8Nm1WTYC8oSn9HDEil2IH/fuDVOEgTQyqs4ufaksgHEWFnWal42vsSgrd8nWQDtjsfBtlEMk1fMGZMb3Jsuo8t8fRimQDWHYQp+WyE8D9eDQsX4U1vz0Ta7s50Rp6viJX7MThD1hp7xTVXPLkbb+GqNns1chOw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S24Cg0S09Pn9hAmfp0FMdljH1e0jb/dd7Ben299IxAW3FQ4PJik2XM764JkmMlArXjKllRNnibZMNMeO9tv/lF5p85Nuh+bVwx9RYLkmt5TeDnpNOWb5Mdvnn7FOJtpEUTDg15lt0ta4gwMlPpH+W/8iTelTRO21Ep4ZBEgdD1XsV/uX6FcyOVQF4Cnuadh4zsN2qyKoEM66eMe2DmhvKAXEuVwYCIOIB5L4LYpYP40qFwLwAdC38XuLO4rAzwgceiiW4y/l7cDr3aENGMDojfSOIpE6m53CkMRGrF1BECGffHwL5thxlYaIrXuL8m04y9kyPlgkYatEWaAvSmP02g==
  • 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>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Fri, 27 Nov 2026 00:56:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHdfWDWX4jpBtDmIUiU0ilhK7g5qbdAFPWAgAEC4oA=
  • Thread-topic: [PATCH v3] xen/arm: Fix sibling mask setup to only include online CPUs

Hi, Michal

Thank you for the comments.

> > Populate the CPU sibling map only with CPUs that are brought
> > online. Currently, all CPUs in cpu_possible_map are added,
> > which leaves CPUs that failed to boot in the sibling masks and
> > may lead the scheduler to make incorrect decisions.
> Please mention the removal part as well which you added in this revision.

Okay

> > Fixes: 701190abb3d5 ("xen/arm: Set correct per-cpu cpu_core_mask")
> > Signed-off-by: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
> > ---
> > Changes in v3:
> > - Remove the CPU from sibling maps when it goes down, introducing
> >   remove_siblinginfo() to match x86 Xen.
> > - Change the cpu parameter type of set_cpu_sibling_map() to
> >   'unsigned int' to align with x86 Xen. Also use 'unsigned int'
> >   for the cpu parameters of remove_siblinginfo() and
> >   remove_cpu_sibling_map().
> > - Minor code cleanups.
> >
> > Changes in v2:
> > - Rename init_cpu_sibling_map() to set_cpu_sibling_map() to align
> >   with x86.
> > - Use BUG_ON() in set_cpu_sibling_map() to verify that per-cpu
> >   cpu_sibling_mask and cpu_core_mask are allocated.
> >
> >  xen/arch/arm/smpboot.c | 39
> +++++++++++++++++++++++++++++++++++----
> >  1 file changed, 35 insertions(+), 4 deletions(-)
> >
> > diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
> > index 8c9072f3c1..c4c9f535e3 100644
> > --- a/xen/arch/arm/smpboot.c
> > +++ b/xen/arch/arm/smpboot.c
> > @@ -91,18 +91,44 @@ static int setup_cpu_sibling_map(int cpu)
> >           !zalloc_cpumask_var(&per_cpu(cpu_core_mask, cpu)) )
> >          return -ENOMEM;
> >
> > +    return 0;
> > +}
> > +
> > +static void set_cpu_sibling_map(unsigned int cpu)
> > +{
> > +    unsigned int sibling;
> > +
> > +    BUG_ON(!per_cpu(cpu_sibling_mask, cpu));
> > +    BUG_ON(!per_cpu(cpu_core_mask, cpu));
> > +
> >      /*
> >       * Currently we assume there is no multithread and NUMA, so
> > -     * a CPU is a sibling with itself, and the all possible CPUs
> > +     * a CPU is a sibling with itself, and the all online 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);
> > +    cpumask_copy(per_cpu(cpu_core_mask, cpu), &cpu_online_map);
> > +    cpumask_set_cpu(cpu, per_cpu(cpu_core_mask, cpu));
> >
> > -    return 0;
> > +    for_each_online_cpu(sibling)
> > +        cpumask_set_cpu(cpu, per_cpu(cpu_core_mask, sibling));
> >  }
> >
> > -static void remove_cpu_sibling_map(int cpu)
> > +static void remove_siblinginfo(unsigned int cpu)
> > +{
> > +    unsigned int sibling;
> > +
> > +    for_each_cpu(sibling, per_cpu(cpu_core_mask, cpu))
> > +        cpumask_clear_cpu(cpu, per_cpu(cpu_core_mask, sibling));
> > +
> > +    for_each_cpu(sibling, per_cpu(cpu_sibling_mask, cpu))
> > +        cpumask_clear_cpu(cpu, per_cpu(cpu_sibling_mask, sibling));
> On ARM a CPU is a sbiling with itself only, so this loop is redundant. Please 
> drop.

Okay, I will remove it.
And I will add this loop in the cpu topology patch series.

> > +    cpumask_clear(per_cpu(cpu_sibling_mask, cpu));
> > +    cpumask_clear(per_cpu(cpu_core_mask, cpu));
> > +}
> > +
> > +static void remove_cpu_sibling_map(unsigned int cpu)
> We try not to add unrelated changes to the patch that is meant to do something
> else (here s/int/unsigned int/). If at all, it should be mentioned in the 
> commit msg.

Okay.

> With that:
> Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

Thank you,
Hirokazu Takahashi.

 


Rackspace

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