lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a3cd425c-e8c0-4e11-9423-76545cb4e7a2@samsung.com>
Date: Sat, 22 Nov 2025 17:24:22 +0100
From: Marek Szyprowski <m.szyprowski@...sung.com>
To: Thomas Gleixner <tglx@...utronix.de>, LKML
	<linux-kernel@...r.kernel.org>
Cc: Peter Zijlstra <peterz@...radead.org>, Gabriele Monaco
	<gmonaco@...hat.com>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Michael Jeanson <mjeanson@...icios.com>, Jens Axboe <axboe@...nel.dk>, "Paul
 E. McKenney" <paulmck@...nel.org>, "Gautham R. Shenoy"
	<gautham.shenoy@....com>, Florian Weimer <fweimer@...hat.com>, Tim Chen
	<tim.c.chen@...el.com>, Yury Norov <yury.norov@...il.com>, Shrikanth Hegde
	<sshegde@...ux.ibm.com>, Nathan Chancellor <nathan@...nel.org>
Subject: Re: [patch V5 09/20] cpumask: Cache num_possible_cpus()


On 22.11.2025 16:36, Thomas Gleixner wrote:
> On Fri, Nov 21 2025 at 23:56, Marek Szyprowski wrote:
>> Reverting it on top of linux-next fixes the issue. Let me know how can I
>> help debugging it.
> Can you test the fix below please?

This fixes the observed issue. Thanks!

Tested-by: Marek Szyprowski <m.szyprowski@...sung.com>

> Thanks,
>
>          tglx
> ---
> Subject: cpu: Initialize __num_possible_cpus correctly
> From: Thomas Gleixner <tglx@...utronix.de>
> Date: Sat, 22 Nov 2025 16:19:18 +0100
>
> The variable to cache the number of possible CPUs is initialized to NR_CPUS
> at build time, but that's only correct when cpu_possible_mask is
> initialized with CPU_BITS_ALL. That's only the case on PARISC.
>
> On x86 and some other architectures this does not matter because they
> initialize cpu_possible_mask via init_cpu_possible() which does a proper
> weight calculation. Though on architectures which do not, this results
> in a completely wrong cached value 'NR_CPUS + actual possible CPUs'.
>
> Initialize it correctly to 0 when CONFIG_INIT_ALL_POSSIBLE=n and move the
> NR_CPUS initialization into the PARISC specific section.
>
> Fixes: d0f23ccf6ba9 ("cpumask: Cache num_possible_cpus()")
> Reported-by: Marek Szyprowski <m.szyprowski@...sung.com>
> Reported-by: Nathan Chancellor <nathan@...nel.org>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> Closes: https://lore.kernel.org/all/89c7106e-a431-443a-9527-3d5fbce77fe1@samsung.com
> Closes: https://lore.kernel.org/all/20251122002755.GA2682494@ax162
> ---
>   kernel/cpu.c |    6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -3085,10 +3085,13 @@ EXPORT_SYMBOL(cpu_all_bits);
>   #ifdef CONFIG_INIT_ALL_POSSIBLE
>   struct cpumask __cpu_possible_mask __ro_after_init
>   	= {CPU_BITS_ALL};
> +unsigned int __num_possible_cpus __ro_after_init = NR_CPUS;
>   #else
>   struct cpumask __cpu_possible_mask __ro_after_init;
> +unsigned int __num_possible_cpus __ro_after_init;
>   #endif
>   EXPORT_SYMBOL(__cpu_possible_mask);
> +EXPORT_SYMBOL(__num_possible_cpus);
>   
>   struct cpumask __cpu_online_mask __read_mostly;
>   EXPORT_SYMBOL(__cpu_online_mask);
> @@ -3108,9 +3111,6 @@ EXPORT_SYMBOL(__cpu_dying_mask);
>   atomic_t __num_online_cpus __read_mostly;
>   EXPORT_SYMBOL(__num_online_cpus);
>   
> -unsigned int __num_possible_cpus __ro_after_init = NR_CPUS;
> -EXPORT_SYMBOL(__num_possible_cpus);
> -
>   void init_cpu_present(const struct cpumask *src)
>   {
>   	cpumask_copy(&__cpu_present_mask, src);
>
Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ