All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] smpboot: correctly update number of booted cores
@ 2018-02-21 20:50 Samuel Neves
  2018-02-22  8:07 ` Dou Liyang
  2018-02-23  8:29 ` [tip:x86/urgent] x86/topology: Update the 'cpu cores' field in /proc/cpuinfo correctly across CPU hotplug operations tip-bot for Samuel Neves
  0 siblings, 2 replies; 3+ messages in thread
From: Samuel Neves @ 2018-02-21 20:50 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86, jgross, douly.fnst, luto, prarit, ak,
	vkuznets, linux-kernel
  Cc: Samuel Neves

Without this fix, /proc/cpuinfo will display an incorrect amount
of CPU cores, after bringing them offline and online again, as
exemplified below:

$ cat /proc/cpuinfo | grep cores
cpu cores	: 4
cpu cores	: 8
cpu cores	: 8
cpu cores	: 20
cpu cores	: 4
cpu cores	: 3
cpu cores	: 2
cpu cores	: 2

This patch fixes this by always zeroing the booted_cores variable
upon turning off a logical CPU.

Signed-off-by: Samuel Neves <sneves@dei.uc.pt>
---
 arch/x86/kernel/smpboot.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 9eee25d07586..ff99e2b6fc54 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1437,6 +1437,7 @@ static void remove_siblinginfo(int cpu)
 	cpumask_clear(topology_sibling_cpumask(cpu));
 	cpumask_clear(topology_core_cpumask(cpu));
 	c->cpu_core_id = 0;
+	c->booted_cores = 0;
 	cpumask_clear_cpu(cpu, cpu_sibling_setup_mask);
 	recompute_smt_state();
 }
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-23  8:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-21 20:50 [PATCH] smpboot: correctly update number of booted cores Samuel Neves
2018-02-22  8:07 ` Dou Liyang
2018-02-23  8:29 ` [tip:x86/urgent] x86/topology: Update the 'cpu cores' field in /proc/cpuinfo correctly across CPU hotplug operations tip-bot for Samuel Neves

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.