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

[Xen-devel] [PATCH] linux-2.6.18/evtchn: adjust CPU notifier registration


  • To: "xen-devel" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Jan Beulich" <JBeulich@xxxxxxxx>
  • Date: Tue, 10 Sep 2013 11:09:53 +0100
  • Delivery-date: Tue, 10 Sep 2013 10:10:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

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 <jbeulich@xxxxxxxx>

--- a/drivers/xen/evtchn/evtchn.c
+++ b/drivers/xen/evtchn/evtchn.c
@@ -492,7 +492,8 @@ static struct miscdevice evtchn_miscdev
        .fops         = &evtchn_fops,
 };
 
-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 = (unsigned long)hcpu;
@@ -522,9 +523,10 @@ static int __cpuinit evtchn_cpu_notify(
        return NOTIFY_OK;
 }
 
-static struct notifier_block __cpuinitdata evtchn_cpu_nfb = {
+static struct notifier_block evtchn_cpu_nfb = {
        .notifier_call = evtchn_cpu_notify
 };
+#endif
 
 static int __init evtchn_init(void)
 {
@@ -543,7 +545,7 @@ static int __init evtchn_init(void)
                return err;
        }
 
-       register_cpu_notifier(&evtchn_cpu_nfb);
+       register_hotcpu_notifier(&evtchn_cpu_nfb);
 
        printk("Event-channel device installed.\n");
 
@@ -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);
 }
 
 module_init(evtchn_init);



Attachment: xenlinux-evtchn-hotcpu-notifier.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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