[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 09/11] xen/hvm kexec: unregister the watch of the "device" node during reboot


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Olaf Hering <olaf@xxxxxxxxx>
  • Date: Thu, 28 Jul 2011 15:23:09 +0200
  • Delivery-date: Thu, 28 Jul 2011 06:40:56 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

The watch of the xenstore "device" node has to be unregistered during a
kexec reboot. Otherwise the kexec kernel will crash due to a memory
corruption because more than one watch is registered on that node.

v2:
 use kexec_is_loaded() function

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>

---
 drivers/xen/xenbus/xenbus_probe_frontend.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

Index: linux-3.0/drivers/xen/xenbus/xenbus_probe_frontend.c
===================================================================
--- linux-3.0.orig/drivers/xen/xenbus/xenbus_probe_frontend.c
+++ linux-3.0/drivers/xen/xenbus/xenbus_probe_frontend.c
@@ -13,6 +13,8 @@
 #include <linux/kthread.h>
 #include <linux/mutex.h>
 #include <linux/io.h>
+#include <linux/kexec.h>
+#include <linux/syscore_ops.h>
 
 #include <asm/page.h>
 #include <asm/pgtable.h>
@@ -263,6 +265,18 @@ static int frontend_probe_and_watch(stru
        return NOTIFY_DONE;
 }
 
+static void xenbus_frontend_shutdown_watcher(void)
+{
+       if (!kexec_is_loaded())
+               return;
+
+       unregister_xenbus_watch(&fe_watch);
+}
+
+static struct syscore_ops xenbus_frontend_watcher_syscore_ops = {
+       .shutdown = xenbus_frontend_shutdown_watcher,
+};
+
 
 static int __init xenbus_probe_frontend_init(void)
 {
@@ -279,6 +293,7 @@ static int __init xenbus_probe_frontend_
                return err;
 
        register_xenstore_notifier(&xenstore_notifier);
+       register_syscore_ops(&xenbus_frontend_watcher_syscore_ops);
 
        return 0;
 }


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.