1 From foo@baz Sun May 27 17:33:38 CEST 2018
2 From: Samuel Neves <sneves@dei.uc.pt>
3 Date: Wed, 21 Feb 2018 20:50:36 +0000
4 Subject: x86/topology: Update the 'cpu cores' field in /proc/cpuinfo correctly across CPU hotplug operations
6 From: Samuel Neves <sneves@dei.uc.pt>
8 [ Upstream commit 4596749339e06dc7a424fc08a15eded850ed78b7 ]
10 Without this fix, /proc/cpuinfo will display an incorrect amount
11 of CPU cores, after bringing them offline and online again, as
14 $ cat /proc/cpuinfo | grep cores
24 This patch fixes this by always zeroing the booted_cores variable
25 upon turning off a logical CPU.
27 Tested-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
28 Signed-off-by: Samuel Neves <sneves@dei.uc.pt>
29 Cc: Linus Torvalds <torvalds@linux-foundation.org>
30 Cc: Peter Zijlstra <peterz@infradead.org>
31 Cc: Thomas Gleixner <tglx@linutronix.de>
35 Cc: vkuznets@redhat.com
36 Link: http://lkml.kernel.org/r/20180221205036.5244-1-sneves@dei.uc.pt
37 Signed-off-by: Ingo Molnar <mingo@kernel.org>
38 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
39 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
41 arch/x86/kernel/smpboot.c | 1 +
42 1 file changed, 1 insertion(+)
44 --- a/arch/x86/kernel/smpboot.c
45 +++ b/arch/x86/kernel/smpboot.c
46 @@ -1497,6 +1497,7 @@ static void remove_siblinginfo(int cpu)
47 cpumask_clear(topology_core_cpumask(cpu));
50 + c->booted_cores = 0;
51 cpumask_clear_cpu(cpu, cpu_sibling_setup_mask);
52 recompute_smt_state();