[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120216031441.GU9751@redhat.com>
Date: Wed, 15 Feb 2012 22:14:41 -0500
From: Don Zickus <dzickus@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: x86@...nel.org, LKML <linux-kernel@...r.kernel.org>,
tony.luck@...el.com, seiji.aguchi@....com, ak@...ux.intel.com,
mjg@...hat.com, levinsasha928@...il.com
Subject: Re: [PATCH 2/2] x86, reschedule: check to see if system is shutting
down
On Wed, Feb 15, 2012 at 06:59:47PM +0100, Peter Zijlstra wrote:
> > > The only way is to unplug all cpus except the one. Problem with that is
> > > that we cannot (as of yet) unplug the boot cpu.
> >
> > Yeah, well we can migrate to the boot cpu. I think powerpc does that for
> > kdump.
>
> Right, there's that.
Well we are in luck, migrating to cpu0 is already done in the shutdown
path.
arch/x86/kernel/reboot.c::native_machine_shutdown:662
set_cpus_allowed_ptr(current, cpumask_of(reboot_cpu_id));
Now most of the time it seems to be cpu0, but I guess corner cases can put
it elsewhere. I replaced 'stop_other_cpus' with 'for_each_online_cpu(cpu)
{ cpu_down(cpu) }. And things seemed to work. Output below, patch below
that:
=====================
Please stand by while rebooting the system...
[ 101.470240] md: stopping all md devices.
[ 101.474346] kvm: exiting hardware virtualization
[ 101.480071] sd 3:0:0:0: [sdb] Synchronizing SCSI cache
[ 101.535977] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[ 101.643479] Restarting system.
[ 101.646624] machine restart
[ 101.649501] DONDON: on cpu2
[ 101.652502] DONDON: on new cpu0
[ 101.658397] Broke affinity for irq 42
[ 101.662168] Broke affinity for irq 47
[ 101.669281] bnx2fc: CPU 1 offline: Remove Rx thread
[ 101.674381] CPU 1 offline: Remove Rx thread
[ 101.680595] Broke affinity for irq 22
[ 101.686510] bnx2fc: CPU 2 offline: Remove Rx thread
[ 101.691569] CPU 2 offline: Remove Rx thread
[ 101.697260] Broke affinity for irq 16
[ 101.702057] lockdep: fixing up alternatives.
[ 101.706476] SMP alternatives: switching to UP code
[ 101.720162] bnx2fc: CPU 3 offline: Remove Rx thread
[ 101.725206] CPU 3 offline: Remove Rx thread
====================
Does that work for you?
Cheers,
Don
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index d840e69..c3569ac 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -644,6 +644,7 @@ void native_machine_shutdown(void)
/* The boot cpu is always logical cpu 0 */
int reboot_cpu_id = 0;
+ int cpu;
#ifdef CONFIG_X86_32
/* See if there has been given a command line override */
@@ -652,17 +653,24 @@ void native_machine_shutdown(void)
reboot_cpu_id = reboot_cpu;
#endif
+ printk("DONDON: on cpu%d\n", smp_processor_id());
/* 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));
+ printk("DONDON: on new cpu%d\n", smp_processor_id());
/* O.K Now that I'm on the appropriate processor,
* stop all of the others.
*/
- stop_other_cpus();
+ //stop_other_cpus();
+ for_each_online_cpu(cpu) {
+ if (cpu == 0)
+ continue;
+ cpu_down(cpu);
+ }
#endif
lapic_shutdown();
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists