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

Re: [PATCH] xen/arm: fix spurious SMT warning on CPUs with MT=1 encoding convention


  • To: "Peng Fan (OSS)" <peng.fan@xxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Fri, 4 Dec 2026 08:15:26 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=oss.nxp.com 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=DCuuO8M/HdS1tacD0yP97IEvO3HN+XCHNixdBjreKC4=; b=LFbUYLschB10vhAcwe2cG3mSZ4nYRPWfvt0pywDeh5tq1znVhtBQQqrVffsdoqUBGumQKAB8zEEywlaIHyw2ryOjRrnB4AA6nss14KF+S040jng7llKx4t2Y9ZD5rBM6svMcXSm2W8c7Uv1ZYfrQxwEoFg76vrqP2TZMFnKccIoJ7G55KYUifGfBUjX0ofIGltD31tov4IOpIza2ZmDVw2KDaOlGQyAXSVJz/ppAyIacP3kvzhOjbM93KiBGwWvliIA/HxYAihoQ3rb9dnKrGsT4vTlAqCaH2CHsn/vNHqc5qIOze63SLOOGdsJVGq+6WAiBgjtuCCjjXcGcFDyY7Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xSH0KoukZwFY78kDQAaWLN99UiLMNPjF8Oky7PiJtToR1Mf4oS/zU645ptgO8uExDMQbFTNadGoo11DpSlSGMvAChr4O/eXrvIa2+VDTIDkXp/nZbMY9MB1V4ai/E3ZkhcFnFReva4H7V2CtH/Y5KzGkwvwd3E9aGDM3Lr0468IfA1daZktJZJvZBLjkNjAnqJMkJhKtajQD2fJIIkjul/okLpwrE4RmrDFvz4X3Jjm5r1dHrEUV0SEUkhNZ85mu8H6NmnHMNVDfUvVqjeU3TqMYkMKw/SP1Vef7sUpug8KoM+xoO3qe5C0YacYxxzakF2E80RFGsGEoK1Fxf+DzGw==
  • 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: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>, Peng Fan <peng.fan@xxxxxxx>
  • Delivery-date: Fri, 04 Dec 2026 07:15:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 04-Dec-26 01:58, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@xxxxxxx>
> 
> Some ARM processors, such as Cortex-A55, set MPIDR.MT=1 as a topology
NIT: Some is underselling. A lot of modern ARM CPUs set MT=1 but do not use SMT.
The only CPUs using SMT are Cortex-A65 and Neoverse-E1.

> encoding convention to indicate that Aff0 represents thread IDs, without
> actually implementing multithreading (SMT). This caused Xen to
> unconditionally emit a security warning and incur a 3-second boot delay
> via warning_print() on all such platforms.
> 
> Fix the detection by verifying that at least one CPU has a non-zero Aff0
Add "also verifying" so that it's clear that the .MT bit check is still in place

> affinity level in its cpu_logical_map entry. A non-zero Aff0 is the only
> reliable indication that multiple threads share a physical core. Platforms
> like Cortex-A55 where all CPUs have Aff0=0 will no longer trigger the
> warning.
A few days ago I mentioned this issue and that is should be fixed while
reviewing this patch:
https://lore.kernel.org/xen-devel/fd3e03ab-d06d-4e81-b196-e75fcdd21ca5@xxxxxxx/
Was this perhaps the input for this patch?

> 
> Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
> ---
>  xen/arch/arm/smpboot.c | 27 ++++++++++++++++++++++++---
>  1 file changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
> index 2fc6c36ca1d3..05fab1fe5174 100644
> --- a/xen/arch/arm/smpboot.c
> +++ b/xen/arch/arm/smpboot.c
> @@ -309,9 +309,30 @@ void __init smp_init_cpus(void)
>                      "It has implications on the security and stability of 
> the system,\n"
>                      "unless the cpu affinity of all domains is 
> specified.\n");
>  
> -    if ( system_cpuinfo.mpidr.mt == 1 )
> -        warning_add("WARNING: MULTITHREADING HAS BEEN DETECTED ON THE 
> PROCESSOR.\n"
> -                    "It might impact the security of the system.\n");
> +    /*
> +     * MT=1 means Aff0 encodes thread IDs, but some CPUs (e.g. Cortex-A55)
> +     * set MT=1 as a topology encoding convention without implementing SMT.
> +     * Only warn if Aff0 is non-zero for any CPU, indicating real threads.
> +     */
> +    if ( system_cpuinfo.mpidr.mt )
> +    {
> +        unsigned int cpu;
> +        bool real_smt = false;
Do we need this variable? We could call warning_add and break right away.

> +
> +        for_each_possible_cpu ( cpu )
No need for extra spaces. It should be for_each_possible_cpu(cpu).

> +        {
> +            if ( MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0) != 0 )
> +            {
> +                real_smt = true;
> +                break;
> +            }
> +        }
> +
> +        if ( real_smt )
> +            warning_add("WARNING: MULTITHREADING HAS BEEN DETECTED ON THE 
> PROCESSOR.\n"
> +                        "It might impact the security of the system.\n");
> +    }
> +
Stray blank line.

>  }
>  
>  unsigned int __init smp_get_max_cpus(void)
> 
> ---
> base-commit: a1bb3efd35c2ea04c861f53df602795abb52038a
> change-id: 20261204-a55-mt-e5950b5392ef
> 
> Best regards,
> --  
> Peng Fan <peng.fan@xxxxxxx>

With the remarks addressed:
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

~Michal



 


Rackspace

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