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

[Xen-changelog] Fire watch callbacks on their own workqueue. Mainly this is



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 03d69dbea1527720f11a358bf525efbb8c40aec7
# Parent  f9bd8df8a0985b353de9aa6a15cb28208e9d1048
Fire watch callbacks on their own workqueue. Mainly this is
to make debugging easier (it's hard if an error takes out
the default workqueue!). Also, watch callbacks can be
arbitrarily long-lived, so it's more polite.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r f9bd8df8a098 -r 03d69dbea152 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Mon Oct 10 
15:16:41 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Mon Oct 10 
15:57:41 2005
@@ -79,6 +79,7 @@
 
 static LIST_HEAD(watches);
 static DEFINE_SPINLOCK(watches_lock);
+static struct workqueue_struct *watches_workq;
 
 static int get_error(const char *errorstring)
 {
@@ -626,7 +627,7 @@
        up_read(&xs_state.suspend_mutex);
 
        /* Make sure watch is not in use. */
-       flush_scheduled_work();
+       flush_workqueue(watches_workq);
 }
 EXPORT_SYMBOL(unregister_xenbus_watch);
 
@@ -708,7 +709,7 @@
                msg->u.watch.handle = find_watch(
                        msg->u.watch.vec[XS_WATCH_TOKEN]);
                if (msg->u.watch.handle != NULL) {
-                       schedule_work(&msg->u.watch.work);
+                       queue_work(watches_workq, &msg->u.watch.work);
                } else {
                        kfree(msg->u.watch.vec);
                        kfree(msg);
@@ -737,9 +738,6 @@
        }
 }
 
-/*
-** Initialize the interface to xenstore. 
-*/
 int xs_init(void)
 {
        int err;
@@ -756,8 +754,12 @@
        err = xb_init_comms();
        if (err)
                return err;
-       
-       reader = kthread_run(read_thread, NULL, "xenbusd");
+
+       /* Create our own workqueue for executing watch callbacks. */
+       watches_workq = create_singlethread_workqueue("xenwatch");
+       BUG_ON(watches_workq == NULL);
+
+       reader = kthread_run(read_thread, NULL, "xenbus");
        if (IS_ERR(reader))
                return PTR_ERR(reader);
 

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


 


Rackspace

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