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-devel

[Xen-devel] [PATCH 08/11] xen/hvm kexec: unregister the watch of the "ba

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 08/11] xen/hvm kexec: unregister the watch of the "backend" node during reboot
From: Olaf Hering <olaf@xxxxxxxxx>
Date: Thu, 28 Jul 2011 15:23:08 +0200
Delivery-date: Thu, 28 Jul 2011 06:30:26 -0700
Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1311859402; l=1542; s=domk; d=aepfle.de; h=References:Subject:To:From:Date:X-RZG-CLASS-ID:X-RZG-AUTH; bh=1iABLT39t5vwqnZDcWpRB9H6InI=; b=iIOZz1r28HdZfKLca1oF9CGhXHcYpRe76g1qa6BESrKaqdUq81u0fchwASjsW31YGGq BCQXiv2w3YxRsl0bsQQFNcpv/XqIDlqE+RpAcWLpwEH3DOhG3ps06w5Csisj831j3ew9Z Y71QQasaFU6t9LtEO+oLW+ALGOPwYHYz4OI=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20110728132300.248098023@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: quilt/0.48-16.4
The watch of the xenstore "backend" 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_backend.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

Index: linux-3.0/drivers/xen/xenbus/xenbus_probe_backend.c
===================================================================
--- linux-3.0.orig/drivers/xen/xenbus/xenbus_probe_backend.c
+++ linux-3.0/drivers/xen/xenbus/xenbus_probe_backend.c
@@ -42,6 +42,8 @@
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/notifier.h>
+#include <linux/kexec.h>
+#include <linux/syscore_ops.h>
 
 #include <asm/page.h>
 #include <asm/pgtable.h>
@@ -255,6 +257,18 @@ static int backend_probe_and_watch(struc
        return NOTIFY_DONE;
 }
 
+static void xenbus_backend_shutdown_watcher(void)
+{
+       if (!kexec_is_loaded())
+               return;
+
+       unregister_xenbus_watch(&be_watch);
+}
+
+static struct syscore_ops xenbus_backend_watcher_syscore_ops = {
+       .shutdown = xenbus_backend_shutdown_watcher,
+};
+
 static int __init xenbus_probe_backend_init(void)
 {
        static struct notifier_block xenstore_notifier = {
@@ -270,6 +284,7 @@ static int __init xenbus_probe_backend_i
                return err;
 
        register_xenstore_notifier(&xenstore_notifier);
+       register_syscore_ops(&xenbus_backend_watcher_syscore_ops);
 
        return 0;
 }


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

<Prev in Thread] Current Thread [Next in Thread>