WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [linux-2.6.18-xen] Fix potential kthread deadlock during

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] Fix potential kthread deadlock during Xen suspend.
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 07 Sep 2007 09:10:36 -0700
Delivery-date: Fri, 07 Sep 2007 09:14:20 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1189155842 -3600
# Node ID 1e2284d885fbe9fc0f18143ccce7fdcc30788e94
# Parent  f30b59f550c2ac03734c7a8cb63f658f16ca087a
Fix potential kthread deadlock during Xen suspend.

kthread_create() depends on keventd, so it cannot be executed from
keventd. Replace use of kthread_create() with an approach based on
kernel_thread().

Based on an original patch by:
 Signed-off-by: Ben Guthro <bguthro@xxxxxxxxxxxxxxx>
 Signed-off-by: Robert Phillips <rphillips@xxxxxxxxxxxxxxx>

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 drivers/xen/core/reboot.c |   36 +++++++++++++++---------------------
 1 files changed, 15 insertions(+), 21 deletions(-)

diff -r f30b59f550c2 -r 1e2284d885fb drivers/xen/core/reboot.c
--- a/drivers/xen/core/reboot.c Fri Aug 31 10:45:38 2007 +0100
+++ b/drivers/xen/core/reboot.c Fri Sep 07 10:04:02 2007 +0100
@@ -8,7 +8,6 @@
 #include <asm/hypervisor.h>
 #include <xen/xenbus.h>
 #include <linux/kmod.h>
-#include <linux/kthread.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
 
@@ -68,36 +67,31 @@ static int shutdown_process(void *__unus
 
 static int xen_suspend(void *__unused)
 {
-       int err = __xen_suspend(fast_suspend);
+       int err;
+
+       daemonize("suspend");
+       err = set_cpus_allowed(current, cpumask_of_cpu(0));
+       if (err) {
+               printk(KERN_ERR "Xen suspend can't run on CPU0 (%d)\n", err);
+               goto out;
+       }
+
+       err = __xen_suspend(fast_suspend);
        if (err)
                printk(KERN_ERR "Xen suspend failed (%d)\n", err);
+
+ out:
        shutting_down = SHUTDOWN_INVALID;
        return 0;
 }
 
-static int kthread_create_on_cpu(int (*f)(void *arg),
-                                void *arg,
-                                const char *name,
-                                int cpu)
-{
-       struct task_struct *p;
-       p = kthread_create(f, arg, name);
-       if (IS_ERR(p))
-               return PTR_ERR(p);
-       kthread_bind(p, cpu);
-       wake_up_process(p);
-       return 0;
-}
-
 static void __shutdown_handler(void *unused)
 {
        int err;
 
-       if (shutting_down != SHUTDOWN_SUSPEND)
-               err = kernel_thread(shutdown_process, NULL,
-                                   CLONE_FS | CLONE_FILES);
-       else
-               err = kthread_create_on_cpu(xen_suspend, NULL, "suspend", 0);
+       err = kernel_thread((shutting_down == SHUTDOWN_SUSPEND) ?
+                           xen_suspend : shutdown_process,
+                           NULL, CLONE_FS | CLONE_FILES);
 
        if (err < 0) {
                printk(KERN_WARNING "Error creating shutdown process (%d): "

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] Fix potential kthread deadlock during Xen suspend., Xen patchbot-linux-2.6.18-xen <=