]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[S390] sclp: fix possible deadlock on cpu rescan.
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Mon, 14 Jul 2008 07:57:28 +0000 (09:57 +0200)
committerHeiko Carstens <heiko.carstens@de.ibm.com>
Mon, 14 Jul 2008 08:02:01 +0000 (10:02 +0200)
smp_rescan_cpus() calls get_online_cpus() from a multithreaded
workqueue context. This may deadlock. This is the same bug as in
arch/s390/kernel/topology.c. This patch can be reverted as soon as
Oleg's patch gets merged.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/char/sclp_config.c

index ad05a87bc480b14531fdd5570f78c2dc3f93c9c5..7c9b39cee595e41ed5a4959d6a998213aed129b2 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/cpu.h>
+#include <linux/kthread.h>
 #include <linux/sysdev.h>
 #include <linux/workqueue.h>
 #include <asm/smp.h>
@@ -40,9 +41,19 @@ static void sclp_cpu_capability_notify(struct work_struct *work)
        put_online_cpus();
 }
 
-static void __ref sclp_cpu_change_notify(struct work_struct *work)
+static int sclp_cpu_kthread(void *data)
 {
        smp_rescan_cpus();
+       return 0;
+}
+
+static void __ref sclp_cpu_change_notify(struct work_struct *work)
+{
+       /* Can't call smp_rescan_cpus() from  workqueue context since it may
+        * deadlock in case of cpu hotplug. So we have to create a kernel
+        * thread in order to call it.
+        */
+       kthread_run(sclp_cpu_kthread, NULL, "cpu_rescan");
 }
 
 static void sclp_conf_receiver_fn(struct evbuf_header *evbuf)