Martin Lucina [Fri, 14 Nov 2014 16:37:06 +0000 (17:37 +0100)]
Rename rumprun-xen to rumprun
To reflect the intent to support different stacks in future (eg. kvm),
rumprun-xen is renamed to just rumprun, with a mandatory STACK as its
first argument.
Martin Lucina [Thu, 13 Nov 2014 10:40:08 +0000 (11:40 +0100)]
Configure rumprun-xen application stacks from Xenstore
In order to run rumprun-xen applications that are actually useful, we
need to be able to configure block devices and network interfaces.
These changes implement a basic mechanism to do this using Xenstore.
Conceptually the changes consist of the following parts which work
together:
- The rumpconfig module provides _rumprun_config() and
_rumprun_deconfig() functions. These are called before and after the
application main() function, and also in the case of deconfig when
_exit() is called.
- These functions rely on keys like the following being present in
Xenstore at the time the domain is started:
- The "xr" driver script, currently located in app-tools/. The
motivation for this script is twofold:
Firstly, in order to write the configuration to Xenstore the domain
must be created in a paused state so that we can retrieve its unique
<domid>. Only then do we know where in Xenstore to write the
configuration data.
Secondly, it is my intention with this work to provide a
"docker-alike" interface for running rumprun applications. The "xr"
script is therefore the CLI for running such applications.
Note that in this initial version, only configuring IPv4 network
interfaces with DHCP is supported, and only using image files with ffs
or cd9660 filesystems for block devices is supported.
Martin Lucina [Tue, 11 Nov 2014 15:11:46 +0000 (16:11 +0100)]
rumpuser_exit(), _exit(): Cleanly halt Mini-OS.
rumpuser_exit() and _exit() were calling minios_do_exit() which is
intended to be called from an exception context and/or other "panic"
situation. This was causing the stack trace code in minios_do_exit() to
walk off into never never land when the rumprun-xen application called
exit() or returned from main().
This commit adds a new minios_do_halt(reason) function, with the reason
code intended to mirror SHUTDOWN_* in xen/sched.h. Of those, currently
only poweroff and crash are implemented.
We then modify the rumpuser_exit() and _exit() functions to correctly
shut down the domain by calling minios_stop_kernel() followed by
minios_do_halt(MINIOS_HALT_POWEROFF).
Martin Lucina [Fri, 7 Nov 2014 17:14:50 +0000 (18:14 +0100)]
Localize all non-public Mini-OS symbols
Pass 3 of X in Mini-OS namespace cleanup.
We define a set of prefixes in the Makefile for the symbol namespaces we
wish to keep. Then, when linking minios.o we use objcopy to localize all
other symbols. Note the sole exception of the arch-specific startup file
(x86_64.o) as this is used as the linker %startfile.
Martin Lucina [Fri, 7 Nov 2014 16:52:39 +0000 (17:52 +0100)]
Clean up Mini-OS public namespace
Pass 2 of X in cleaning up Mini-OS namespace:
- All Mini-OS functions called by rumprun-xen are renamed to minios_* or
_minios_* for strictly internal functions, except those in the
blkfront_*, netfront_*, pcifront_* and xenbus_* driver namespaces.
- In the case of drivers, eg. init|shutdown_blkfront are renamed to
blkfront_*.
- All global variables are either manually made local, or placed under
the _minios_* namespace, with the exception of HYPERVISOR_shared_info,
and those variables under driver namespaces kept above.
- All callers are updated to use the new names. Where it makes sense,
macros such as alloc_page are also renamed into the minios_ namespace.
Martin Lucina [Thu, 6 Nov 2014 16:11:24 +0000 (17:11 +0100)]
Build Mini-OS and rump kernel middleware as discrete objects
In order to be able to make Mini-OS symbols local using objcopy we need to
build Mini-OS as a discrete relocatable object. While we're here, put the
various rump kernel middleware (libc stubs, rumphyper implementation)
into its own object file also.
Martin Lucina [Thu, 6 Nov 2014 16:06:46 +0000 (17:06 +0100)]
Clean up x86_64.o entry point namespace
This is pass 1 of X of cleaning up mini-os symbol namespace:
- Namespace all globals in x86_64.o (except _start) as _minios_XXX.
- Fix dependent calling code to use the new namespace
(hypercall-x86_64.h, sched.h, xen/arch/x86/*.c).
Martin Lucina [Thu, 6 Nov 2014 09:58:25 +0000 (10:58 +0100)]
Remove old demo from build, add simple hello-world test
In preparation for cleaning up minios/xenos to resolve (among other
things) symbol namespacing issues, remove the old non-app-tools-based
demo from the build.
As a temporary replacement add in a simple (not configure-based) "Hello,
world!" in tests/hello.
Martin Lucina [Thu, 30 Oct 2014 15:28:18 +0000 (16:28 +0100)]
stunt ld: Drop (LTO) -plugin and -plugin-opt from ld command
With (at least) GCC 4.9 on Debian jessie the GCC spec files have changed
to always use -plugin / -plugin-opt and load the LTO plugin, even if
-flto is not specified to GCC.
This breaks stunt ld which does not understand these options. Dropping
them from the linker command appears to do no harm.
Antti Kantee [Thu, 24 Jul 2014 12:17:06 +0000 (12:17 +0000)]
Pull in latest rumpsrc for symbol aliasing improvements.
E.g. select is now available also as select, instead of as __select50
which is renamed using sys/select.h. this fixes e.g. configure scripts
which do not include headers.
Antti Kantee [Thu, 24 Jul 2014 08:55:39 +0000 (08:55 +0000)]
Speed up app-configure by a factor of many.
This is done by not linking in the full rump kernel at the configure
stage. A cross-configure configure script will only do compile tests and
it does not really care about what is present in the kernel. Since all
of the "libc" bits are in librump (apart from ones we handle directly on
top of minios), just linking in librump at the configure stage is enough.
Antti Kantee [Thu, 24 Jul 2014 08:50:41 +0000 (08:50 +0000)]
Make it easy to not link the networking stack.
Alternatively, could not link this file into the image, but it's easier
this way around. Notably, the hypercalls should somehow be bundled
with the virtif driver, but that's build system rototill for another,
rainier day.
Antti Kantee [Wed, 23 Jul 2014 14:27:49 +0000 (14:27 +0000)]
Slightly revamp app-tools. Provide temporary compat wrappers for old usage.
User-visible changes:
rename rumpxen-app-foo -> rumpapp-xen-foo
rationale: easier to see what is the platform, hopefully useful if
the tools see usage beyond rump kernels on Xen
adjust usage of make so that the actual make is passed in the env
via $RUMP_APPTOOLS_MAKE, defaults to "make"
rationale: matches usage of make with actual make
Antti Kantee [Wed, 16 Jul 2014 10:09:10 +0000 (10:09 +0000)]
Tone down the catastrophy levels.
The TIMETOPANIC() stuff was mostly meant as a development phase thing to
make sure we catch unimplemented functions. Replace it with a function
returning ENOTSUP.
Ian Jackson [Mon, 14 Jul 2014 11:22:41 +0000 (12:22 +0100)]
app-tools: Pass -I.../rumpuser-xen/include
Applications may want the Xen or minios headers. We pass that as the
last -isystem (because these headers aren't very namespace clean -
particularly, the minios headers are very bad).
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Fri, 11 Jul 2014 11:40:30 +0000 (12:40 +0100)]
app-tools: -U various unwanted predefines
Find the list of things to undefine by running rumpmake on
rumptools/mk.conf: we take everything that rumpmake's CPPFLAGS would
undefine and undefine that ourselves.
The result is that we never (for example) provide -D__linux__.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Tue, 24 Jun 2014 17:39:09 +0000 (18:39 +0100)]
app-tools: Provide rumpxen-app-* helpers
Provide:
* A GCC wrapper which allows a naive Makefile to compile and link an
"executable" to generate a rump kernel image. This uses:
* A GCC specs file. This provides the right "system" include
directories - that is, the headers for the rump kernel application
environment. It also uses:
* A stunt wrapper for "ld". Building a minios-based Xen image needs
two runs of ld. This ld wrapper parses and categorises its
arguments and runs the two appropriate link steps.
* A pair of simple wrapper scripts for configure and make, which set
CC and pass the --host= option.
With these changes, and a suitably modified xen.git, we can run
configure and build a relevant subset of the Xen management libraries
and tools.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Ian Jackson [Mon, 9 Jun 2014 15:36:38 +0000 (16:36 +0100)]
rumpxendev: Provide /dev/xen/xenbus
This is a new rumpkernel component which provides an interface to the
minios xenbus driver. It presents as /dev/xen/xenbus which speaks the
standard xenstore protocol and can be used in the normal way by all
the tools (including with poll or select).
Internally, it arranges to use the xenbus driver's ability to
multiplex requests, responses and watch events from multiple users.
So it can be used in parallel with all existing rump kernel
functionality. The device can also perhaps be opened more than once.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
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>