From: "Jan Beulich" Subject: [PATCH] linux-2.6.18/evtchn: adjust CPU notifier registration Date: Tue, 10 Sep 2013 11:09:53 +0100 Message-ID: <522F0C1102000078000F1CA3@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part1A296BE1.0__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VJKtR-0000oC-W1 for xen-devel@lists.xenproject.org; Tue, 10 Sep 2013 10:09:58 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part1A296BE1.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline While mostly benign in 2.6.18 (apart from avoiding registration of a notifier that would never do anything useful under !HOTPLUG_CPU), the distinction is quite relevant when backporting the driver to 2.6.16: register_cpu_notifier() is available to modules there even when !HOTPLUG_CPU, and thus no such notifier block must live in .cpuinit.data (or else modules calling register_cpu_notifier() will result in hitting an unmapped page when traversing the linked list of notifiers). Signed-off-by: Jan Beulich --- a/drivers/xen/evtchn/evtchn.c +++ b/drivers/xen/evtchn/evtchn.c @@ -492,7 +492,8 @@ static struct miscdevice evtchn_miscdev .fops =3D &evtchn_fops, }; =20 -static int __cpuinit evtchn_cpu_notify(struct notifier_block *nfb, +#ifdef CONFIG_HOTPLUG_CPU +static int evtchn_cpu_notify(struct notifier_block *nfb, unsigned long action, void *hcpu) { int hotcpu =3D (unsigned long)hcpu; @@ -522,9 +523,10 @@ static int __cpuinit evtchn_cpu_notify( return NOTIFY_OK; } =20 -static struct notifier_block __cpuinitdata evtchn_cpu_nfb =3D { +static struct notifier_block evtchn_cpu_nfb =3D { .notifier_call =3D evtchn_cpu_notify }; +#endif =20 static int __init evtchn_init(void) { @@ -543,7 +545,7 @@ static int __init evtchn_init(void) return err; } =20 - register_cpu_notifier(&evtchn_cpu_nfb); + register_hotcpu_notifier(&evtchn_cpu_nfb); =20 printk("Event-channel device installed.\n"); =20 @@ -553,7 +555,7 @@ static int __init evtchn_init(void) static void __exit evtchn_cleanup(void) { misc_deregister(&evtchn_miscdev); - unregister_cpu_notifier(&evtchn_cpu_nfb); + unregister_hotcpu_notifier(&evtchn_cpu_nfb); } =20 module_init(evtchn_init); --=__Part1A296BE1.0__= Content-Type: text/plain; name="xenlinux-evtchn-hotcpu-notifier.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xenlinux-evtchn-hotcpu-notifier.patch" evtchn: adjust CPU notifier registration=0A=0AWhile mostly benign in = 2.6.18 (apart from avoiding registration of a=0Anotifier that would never = do anything useful under !HOTPLUG_CPU), the=0Adistinction is quite = relevant when backporting the driver to 2.6.16:=0Aregister_cpu_notifier() = is available to modules there even when=0A!HOTPLUG_CPU, and thus no such = notifier block must live in=0A.cpuinit.data (or else modules calling = register_cpu_notifier() will=0Aresult in hitting an unmapped page when = traversing the linked list of=0Anotifiers).=0A=0ASigned-off-by: Jan = Beulich =0A=0A--- a/drivers/xen/evtchn/evtchn.c=0A+++ = b/drivers/xen/evtchn/evtchn.c=0A@@ -492,7 +492,8 @@ static struct = miscdevice evtchn_miscdev=0A .fops =3D &evtchn_fops,=0A };=0A = =0A-static int __cpuinit evtchn_cpu_notify(struct notifier_block *nfb,=0A+#= ifdef CONFIG_HOTPLUG_CPU=0A+static int evtchn_cpu_notify(struct notifier_bl= ock *nfb,=0A unsigned long action, void *hcpu)=0A {=0A = int hotcpu =3D (unsigned long)hcpu;=0A@@ -522,9 +523,10 @@ static int = __cpuinit evtchn_cpu_notify(=0A return NOTIFY_OK;=0A }=0A = =0A-static struct notifier_block __cpuinitdata evtchn_cpu_nfb =3D = {=0A+static struct notifier_block evtchn_cpu_nfb =3D {=0A .notifier_c= all =3D evtchn_cpu_notify=0A };=0A+#endif=0A =0A static int __init = evtchn_init(void)=0A {=0A@@ -543,7 +545,7 @@ static int __init evtchn_init(= void)=0A return err;=0A }=0A =0A- register_cpu_notifi= er(&evtchn_cpu_nfb);=0A+ register_hotcpu_notifier(&evtchn_cpu_nfb);= =0A =0A printk("Event-channel device installed.\n");=0A =0A@@ = -553,7 +555,7 @@ static int __init evtchn_init(void)=0A static void __exit = evtchn_cleanup(void)=0A {=0A misc_deregister(&evtchn_miscdev);=0A- = unregister_cpu_notifier(&evtchn_cpu_nfb);=0A+ unregister_hotcpu_notifier(= &evtchn_cpu_nfb);=0A }=0A =0A module_init(evtchn_init);=0A --=__Part1A296BE1.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part1A296BE1.0__=--