Ian Jackson [Mon, 16 Jun 2014 17:01:54 +0000 (18:01 +0100)]
mini-os/xenbus: Sort out request and watch locking
Make the xenbus_req_lock public, and lock it everywhere it is needed.
It needs to protect not just the xenbus request ring itself, but also
a number of internal data structures.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Wed, 11 Jun 2014 15:17:20 +0000 (16:17 +0100)]
mini-os/xenbus: Expose lower-level interface
Provide an interface that allows a xenbus user to explicitly allocate
ids, deal with responses asynchronously, specify the queues to be used
for responses and watches, etc.
More specifically:
* Enhance xenbus_event to be capable of dealing with both watches and
command replies. In particular, arrange that it will contain a
pointer to the watch. We leave the old fields undisturbed because
of the way that this struct is already used in various places.
* Provide that a xenbus_event for a command response contains a copy
of the pointer to the reply message, rather than putting it in the
req_info (which is visible only internally).
* Rename `struct watch' to `struct xenbus_watch' because it needs
to be in the public interface.
* allocate_xenbus_id becomes xenbus_id_allocate; same for release.
* Make xb_write into a public function, xenbus_xb_write.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Ian Jackson [Mon, 9 Jun 2014 15:02:11 +0000 (16:02 +0100)]
mini-os/xenbus: Unify watch and reply queues
We are going to want to provide an interface to xenbus which does not
reorder messages for a particular user. In particular, the reply to a
watch or unwatch should not be reordered with respect to watch events.
To this end we arrange that both replies and watches use the same kind
of queue inside the xenbus driver. Currently this queue type is only
exposed outside the xenbus driver for use with watches, as before.
Important functional changes in this patch include:
* There is a separate scheduler wait queue for each reply queue,
rather than one for all watches and one for each outstanding reply.
This wait queue lives in the reply queue struct.
* There are abstracted-away internal functions for removing (and,
indeed, awaiting) events. xenbus_wait_for_watch_return becomes a
trivial wrapper around await_event.
* Handling of the replies to requests is formalised, using the new
queues. Now a single reply queue might be used for multiple
requests (although there are no callers that do this).
Other changes are:
* The latent bug in xenbus_msg_reply, which assumed no spurious
wakeups, is gone.
* The "in_use" flag in the request array can be done away with, since
we can use the reply_queue pointer value instead.
* The callers of allocate_xenbus_id (currently, only
xenbus_msg_reply), have to initialise a xenbus_event_queue and
provide it to allocate_xenbus_id.
* Abolished the xenbus_watch_queue waitq in favour of the waitq inside
the xenbus_default_watch_events event queue.
* Abolished a duplicate assignment to in_use in release_xenbus_id.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Ian Jackson [Wed, 11 Jun 2014 12:28:07 +0000 (13:28 +0100)]
mini-os/xenbus: Use MINIOS_LIST for the list of watches
Remove the open-coded singly-linked list manipulation.
We replace it with a doubly-linked list because in forthcoming patches
we are going to want the ability to remove a watch from the middle of
the list without hunting for it first.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Ian Jackson [Fri, 20 Jun 2014 15:47:46 +0000 (16:47 +0100)]
mini-os/xenbus: Change type of xenbus_event_queue
We change xenbus_event_queue from a pointer typedef to a struct, for
two reasons:
1. In a moment we are going to want to extend this struct to include
a minios scheduler wait queue.
2. We can replace the open-coded list with a MINIOS_STAILQ.
All the xenbus users need to call the new initialisation function
instead of simply initialising the struct to NULL, and have their
parameter type changed.
There is a functional side-effect: now we are using a tail queue,
rather than a tailless queue, we insert events at the end rather than
the beginning. So watch events now come out in chronological order,
rather than their order possibly being scrambled in the queue.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Ian Jackson [Wed, 11 Jun 2014 12:18:09 +0000 (13:18 +0100)]
mini-os: Provide <mini-os/queue.h>
Upstream (xen.git) minios has MINIOS_{,S}{LIST,TAILQ}_* (eg,
MINIOS_LIST_INSERT). rumpuser-xen has {,S}{LIST,TAILQ}_* (eg,
LIST_INSERT) because it can #include <sys/queue.h>.
We want to try to make this code upstreamable (or at least no less
upstreamable than it already is).
So provide <mini-os/queue.h> which provides MINIOS_* in terms of
<sys/queue.h>. That allows us to use MINIOS_* in the bulk of minios.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Ian Jackson [Thu, 15 May 2014 18:26:25 +0000 (19:26 +0100)]
rumpkern_demo: Work even though master socket is not fd 0
The WOPR demo was predicated on the master socket being fd 0. But of
course it isn't because the rump environment now correctly starts with
some fds 0-2.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Antti Kantee [Thu, 19 Sep 2013 11:06:06 +0000 (14:06 +0300)]
Don't depend everything on Makefile
I promise I'll remember to type "make clean" if I make _critical_ changes
to the Makefile. 99% of the time I just want to modify the set of libs
that gets linked, and I don't want to wait for a recompile.