public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] cpu: create stop machine in disable_nonboot_cpus
@ 2009-01-07 15:39 Jiri Slaby
  2009-01-07 16:00 ` Heiko Carstens
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2009-01-07 15:39 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel, Jiri Slaby, Heiko Carstens, Rusty Russell

Commit
772cd49cfa4002439b16dd6b553a11771ac096fd
(stop_machine: introduce stop_machine_create/destroy.)
introduced stop_machine_create/destroy, but omitted to call them from
disable_nonboot_cpus (it's called only from cpu_down).

Create and destroy the stop machine even in disable_nonboot_cpus
(which calls _cpu_down too) to avoid NULL-pointer dereference oops on
suspend.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
---
 kernel/cpu.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 30e74dd..79e40f0 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -379,8 +379,11 @@ static cpumask_var_t frozen_cpus;
 
 int disable_nonboot_cpus(void)
 {
-	int cpu, first_cpu, error = 0;
+	int cpu, first_cpu, error;
 
+	error = stop_machine_create();
+	if (error)
+		return error;
 	cpu_maps_update_begin();
 	first_cpu = cpumask_first(cpu_online_mask);
 	/* We take down all of the non-boot CPUs in one shot to avoid races
@@ -409,6 +412,7 @@ int disable_nonboot_cpus(void)
 		printk(KERN_ERR "Non-boot CPUs are not disabled\n");
 	}
 	cpu_maps_update_done();
+	stop_machine_destroy();
 	return error;
 }
 
-- 
1.6.0.6


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

* Re: [PATCH 1/1] cpu: create stop machine in disable_nonboot_cpus
  2009-01-07 15:39 [PATCH 1/1] cpu: create stop machine in disable_nonboot_cpus Jiri Slaby
@ 2009-01-07 16:00 ` Heiko Carstens
  2009-01-07 16:10   ` Jiri Slaby
  0 siblings, 1 reply; 3+ messages in thread
From: Heiko Carstens @ 2009-01-07 16:00 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Rusty Russell, linux-kernel

On Wed, Jan 07, 2009 at 04:39:15PM +0100, Jiri Slaby wrote:
> Commit
> 772cd49cfa4002439b16dd6b553a11771ac096fd
> (stop_machine: introduce stop_machine_create/destroy.)
> introduced stop_machine_create/destroy, but omitted to call them from
> disable_nonboot_cpus (it's called only from cpu_down).
> 
> Create and destroy the stop machine even in disable_nonboot_cpus
> (which calls _cpu_down too) to avoid NULL-pointer dereference oops on
> suspend.
> 
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: Rusty Russell <rusty@rustcorp.com.au>

Yep, it's exactly the same what I had as well:

http://lkml.org/lkml/2009/1/7/67

Thanks ;)

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

* Re: [PATCH 1/1] cpu: create stop machine in disable_nonboot_cpus
  2009-01-07 16:00 ` Heiko Carstens
@ 2009-01-07 16:10   ` Jiri Slaby
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2009-01-07 16:10 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: Rusty Russell, linux-kernel

On 01/07/2009 05:00 PM, Heiko Carstens wrote:
> Yep, it's exactly the same what I had as well:

Great ;).

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

end of thread, other threads:[~2009-01-07 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-07 15:39 [PATCH 1/1] cpu: create stop machine in disable_nonboot_cpus Jiri Slaby
2009-01-07 16:00 ` Heiko Carstens
2009-01-07 16:10   ` Jiri Slaby

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