]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
e1250e902dcef942dec22add393fa8d6610221b5
[thirdparty/kernel/stable-queue.git] /
1 From foo@baz Sun May 27 16:52:54 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
5
6 From: Samuel Neves <sneves@dei.uc.pt>
7
8 [ Upstream commit 4596749339e06dc7a424fc08a15eded850ed78b7 ]
9
10 Without this fix, /proc/cpuinfo will display an incorrect amount
11 of CPU cores, after bringing them offline and online again, as
12 exemplified below:
13
14 $ cat /proc/cpuinfo | grep cores
15 cpu cores : 4
16 cpu cores : 8
17 cpu cores : 8
18 cpu cores : 20
19 cpu cores : 4
20 cpu cores : 3
21 cpu cores : 2
22 cpu cores : 2
23
24 This patch fixes this by always zeroing the booted_cores variable
25 upon turning off a logical CPU.
26
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>
32 Cc: jgross@suse.com
33 Cc: luto@kernel.org
34 Cc: prarit@redhat.com
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>
40 ---
41 arch/x86/kernel/smpboot.c | 1 +
42 1 file changed, 1 insertion(+)
43
44 --- a/arch/x86/kernel/smpboot.c
45 +++ b/arch/x86/kernel/smpboot.c
46 @@ -1521,6 +1521,7 @@ static void remove_siblinginfo(int cpu)
47 cpumask_clear(topology_core_cpumask(cpu));
48 c->phys_proc_id = 0;
49 c->cpu_core_id = 0;
50 + c->booted_cores = 0;
51 cpumask_clear_cpu(cpu, cpu_sibling_setup_mask);
52 recompute_smt_state();
53 }