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

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


  • To: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Wed, 25 Nov 2026 10:34:39 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=valinux.co.jp smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=qS4MMu0ln260crs4iSZr3Squ3TcWHUw1j6Wqr00mcF4=; b=BZGMQLfC5u8Zln+c2hFUrwSVny0jKNA/k5MCKNJ33XYBlSt9ImXRzPNtBPZZI/iZr3pPWhfutWBd8mta6aWLziUn8xYJVe+NyuxAA6DqOVkO8eohTUyrdhCpxVqLkn/rKMhUls/D6KPCMxOeqhzIB29F8iT4L4ipTN/BEIc+gaATeY0nXgniHGsI6g2ubStIiPUxlGrL71c0XCD+ReUj82H+wwy/g1mUC1T7NZzcVU85bdopdyDevQFVvNp4W/S4cfEwbrxxEmSRJf1ScS6slQjasQYllQxboUJeE4QNC39aIMZ3Ok55aMt6DSgGpuOUH4nLR0Z2R9vr1K4ECoZZlw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BNkhEWwK/I9gEY95oMo+4TRbW3EsrUGIdkOCTvPOFxLBKK0atQsfblQy3owHZfdqetddEUDD+aNmacxM+yfQu1V0RlxQ6Yo/QaZkV42wCzgJPH7xxujdpz2nX2BPHaNzvzEHh4GZja+iGQLbE23TF3QtVfJodf3Iy5Ivb1Aivv5FQsHYk6p/rtY2ai/Esi+BTBdLID+EEB81NIc1pfYkAVLHrCvuad+IoihQgYwp0B5YOyrOnVfyN4ZwzB+02EGl3d6cZFsoYjoqTHwN8b9iP8rlkLO4SEVCIZ2N1MP+B3u55gE1k0tbXnZvFvPwA+si58eTM2caNNVbwlbiowa/lA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: <jbeulich@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 25 Nov 2026 09:34:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 09-Nov-26 06:45, Hirokazu Takahashi wrote:
> 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.
> 
> Changes in v2:
This should be moved after '---'

> - 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.
> 
> Fixes: 701190abb3d5 ("xen/arm: Set correct per-cpu cpu_core_mask")
> Signed-off-by: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
> ---
>  xen/arch/arm/smpboot.c | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
> index 8c9072f3c1..9237576440 100644
> --- a/xen/arch/arm/smpboot.c
> +++ b/xen/arch/arm/smpboot.c
> @@ -91,15 +91,27 @@ 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(int cpu)
unsigned as on x86?

> +{
> +    unsigned int sibling;
> +
> +    BUG_ON (!per_cpu(cpu_sibling_mask, cpu));
there should be no space between BUG_ON and parenthesis

> +    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
your change switches to online, so a comment should be updated

>       * 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));
With your change I think we should remove the cpu that is being removed from its
every sibling's cpu_core_mask on CPU_DEAD.

~Michal



 


Rackspace

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