|
[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
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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |