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

[Xen-changelog] [linux-2.6.18-xen] Fix access to xenstore hangs after ho

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] Fix access to xenstore hangs after hot-remove CPU.
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 05 Dec 2007 05:40:42 -0800
Delivery-date: Wed, 05 Dec 2007 05:42:58 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1196762550 0
# Node ID f19522c04323ee8cf89f33530fbb4eb47ba20bd7
# Parent  b2768401db943e66af9d64bd610ffa225f560c0b
Fix access to xenstore hangs after hot-remove CPU.

CPU hotplug doesn't support user-space event channels.

$ echo 0 > /sys/devices/system/cpu/cpu1/online
$ xenstore-ls
... hangs up ...

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
---
 drivers/xen/evtchn/evtchn.c |   54 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 47 insertions(+), 7 deletions(-)

diff -r b2768401db94 -r f19522c04323 drivers/xen/evtchn/evtchn.c
--- a/drivers/xen/evtchn/evtchn.c       Mon Dec 03 08:50:12 2007 +0000
+++ b/drivers/xen/evtchn/evtchn.c       Tue Dec 04 10:02:30 2007 +0000
@@ -48,6 +48,7 @@
 #include <linux/init.h>
 #include <linux/gfp.h>
 #include <linux/mutex.h>
+#include <linux/cpu.h>
 #include <xen/evtchn.h>
 #include <xen/public/evtchn.h>
 
@@ -231,6 +232,15 @@ static ssize_t evtchn_write(struct file 
        return rc;
 }
 
+static unsigned int next_bind_cpu(cpumask_t map)
+{
+       static unsigned int bind_cpu;
+       bind_cpu = next_cpu(bind_cpu, map);
+       if (bind_cpu >= NR_CPUS)
+               bind_cpu = first_cpu(map);
+       return bind_cpu;
+}
+
 static void evtchn_bind_to_user(struct per_user_data *u, int port)
 {
        spin_lock_irq(&port_user_lock);
@@ -238,13 +248,8 @@ static void evtchn_bind_to_user(struct p
        BUG_ON(port_user[port] != NULL);
        port_user[port] = u;
 
-       if (u->bind_cpu == -1) {
-               static unsigned int bind_cpu;
-               bind_cpu = next_cpu(bind_cpu, cpu_online_map);
-               if (bind_cpu >= NR_CPUS)
-                       bind_cpu = first_cpu(cpu_online_map);
-               u->bind_cpu = bind_cpu;
-       }
+       if (u->bind_cpu == -1)
+               u->bind_cpu = next_bind_cpu(cpu_online_map);
 
        rebind_evtchn_to_cpu(port, u->bind_cpu);
 
@@ -483,6 +488,38 @@ static struct miscdevice evtchn_miscdev 
        .fops         = &evtchn_fops,
 };
 
+static int __cpuinit evtchn_cpu_notify(struct notifier_block *nfb,
+                       unsigned long action, void *hcpu)
+{
+       int hotcpu = (unsigned long)hcpu;
+       cpumask_t map = cpu_online_map;
+       int port, newcpu;
+       struct per_user_data *u;
+
+       switch (action) {
+       case CPU_DOWN_PREPARE:
+               cpu_clear(hotcpu, map);
+               spin_lock_irq(&port_user_lock);
+               for (port = 0; port < NR_EVENT_CHANNELS; port++) {
+                       if ((u = port_user[port]) != NULL && 
+                           u->bind_cpu == hotcpu &&
+                           (newcpu = next_bind_cpu(map)) < NR_CPUS) {
+                               rebind_evtchn_to_cpu(port, newcpu);
+                               u->bind_cpu = newcpu;
+                       }
+               }
+               spin_unlock_irq(&port_user_lock);
+               break;
+       default:
+               return NOTIFY_DONE;
+       }
+       return NOTIFY_OK;
+}
+
+static struct notifier_block __cpuinitdata evtchn_cpu_nfb = {
+       .notifier_call = evtchn_cpu_notify
+};
+
 static int __init evtchn_init(void)
 {
        int err;
@@ -500,6 +537,8 @@ static int __init evtchn_init(void)
                return err;
        }
 
+       register_cpu_notifier(&evtchn_cpu_nfb);
+
        printk("Event-channel device installed.\n");
 
        return 0;
@@ -508,6 +547,7 @@ static void evtchn_cleanup(void)
 static void evtchn_cleanup(void)
 {
        misc_deregister(&evtchn_miscdev);
+       unregister_cpu_notifier(&evtchn_cpu_nfb);
 }
 
 module_init(evtchn_init);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] Fix access to xenstore hangs after hot-remove CPU., Xen patchbot-linux-2.6.18-xen <=