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

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


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Fri, 23 Oct 2026 20:09:25 +0900
  • 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=x2AP9Dkl/sAM7dAAKIN7a5X8tS4AK4BR1ofX0yvkCAU=; b=yDyylg13LnYBitBQkT9j3eE5T9OmR4k0NS55K9A6l60CFPdC7vodOSbKp+INKErUnGBjogloZku3y8Gj2wp4M8vZUkeE0oPKQkV7JZMatgZKhJszEvA2nmDvhat9LpUoms4eLvI+PQWNKHOx7IfBsOu2NZYsR0aEbQIWso8T3lnvT6dBn/uGleWsjyz4+sz4cyVou9+puFCmsOi/NSCr84lE6yiOs2HJ6fPH/xBHnYUQC9lm64mbtiV2q3dmd0P2biyI+FyikcYAupfgtmEtOUwhWRMFcTddTBKUXbBEhd0HxLC+ABzH14c385nzsq5CfgDC366pBLrKzO9G4jnlwQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ouy8gZoMoYaVI+w2+QmZJoNjN+2LC7/EaSo/cZcS/jFYTZJmU3dY2VA6O4dxXaVIxGzzHdXTrScMQ23dh2YaRdcGZpjq7V+icw1EYGrVBT99a7cS9VLNQfoexs7Ao4kJ3hX1DaoVDre5uK6J1bdzISyuiJ7ijW0vtEyoJ6y6TjQDAofhaHHq9+3QgCz5pckFrVdNdQBPewKXqsE3VMHl85May8kP1sCWmTpcKruHIJZp0OUmdYC2WqP4D37ZQ3t7qZ+gAr9HiuFaVGwFEBsnbuaPkIMoDQxzPuvTj7Rk8C8rbbWe2Qf8FSqXqIAnQoTQISQtZtK9bCRqVkUH/M2m0A==
  • 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: michal.orzel@xxxxxxx, Hirokazu Takahashi <taka@xxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 23 Oct 2026 11:10:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.

Fixes: 701190abb3d5 ("xen/arm: Set correct per-cpu cpu_core_mask")
Signed-off-by: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
---
 xen/arch/arm/smpboot.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index 8c9072f3c1..2d01896cf0 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -91,15 +91,24 @@ static int setup_cpu_sibling_map(int cpu)
          !zalloc_cpumask_var(&per_cpu(cpu_core_mask, cpu)) )
         return -ENOMEM;
 
+    return 0;
+}
+
+static void init_cpu_sibling_map(int cpu)
+{
+    unsigned int sibling;
+
     /*
      * 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).
+     * are supposed to belong to the same socket.
      */
     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)
@@ -314,6 +323,7 @@ smp_prepare_cpus(void)
     if ( rc )
         panic("Unable to allocate CPU sibling/core maps\n");
 
+    init_cpu_sibling_map(0);
 }
 
 /* Boot the current CPU */
@@ -385,6 +395,8 @@ void asmlinkage noreturn start_secondary(void)
 
     set_current(idle_vcpu[cpuid]);
 
+    init_cpu_sibling_map(cpuid);
+
     /* Run local notifiers */
     notify_cpu_starting(cpuid);
     /*
-- 
2.43.0




 


Rackspace

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