From: Olaf Hering Subject: [PATCH 07/11] xen/hvm kexec: unregister memory/target watch in xen-balloon.c Date: Thu, 28 Jul 2011 15:23:07 +0200 Message-ID: <20110728132302.475939298@aepfle.de> References: <20110728132300.248098023@aepfle.de> Return-path: Content-Disposition: inline; filename=xen.syscore_ops.unregister_watch.xen-balloon.patch List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Unregister the memory/target watch during kexec. The watche can not be re-registered in the kexec kernel because it is still seen as busy by xenstore. v2: use kexec_is_loaded() function Signed-off-by: Olaf Hering --- drivers/xen/xen-balloon.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) Index: linux-3.0/drivers/xen/xen-balloon.c =================================================================== --- linux-3.0.orig/drivers/xen/xen-balloon.c +++ linux-3.0/drivers/xen/xen-balloon.c @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include #include @@ -91,6 +93,18 @@ static struct notifier_block xenstore_no .notifier_call = balloon_init_watcher, }; +static void xen_balloon_shutdown_watcher(void) +{ + if (!kexec_is_loaded()) + return; + + unregister_xenbus_watch(&target_watch); +} + +static struct syscore_ops xen_balloon_watcher_syscore_ops = { + .shutdown = xen_balloon_shutdown_watcher, +}; + static int __init balloon_init(void) { if (!xen_domain()) @@ -100,6 +114,7 @@ static int __init balloon_init(void) register_balloon(&balloon_sysdev); register_xenstore_notifier(&xenstore_notifier); + register_syscore_ops(&xen_balloon_watcher_syscore_ops); return 0; }