linux-2.6.18/evtchn: adjust CPU notifier registration
PATCH 1/1 linux-2.6.18/evtchn: adjust CPU notifier registration
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).
drivers/xen/evtchn/evtchn.c +6 -4
@@ -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);
evtchn: adjust CPU notifier registration
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).
drivers/xen/evtchn/evtchn.c +6 -4
@@ -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);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel