public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: make reboot task only run on the appropriate processor
@ 2013-11-05  9:16 Baoquan He
  2013-11-05 20:28 ` Vivek Goyal
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Baoquan He @ 2013-11-05  9:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, mingo, hpa, x86, akpm, holt, davej, rmk+kernel, vgoyal,
	chaowang, mwhitehe, kexec, Baoquan He

Currently system always reboot after below message when execute "kexec -e".

[    0.572119] smpboot: Booting Node   0, Processors  #   1 OK

In commit 1b3a5d02ee070c8f9943333b9b6370f486601e0f, reboot= handling was
moved to kerne/reboot.c. However, the code to migrate current thread to
reboot cpu was removed. That cause this incorrect kexec behavior.

Now add that code block back.

Reported-by: Matthew Whitehead <mwhitehe@redhat.com>
Reported-by: Dave Young <dyoung@redhat.com>
Tested-by: WANG Chao <chaowang@redhat.com>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
 arch/x86/kernel/reboot.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 7e920bf..3049de9 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -551,6 +551,21 @@ void native_machine_shutdown(void)
 {
 	/* Stop the cpus and apics */
 #ifdef CONFIG_SMP
+       /* The boot cpu is always logical cpu 0 */
+       int reboot_cpu_id = 0;
+
+       /* See if there has been given a command line override */
+       if ((reboot_cpu != -1) && (reboot_cpu < nr_cpu_ids) &&
+               cpu_online(reboot_cpu))
+               reboot_cpu_id = reboot_cpu;
+
+       /* Make certain the cpu I'm about to reboot on is online */
+       if (!cpu_online(reboot_cpu_id))
+               reboot_cpu_id = smp_processor_id();
+
+       /* Make certain I only run on the appropriate processor */
+       set_cpus_allowed_ptr(current, cpumask_of(reboot_cpu_id));
+
 	/*
 	 * Stop all of the others. Also disable the local irq to
 	 * not receive the per-cpu timer interrupt which may trigger
-- 
1.8.3.1


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

end of thread, other threads:[~2013-11-11 16:03 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-05  9:16 [PATCH] x86: make reboot task only run on the appropriate processor Baoquan He
2013-11-05 20:28 ` Vivek Goyal
2013-11-05 21:39   ` H. Peter Anvin
2013-11-06  9:48   ` Baoquan He
2013-11-07  2:20   ` Baoquan He
2013-11-08  1:33 ` Dave Young
2013-11-08 15:14 ` Vivek Goyal
2013-11-08 16:12   ` H. Peter Anvin
2013-11-08 16:24     ` Vivek Goyal
2013-11-11 15:29     ` Vivek Goyal
2013-11-11 15:39       ` H. Peter Anvin
2013-11-11 15:57         ` Vivek Goyal
2013-11-11 16:02           ` H. Peter Anvin
2013-11-10  9:44   ` Baoquan He
2013-11-11  6:52     ` Baoquan He
2013-11-11  6:55   ` WANG Chao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox