linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Fix PATCH] cpu/hotplug: Fix bug report when add "nosmt" parameter with CONFIG_HOTPLUG_CPU=N
@ 2019-03-25 13:51 lantianyu1986
  2019-03-25 14:16 ` Thomas Gleixner
  2019-03-25 19:31 ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: lantianyu1986 @ 2019-03-25 13:51 UTC (permalink / raw)
  To: tglx, mingo, konrad.wilk, jpoimboe, peterz, mojha, peterz,
	jkosina, riel, luto, Tianyu.Lan, michael.h.kelley, kys, gregkh
  Cc: linux-kernel, stable

From: Lan Tianyu <Tianyu.Lan@microsoft.com>

When add "nosmt" parameter, kernel still boots up all logical cpus once
and set CR4.MCE on each CPU. This is to avoid shutting down machine
when a broadacasted MCE is observed CR4.MCE=0b. (Detail please see comment
in the cpu_smt_allowed()). Smt cpus will bring up and bring down during
kernel boot with "nosmt" parameter.

When CONFIG_HOTPLUG_CPU=Y, CPU_DYING callbacks will be called inside
stop-machine and irq is disabled. This happens in the take_cpu_down()
callback. When CONFIG_HOTPLUG_CPU=N,CPU_DYING callbacks will be called
with irq enabled.

smpcfd_dying_cpu() is one of CPU_DYING callbacks and it assumes to be
called when irq is disabled. smpcfd_dying_cpu() calls flush_smp_call_
function_queue() which requires to be called with irq disabled.

When CONFIG_HOTPLUG_CPU=N and add "nosmt" parameter, smpcfd_dying_cpu()
is called with irq enalbed and this triggers BUG_ON(!irqs_disabled())
in the irq_work_run_list(). This patch is to fix the issue.

Fixes: 0cc3cd21657b ("cpu/hotplug: Boot HT siblings at least once")
Signed-off-by: Lan Tianyu <Tianyu.Lan@microsoft.com>
---
 kernel/smp.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/smp.c b/kernel/smp.c
index f4cf1b0..33f1970 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -73,6 +73,8 @@ int smpcfd_dead_cpu(unsigned int cpu)
 
 int smpcfd_dying_cpu(unsigned int cpu)
 {
+	unsigned long flags;
+
 	/*
 	 * The IPIs for the smp-call-function callbacks queued by other
 	 * CPUs might arrive late, either due to hardware latencies or
@@ -82,7 +84,10 @@ int smpcfd_dying_cpu(unsigned int cpu)
 	 * ensure that the outgoing CPU doesn't go offline with work
 	 * still pending.
 	 */
+	local_irq_save(flags);
 	flush_smp_call_function_queue(false);
+	local_irq_restore(flags);
+
 	return 0;
 }
 
-- 
2.7.4


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

end of thread, other threads:[~2019-03-26  8:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-25 13:51 [Fix PATCH] cpu/hotplug: Fix bug report when add "nosmt" parameter with CONFIG_HOTPLUG_CPU=N lantianyu1986
2019-03-25 14:16 ` Thomas Gleixner
2019-03-25 22:39   ` Thomas Gleixner
2019-03-26  8:44     ` Tianyu Lan
2019-03-25 19:31 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).