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] Fire watch callbacks on their own workqueue. Mainly this

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fire watch callbacks on their own workqueue. Mainly this is
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 10 Oct 2005 16:02:11 +0000
Delivery-date: Mon, 10 Oct 2005 15:59:42 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Fire watch callbacks on their own workqueue. Mainly this is, Xen patchbot -unstable <=