All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Keir Fraser <keir.fraser@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>
Subject: [PATCH 10/11] mini-os/xenbus: Provide queue->wakeup hook
Date: Fri, 20 Jun 2014 20:04:49 +0100	[thread overview]
Message-ID: <1403291090-8657-11-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1403291090-8657-1-git-send-email-ian.jackson@eu.citrix.com>

This allows xenbus's caller to get called back when an item is put on
the queue, rather than simply having the waitq signaled.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 include/mini-os/xenbus.h |   15 +++++++++++++++
 xen/xenbus/xenbus.c      |    8 +++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/include/mini-os/xenbus.h b/include/mini-os/xenbus.h
index a811c19..1900e55 100644
--- a/include/mini-os/xenbus.h
+++ b/include/mini-os/xenbus.h
@@ -46,6 +46,7 @@ struct xenbus_event {
 };
 struct xenbus_event_queue {
     MINIOS_STAILQ_HEAD(, xenbus_event) events;
+    void (*wakeup)(struct xenbus_event_queue*); /* can be safely ignored */
     struct wait_queue_head waitq;
 };
 
@@ -129,6 +130,20 @@ domid_t xenbus_get_self_id(void);
  * ----- asynchronous low-level interface -----
  */
 
+/*
+ * Use of queue->wakeup:
+ *
+ * If queue->wakeup is set, it will be called instead of
+ * wake_up(&queue->waitq);
+ *
+ * queue->wakeup is initialised (to a function which just calls
+ * wake_up) by xenbus_event_queue_init.  The user who wants something
+ * different should set ->wakeup after the init, but before the queue
+ * is used for xenbus_id_allocate or xenbus_watch_prepare.
+ *
+ * queue->wakeup() is called with the req_lock held.
+ */
+
 /* Allocate an identifier for a xenbus request.  Blocks if none are
  * available.  Cannot fail.  On return, we may use the returned value
  * as the id in a xenbus request.
diff --git a/xen/xenbus/xenbus.c b/xen/xenbus/xenbus.c
index 7b391c5..e5d7f36 100644
--- a/xen/xenbus/xenbus.c
+++ b/xen/xenbus/xenbus.c
@@ -67,9 +67,15 @@ spinlock_t xenbus_req_lock = SPIN_LOCK_UNLOCKED;
  *    watches
  */
 
+static void queue_wakeup(struct xenbus_event_queue *queue)
+{
+    wake_up(&queue->waitq);
+}
+
 void xenbus_event_queue_init(struct xenbus_event_queue *queue)
 {
     MINIOS_STAILQ_INIT(&queue->events);
+    queue->wakeup = queue_wakeup;
     init_waitqueue_head(&queue->waitq);
 }
 
@@ -92,7 +98,7 @@ static void queue_event(struct xenbus_event_queue *queue,
 {
     /* Called with lock held */
     MINIOS_STAILQ_INSERT_TAIL(&queue->events, event, entry);
-    wake_up(&queue->waitq);
+    queue->wakeup(queue);
 }
 
 static struct xenbus_event *await_event(struct xenbus_event_queue *queue)
-- 
1.7.10.4

  parent reply	other threads:[~2014-06-20 19:05 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20 19:04 [RFC PATCH 00/11] mini-os: xenbus changes for rump kernels Ian Jackson
2014-06-20 19:04 ` [PATCH 01/11] mini-os: Make some headers more rumpkernel-friendly Ian Jackson
2014-06-23 10:32   ` Andrew Cooper
2014-06-23 14:24     ` Ian Jackson
2014-06-26 11:54   ` Samuel Thibault
2014-06-20 19:04 ` [PATCH 02/11] mini-os: Provide <mini-os/queue.h> Ian Jackson
2014-06-26 11:59   ` Samuel Thibault
2014-06-20 19:04 ` [PATCH 03/11] mini-os/xenbus: Add missing locks to xb_write Ian Jackson
2014-06-26 12:04   ` Samuel Thibault
2014-06-30 12:47     ` Ian Jackson
2014-06-30 12:59       ` Samuel Thibault
2014-06-20 19:04 ` [PATCH 04/11] mini-os/xenbus: Change type of xenbus_event_queue Ian Jackson
2014-06-26 12:06   ` Samuel Thibault
2014-06-20 19:04 ` [PATCH 05/11] mini-os/xenbus: Use MINIOS_LIST for the list of watches Ian Jackson
2014-06-26 12:06   ` Samuel Thibault
2014-06-20 19:04 ` [PATCH 06/11] mini-os/xenbus: Rename xenbus_events to xenbus_default_watch_queue Ian Jackson
2014-06-26 12:07   ` Samuel Thibault
2014-06-20 19:04 ` [PATCH 07/11] mini-os/xenbus: Unify watch and reply queues Ian Jackson
2014-06-26 12:15   ` Samuel Thibault
2014-06-20 19:04 ` [PATCH 08/11] mini-os/xenbus: Expose lower-level interface Ian Jackson
2014-06-26 12:24   ` Samuel Thibault
2014-06-20 19:04 ` [PATCH 09/11] mini-os/xenbus: Sort out request and watch locking Ian Jackson
2014-06-26 12:16   ` Samuel Thibault
2014-06-20 19:04 ` Ian Jackson [this message]
2014-06-26 12:18   ` [PATCH 10/11] mini-os/xenbus: Provide queue->wakeup hook Samuel Thibault
2014-06-30 12:49     ` Ian Jackson
2014-06-20 19:04 ` [PATCH 11/11] mini-os/xenbus: Provide xenbus_free Ian Jackson
2014-06-26 12:24   ` Samuel Thibault
2014-06-23 10:25 ` [RFC PATCH 00/11] mini-os: xenbus changes for rump kernels George Dunlap
2014-06-23 14:27   ` Ian Jackson
2014-06-23 10:35 ` Andrew Cooper
2014-06-23 14:26   ` Ian Jackson
2014-06-27 11:52     ` Ian Campbell
2014-06-27 11:59       ` Samuel Thibault
2014-06-30 15:19       ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403291090-8657-11-git-send-email-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=keir.fraser@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.