Commit Graph
100 Commits
Author SHA1 Message Date
Ian Jackson 85896a7c4d build: add autoconf to replace custom checks in tools/check
Added autotools magic to replace custom check scripts. The previous
checks have been ported to autoconf, and some additional ones have
been added (plus the suggestions from running autoscan). Two files are
created as a result from executing configure script, config/Tools.mk
and config.h.

conf/Tools.mk is included by tools/Rules.mk, and contains most of the
options previously defined in .config, that can now be set passing
parameters or defining environment variables when executing configure
script.

config.h is only used by libxl/xl to detect yajl_version.h.

[ tools/config.sub and config.guess copied from
  autotools-dev 20100122.1 from Debian squeeze i386,
  which is GPLv2.

  tools/configure generated using the included ./autogen.sh
  which ran autoconf 2.67-2 from Debian squeeze i386.  autoconf
  is GPLv3+ but has a special exception for the autoconf output;
  this exception applies to us and exempts us from complying
  with GPLv3+ for configure, which is good as Xen is GPL2 only.

  - Ian Jackson ]

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Tested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-02-22 01:55:03 +00:00
Ian Jackson 8ae741f167 oxenstored: Fix spelling of "persistent" config variable
Change "persistant" to "persistent", in the code and the
example/default config.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2012-02-20 18:29:31 +00:00
Ian Jackson e4ca8e3c8d QEMU_TAG update 2012-02-20 16:29:19 +00:00
Ian Jackson 5e54ca2a55 QEMU_TAG update 2012-02-13 17:03:44 +00:00
Ian Jackson 6817a0ff5c QEMU_TAG update 2012-02-07 18:45:00 +00:00
Ian Jackson 23ac688cc4 Update QEMU_TAG, for CVE-2012-0029 2012-02-02 13:50:48 +00:00
Ian Jackson d3ec7b04d0 libxl: treat "dying" domains as destroyed
Rename the DOMAIN_DESTROY event to DOMAIN_DEATH and have it trigger
when the domain goes into the state indicated by the domaininfo flag
"dying".

This fixes a race which could leak a daemonised xl process, which
would have ignored the domain becoming "dying" and would then wait
forever to be told the domain was destroyed.

After the domain becomes "dying" we can't generate an event when it is
actually destroyed because xenstored will eat the relevant
VIRT_DOM_EXC virq and not generate an @releaseDomain, since xenstored
discards its own record of the domain's existence as soon as it sees
the domain "dying" and will not trigger @releaseDomain watches for
domains it knows nothing about.  Arguably this is a bug in xenstored,
and the whole @releaseDomain machinery is rather poor, but let us not
fix that now.

Anyway, xl does not really want to know when the domain is ultimately
destroyed.  It is enough for xl to know that it is on the way out, in
the "dying" state (which leads later to destruction by Xen).

Also fix a bug where domain_death_xswatch_callback might read one
domain beyond the valid data in its domaininfos array, by correctly
ordering the checks for empty domain list, end of domain list, and our
domain being missing.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-30 15:23:39 +00:00
Ian Jackson ee8d9b684b libxl: domain_death_xswatch_callback: add some debug logging
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-30 15:23:38 +00:00
Ian Jackson 43e5afa7c8 libxl: Convert to asynchronous: device removal
Convert libxl_FOO_device_remove, and the function which does the bulk
of the work, libxl__device_remove, to the new async ops scheme.

Adjust all callers.

Also remove libxl__wait_for_device_state which is now obsolete.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-27 17:01:26 +00:00
Ian Jackson a057e090a1 libxl: Introduce libxl__ev_devstate
Provide a new-style asynchronous facility for waiting for device
states on xenbus.  This will replace libxl__wait_for_device_state,
after the callers have been updated in later patches.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-27 17:01:25 +00:00
Ian Jackson 7632e94da4 libxl: New convenience macro CONTAINER_OF
Provide a convenient and type-safe wrapper which does the correct
dance to subtract offsetof.  This is very similar to the
"container_of" macro in the Linux kernel, but it has an additional
feature that instead of the type argument you may also pass an
expression of that type; this makes initialising a variable with
CONTAINER_OF easier.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-27 17:01:24 +00:00
Ian Jackson 889a89c7ac libxl: Asynchronous/long-running operation infrastructure
Provide a new set of machinery for writing public libxl functions
which may take a long time.  The application gets to decide whether
they want the function to be synchronous, or whether they'd prefer to
get a callback, or an event, when the operation is complete.

User(s) of this machinery will be introduced in later patch(es).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-27 17:01:24 +00:00
Ian Jackson 62a394f4eb libxl: Permit multithreaded event waiting
Previously, the context would be locked whenever we were waiting in
libxl's own call to poll (waiting for operating system events).

This would mean that multiple simultaneous calls to libxl_event_wait
in different threads with different parameters would not work
properly.

If we simply unlock the context, it would be possible for another
thread to discover the occurrence of the event we were waiting for,
without us even waking up, and we would remain in poll.  So we need a
way to wake up other threads: a pipe, one for each thread in poll.

We also need to move some variables from globals in the ctx to be
per-polling-thread.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-27 17:01:23 +00:00
Ian Jackson 705fdc03cd libxl: introduce libxl_fd_set_nonblock, rationalise _cloexec
We want a function for setting fds to nonblocking, so introduce one.

This is a very similar requirement to that for libxl_fd_set_cloexec,
so make it common with that.

While we're at it, fix a few deficiences that make this latter
function less desirable than it could be:
 * Change the return from 0/-1 (like a syscall) to a libxl error code
 * Take a boolean parameter for turning the flag on and off
 * Log on error (and so, take a ctx for this purpose)

Change callers of libxl_fd_set_cloexec to notice errors.  (Although,
such errors are highly unlikely.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-27 17:01:23 +00:00
Ian Jackson 328eb1ab8a libxl: New event generation API
Replace the existing API for retrieving high-level events (events
about domains, etc.) from libxl with a new one.

This changes the definition and semantics of the `libxl_event'
structure, and replaces the calls for obtaining information about
domain death and disk eject events.

This is an incompatible change, sorry.  The alternative was to try to
provide both the previous horrid API and the new one, and would also
involve never using the name `libxl_event' for the new interface.

The new "libxl_event" structure is blacklisted in the ocaml bindings
for two reasons:
  - It has a field name "type" (which is a keyword in ocaml);
    the ocaml idl generator should massage this field name on
    output, to "type_" perhaps.
  - The ocaml idl generator does not support KeyedUnion.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-27 17:01:22 +00:00
Ian Jackson e70f7c8c13 ocaml, libxl: support "private" fields
The changeset
  24378:b4365e2c2595  libxl: idl: support new "private" type attribute
is not complete.  Actually using this feature does not work because
the ocaml idl generator does not know about it.

So add that support.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-27 17:01:21 +00:00
Ian Jackson de532b9e15 libxl: New API for providing OS events to libxl
We provide a new set of functions and related structures
  libxl_osevent_*
which are to be used by event-driven applications to receive
information from libxl about which fds libxl is interested in, and
what timeouts libxl is waiting for, and to pass back to libxl
information about which fds are readable/writeable etc., and which
timeouts have occurred.  Ie, low-level events.

In this patch, this new machinery is still all unused.  Callers will
appear in the next patch in the series, which introduces a new API for
applications to receive high-level events about actual domains etc.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-27 17:01:20 +00:00
Ian Jackson ab94a40b96 xl: fix a couple of memory leaks
* dolog leaked the log message (!)

* main() leaked the config_data (perhaps a false positive from valgrind,
  but it's nicer to tidy it up).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-27 17:01:19 +00:00
Ian Jackson 8e56629832 .gitignore/.hgignore: New names for ioemu dirs, seabios
* Add new seabios clone directories to .gitignore.
* Add new qemu clone directories to .gitignore.
* Remove old tools/ioemu (long-obsolete) from .gitignore and .hgignore.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-27 17:01:18 +00:00
Ian Jackson a54239be9a libxl: Fix leaks on context init failure
Several of the error exits from libxl_ctx_alloc leaked the context
struct itself and sometimes other resources too.

Fix this by using the standard "rc = ERROR_FOO; goto out" error
handling style throughout.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-13 16:54:27 +00:00
Ian Jackson 2fe29aed9d libxl: Provide more formal libxl__ctx_lock and _unlock
Previously the only official interface for the ctx lock was the
CTX_LOCK and CTX_UNLOCK convenience macros, which assume and use "ctx"
from the surrounding scope.

Instead, provide libxl__ctx_lock and _unlock functions which can be
used by these convenience macros, and other callers who have
nonstandard requirements.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-13 16:54:27 +00:00
Ian Jackson 8fc051a10f libxl: move a lot more includes into libxl_internal.h
Move a lot of
  #include <stdfoo.h>
from individual files into libxl_internal.h.  This helps avoid
portability mistakes where necessary system headers are omitted from
individual files, and is also of course a convenience when developing.

Also add
  #include "libxl_osdeps.h" /* must come before any other headers */
to the top of most libxl*.c files, so that anyone who adds any headers
before libxl_internal.h will put the in the right place.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-13 16:54:19 +00:00
Ian Jackson 3607a75236 xenstore: New function xs_path_is_subpath
This utility function compares two paths, textually and reports
whether one is a subpath (a child path) of the other.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-13 16:54:11 +00:00
Ian Jackson 50c5cd458d libxl: make LIBXL_INIT_GC a statement, not an initialiser
Previously LIBXL_INIT_GC was an initialiser, which you were expected
to use like this:
    libxl__gc gc = LIBXL_INIT_GC(ctx);

But we are going to want to put things in the gc which are to be
initialised using other macros.  That means that LIBXL_INIT_GC has to
become a statement too.  So instead, we make it so that it's used like this:
    libxl_gc gc;
    LIBXL_INIT_GC(gc,ctx);

In fact there are only a couple of callers now,
including GC_INIT which uses this trick:
    libxl_gc gc[1];
    LIBXL_INIT_GC(gc[0],ctx);

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-13 16:54:11 +00:00
Ian Jackson a474119259 .gitignore: ocaml: add xenlight.mli
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-13 16:54:09 +00:00
Ian Jackson e46056227f .gitignore
Introduce a .gitignore file for the convenience of people who use git.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2012-01-12 16:45:21 +00:00
Ian Jackson ffd191dce0 Update QEMU_TAG 2012-01-05 17:25:23 +00:00
Ian Jackson 51c2c3c080 Update QEMU_TAG 2011-12-22 14:49:38 +00:00
Ian Jackson 03e7a9bacd flask: add tools/flask/utils/flask-label-pci to .hgignore
This was apparently forgotten in 24353:448c48326d6b

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

diff -r 7e90178b8bbf -r c995cdcc3700 .hgignore
--- a/.hgignore	Mon Dec 12 17:48:42 2011 +0000
+++ b/.hgignore	Mon Dec 12 17:58:25 2011 +0000
@@ -157,6 +157,7 @@
 ^tools/flask/utils/flask-getenforce$
 ^tools/flask/utils/flask-loadpolicy$
 ^tools/flask/utils/flask-setenforce$
+^tools/flask/utils/flask-label-pci$
 ^tools/fs-back/fs-backend$
 ^tools/hotplug/common/hotplugpath\.sh$
 ^tools/include/xen/.*$
2011-12-12 17:59:43 +00:00
Ian Jackson bdf07e8ed2 libxl: Use GC_INIT and GC_FREE everywhere
Replace
    libxl__gc gc = LIBXL_INIT_GC(ctx);
    ...
    libxl__free_all(&gc);
with
    GC_INIT(ctx);
    ...
    GC_FREE;
throughout with a couple of perl runes.

We must then adjust uses of the resulting gc for pointerness, which is
mostly just replacing all occurrences of "&gc" with "gc".  Also a
couple of unusual uses of LIBXL_INIT_GC needed to be fixed up by hand.

Here are those runes:
 perl -i -pe 's/\Q    libxl__gc gc = LIBXL_INIT_GC(ctx);/    GC_INIT(ctx);/' tools/libxl/*.c
 perl -i -pe 's/\Q    libxl__free_all(&gc);/    GC_FREE;/' tools/libxl/*.c

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-12-12 17:48:42 +00:00
Ian Jackson f6678b0499 libxl: libxl_ctx_free should free the ctx
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-12-12 17:48:42 +00:00
Ian Jackson c9d610abf5 libxl: make libxl__free_all idempotent
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-12-12 17:48:41 +00:00
Ian Jackson b51f531bba libxl: make libxl__[v]log const-correct
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-12-12 17:48:41 +00:00
Ian Jackson 51d3b77be0 libxl: introduce lock in libxl_ctx
This lock will be used to protect data structures which will be hung
off the libxl_ctx in subsequent patches.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-12-12 17:48:41 +00:00
Ian Jackson 8618d4e458 libxl: Rationalise #includes
libxl_internal.h now #includes libxl.h and various system headers.

This
 1. makes the order of header inclusion more predictable
 2. explicitly allows libxl_internal.h to use objects defined in libxl.h
 3. removes the need for individual files to include these headers

Also
 - remove some unnecessary #includes of libxl_utils.h,
   flexarray.h, etc. in some libxl*.c files,
 - include libxl_osdeps.h at the top of libxl_internal.h
 - add missing includes of libxl_osdeps.h to a couple of files
 - change libxl.h to libxl_internal.h in a couple of files

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-12-12 17:48:40 +00:00
Ian Jackson 814268e81d libxl: internal convenience macros
Provide some macros which are useful shorthands for use within libxl:
  * GC_INIT to initialise a gc from a ctx and GC_FREE to free it
  * CTX(gc) to give you back the ctx
  * LIBXL_TAILQ_INSERT_SORTED for inserting things into sorted lists

These will be used by later patches.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-12-12 17:48:40 +00:00
Ian Jackson e66ba879d1 libxl: permit declaration after statement
GCC and C99 allow declarations to be mixed with code.  This is a good
idea because:

 * It allows variables to be more often initialised as they are
   declared, thus reducing the occurrence of uninitialised variable
   errors.

 * Certain alloca-like constructs (arrays allocated at runtime on the
   stack) can more often be written without a spurious { } block.
   Such blocks are confusing to read.

 * It makes it easier to write and use macros which declare and
   initialise formulaic variables and do other function setup code,
   because there is no need to worry that such macros might be
   incompatible with each other or have strict ordering constraints.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-12-12 17:48:39 +00:00
Ian Jackson 966e43d7ad libxl: idl: Provide struct and union tags
Instead of generating:

   typedef struct {
     ...
   } libxl_foo;

Produce:

   typedef struct libxl_foo {
     ...
   } libxl_foo;

This makes it possible to refer to libxl idl-generated structs and
unions, as incomplete types, before they have been defined.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-12-12 17:48:39 +00:00
Ian Jackson eee7480fdf libxl: idl: support new "private" type attribute
This provides for fields in libxl datatypes which are only present in
the C version of structures and are used only by libxl itself.  This
is useful when a libxl datatype wants to contain fields which are used
by libxl internally and which are only present in the structure to
avoid additional memory allocation inconvenience.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-12-12 17:48:38 +00:00
Ian Jackson 46f6034c3d libxl: Provide a version of bsd's queue.h as _libxl_list.h
We would like some linked list macros which are (a) well known to be
sane and (b) typesafe.  BSD's queue.h meets these criteria.

We also provide some simple perlery to arrange to add the libxl_
namespace prefix to the macros.  This will allow us to #include
_libxl_list.h in our public header file without clashing with anyone
else who is also using another version of queue.h.

(A note on copyright: The FreeBSD files we are adding have an
[L]GPL-compatible licence, so there is no need to change our COPYING.
Although FreeBSD's queue.3 still contains the advertising clause, this
has been withdrawn by UCB as recorded in the FreeBSD COPYRIGHT file,
which is included in tools/libxl/external/ for reference.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.campbell@citrix.com>
Tested-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-12-12 17:48:38 +00:00
Ian Jackson be4840198b libxenstore: Provide xs_check_watch
Event-driven programs want to wait until the xs_fileno triggers for
reading, and then repeatedly call xs_check_watch.

Also xs_read_watch exposes a useless "num" out parameter, which should
always (if things aren't going hideously wrong) be at least 2 and
which the caller shouldn't be interested in.  So xs_check_watch
doesn't have one of those.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-12-12 17:48:38 +00:00
Ian Jackson 1eacd68b8a libxl: Make libxl__xs_* more const-correct
Paths and values which are not modified by these functions should be
declared as "const char *" not "char *".

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-12-12 17:48:37 +00:00
Ian Jackson e68ffca28b docs: Say in xm(1) that xm is obsolete
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2011-12-08 16:55:00 +00:00
Ian Jackson cfdfa421f1 Update QEMU_TAG 2011-12-08 16:40:09 +00:00
Ian Jackson b4756b45ac Update QEMU_TAG 2011-12-05 13:45:38 +00:00
Ian Jackson b814bb0972 Update QEMU_TAG 2011-12-01 18:26:45 +00:00
Ian Jackson 953d771e73 Update QEMU_TAG 2011-12-01 18:04:13 +00:00
Ian Jackson 72a91921ff Merge 2011-12-01 17:26:48 +00:00
Ian Jackson 223378e0a9 tools: Switch to system libaio (again)
The test system problems which prompted 24233:a9c67c2daf4b (itself a
tiny partial revert of 24184:4ecd3615e726 / 24186:7aa5838499d1) have
now been resolved, we think.  So revert 24233.

Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-12-01 16:18:58 +00:00
Ian Jackson ec2c0a84c9 docs/html/: Arrange for automatic build of hypercall docs
- Use index.html rather than a stamp file.
- Automatically generate dependencies.
- Wire into the docs build system

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-11-29 15:48:08 +00:00
Ian Jackson 9cf210024a docs/html/: Generate an "index.html" for hypercall docs
Generate an "index.html" containing various useful links.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-11-29 15:48:07 +00:00
Ian Jackson 262e118a37 docs/html/: Annotations for two hypercalls
Add annotations for a couple of the hypercalls:
 HYPERVISOR_set_trap_table
 HYPERVISOR_mmu_update

We do this by
 * annotating the list of #defines for hypercall numbers
 * annotating the list of error values
 * providing a function prototype for the systematically-named functions
The header generator does the rest.

This exercise revealed a couple of infelicities:
 * In the actual source code, do_mmu_update is defined to return an int
   and do_set_trap_table a long.  However both functions return either
   -Efoo (on error) or 0 for success.
 * The error numbers are defined only in the private header file
   xen/include/xen/errno.h and then only with names which will
   typically clash with other projects.  It would be nice to include a
   public version of this header which defines XEN_E*.  But for now
   we run xen-headers on errno.h too.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-11-29 15:48:07 +00:00
Ian Jackson 445e84f517 docs/html/: Initial cut of header documentation massager
"xen-headers" generates HTML from header files.  So far this generates
just some type cross-references, if you say
   make -C docs html/hypercall/stamp

An index page, proper wiring into the build system, and a few more
annotations in the headers, and will be forthcoming.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-11-29 15:48:06 +00:00
Ian Jackson 00bd522de7 Update QEMU_TAG 2011-11-28 17:42:06 +00:00
Ian Jackson 4c0192c805 libxl: open logs with O_APPEND
Logfiles should always be opened for append.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-11-28 17:19:28 +00:00
Ian Jackson ff167f07a8 tools: Revert to our built-in aio
These two changesets:
   24184:4ecd3615e726  tools: use system installed libaio by default.
   24186:7aa5838499d1  tools: use system libaio for blktap1 as well.
cause HVM guest installs (both Windows and Redhat) to fail on Debian
squeeze with xl.  So change the default for now.

Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-11-28 11:57:23 +00:00
Ian Jackson b3d436d2a4 tools/check: Add files missing from 24205:5c88358164cc
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-11-24 19:00:25 +00:00
Ian Jackson c977b08f1f Merge 2011-11-22 17:09:12 +00:00
Ian Jackson 549ec0f73f Update QEMU_TAG 2011-11-22 16:19:11 +00:00
Ian Jackson fb971dc3b4 Update QEMU_TAG 2011-11-02 16:21:37 +00:00
Ian Jackson 834f076e77 libvchan: remove erroneously-committed libvchan-node[12]; add them to .hgignore
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-10-07 10:47:04 +01:00
Ian Jackson ec0c9b58c2 QEMU_TAG update 2011-10-06 18:43:03 +01:00
Ian Jackson dcbc297aea tools: Revert seabios and upstream qemu build changes
These have broken the build and it seems to be difficult to fix.  So
we will revert the whole lot for now, and await corrected patch(es).

Revert "fix the build when CONFIG_QEMU is specified by the user"
Revert "tools: fix permissions of git-checkout.sh"
Revert "scripts/git-checkout.sh: Is not bash specific. Invoke with /bin/sh."
Revert "Clone and build Seabios by default"
Revert "Clone and build upstream Qemu by default"
Revert "Rename ioemu-dir as qemu-xen-traditional-dir"
Revert "Move the ioemu-dir-find shell script to an external file"

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-09-14 11:38:13 +01:00
Ian Jackson bcbf8c5464 tools: fix permissions of git-checkout.sh
23828:0d21b68f528b introduced a new scripts/git-checkout.sh, but it
had the wrong permissions.  chmod +x it, and add a blank line at the
end to make sure it actually gets updated.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-09-13 14:52:22 +01:00
Ian Jackson 423df429f7 Merge 2011-08-30 11:46:58 +01:00
Ian Jackson 6067ef23ef Revert 23733:fbf3768e5934 "AMD IOMMU: remove global ..."
23733:fbf3768e5934 causes xen-unstable not to boot on several of the
xen.org AMD test systems.  We get an endless series of these:

  (XEN) AMD-Vi: IO_PAGE_FAULT: domain = 0, device id = 0x00a0, fault
  address = 0xfdf8f10144

I have constructed the attached patch which reverts c/s 23733
(adjusted for conflicts due to subsequent patches).  With this
reversion Xen once more boots on these machines.

23733 has been in the tree for some time now, causing this breakage,
and has already been fingered by the automatic bisector and discussed
on xen-devel as the cause of boot failures.  I think it is now time to
revert it pending a correct fix to the original problem.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-08-16 15:04:19 +01:00
Ian Jackson b406d93c61 Revert 23757:f5176c177b99 "xenstored: allow guests to reintroduce themselves"
This patch seems to have been applied by mistake, despite adverse
comments on the list and a lack of an appropriate ack.

Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-08-09 17:48:16 +01:00
Ian Jackson 643b106b40 libxl: do not use tap disk backend other than for raw and vhd
tap does not support qcow/qcow2; update disk_try_backend accordingly.

Break out the "backend not suitable for this format" message so it can
be reused.  Remove now-redundant reporting from
libxl_device_disk_local_attach and replace with abort().

Reported-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-07-08 18:35:24 +01:00
Ian Jackson a49c86dd62 libxl: fix incorrect return of ERROR_INVAL from disk_try_backend
disk_try_backend is supposed to return 0 or the disk backend format.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-07-07 12:35:05 +01:00
Ian Jackson bab1f0a2b0 libxl: sane disk backend selection and validation
Introduce a new function libxl__device_disk_set_backend which
does some sanity checks and determines which backend ought to be used.

If the caller specifies LIBXL_DISK_BACKEND_UNKNOWN (which has the
value 0), it tries PHY, TAP and QDISK in that order.  Otherwise it
tries only the specified value.

libxl__device_disk_set_backend (and its helper function
disk_try_backend) inherit the role (and small amounts of the code)
from validate_virtual_disk.  This is called during do_domain_create
and also from libxl_disk_device_add (for the benefit of hotplug
devices).

It also now takes over the role of the scattered fragments of backend
selection found in libxl_device_disk_add,
libxl_device_disk_local_attach and libxl__need_xenpv_qemu.  These
latter functions now simply do the job for the backend they find has
already been specified and checked.

The restrictions on the capabilities of each backend, as expressed in
disk_try_backend (and to an extent in libxl_device_disk_local_attach)
are intended to be identical to the previous arrangements.

In 23618:3173b68c8a94 combined with 23622:160f7f39841b,
23623:c7180c353eb2, "xl" effectively became much more likely to select
TAP as the backend.  With this change to libxl the default backend
selected by the libxl__device_disk_set_backend is intended to once
again to be PHY where possible.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>
2011-07-06 18:26:49 +01:00
Ian Jackson 163a741ea3 QEMU_TAG update 2011-06-28 14:01:53 +01:00
Ian Jackson 30a8a75228 xl: new "check-xl-disk-parse" test script for disk parser
This runs "xl -N block-attach 0 <some strings>" for various sets of
strings and checks that the output is as expected.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-28 12:19:17 +01:00
Ian Jackson 6ec8890dfc xl: xl block-attach -N (dry run) option
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-28 12:19:17 +01:00
Ian Jackson f4948ef9b8 xl: implement -N (dry run) global option for create and cpupool-create
These subcommands already had "-n" dry run options.  Make -N do the
same thing, and deprecate those -n options.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-28 12:19:16 +01:00
Ian Jackson 4369b25867 xl: new global -N option for dry run
This sets a global dryrun_only variable, which individual commands are
expected to honour.  To avoid accidents, we introduce a new can_dryrun
member in the command table, which is initially set to 0 for each
command.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-28 12:19:15 +01:00
Ian Jackson 74f917afa3 libxl: disks: allow specification of "backendtype=phy|tap|qdisk"
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-28 12:19:15 +01:00
Ian Jackson d072c6003b xl: disks: replace block-attach disk config parser with call to xlu_parse_disk
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-28 12:19:14 +01:00
Ian Jackson d7148ecfb2 xl: disks: replace config file disk spec parser with call to xlu_disk_parse
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-28 12:19:13 +01:00
Ian Jackson e1b72a3b74 docs: update xl-disk-configuration.txt to describe new syntax
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-28 12:19:13 +01:00
Ian Jackson f7e6e74307 libxl: disks: commit libxlu_disk_l.[ch] flex output
Commit the flex output into revision control, for the benefit of those
without flex or with only very old flex.  This change is split into a
separate patch for ease of review.  Generated with flex 2.5.35-6 on
Debian lenny i386, by running "make" in the libxl directory.  No
manual changes in this commit.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-28 12:19:12 +01:00
Ian Jackson 5c206536ad libxl: disks: new xlu_disk_parse function
Introduce new flex/regexp-based parser for disk configuration strings.
Callers will be updated in following patches.

The existing xm command line syntax for block-attach expects multiple
arguments containing different parameters for different parts of the
disk specification, so we supply a parser function which can take
multiple strings and scan them in sequence.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-28 12:19:11 +01:00
Ian Jackson eaed6ac850 libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work
libxl callers should not be required to specify the backend if they
don't want to.  So LIBXL_DISK_BACKEND_UNKNOWN should instruct libxl to
choose the backend for itself.

For now, we do this by simply treating it the same as BACKEND_TAP,
which itself falls back to other methods.

More thorough fixes for the disk handling will follow.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-28 12:19:10 +01:00
Ian Jackson 3f7bdba934 Merge 2011-06-23 18:34:55 +01:00
Ian Jackson 9c1ebbba30 libxl: remove and hgignore testenum.c
This is an output file from the test idl generator and should not have
been committed.

Reported-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-06-22 14:43:53 +01:00
Ian Jackson e93ad8b732 QEMU_TAG update 2011-06-21 18:28:53 +01:00
Ian Jackson 4bf3ca7bdb tools/hotplug: Fix hotplug hook script arrangements not to always fail
The new feature introduced in 23401:a44b12ee2fd3 was broken; it in
general always fails, at least if there are no hotplug scripts.

If there are no hooks, call_hooks ends up running this:
  [ -x ".....*.hook" ] && . "..... *.hook"

This does not directly trigger set -e and sigerr.  However, it is the
last command exected in call_hooks.  So the return status of
call_hooks is an error, and thus a sigerr happens when call_hooks
returns.

The bug affects xl and xm.  However xl does not detect failure of the
hotplug script.

Change the script to use if...then rather than &&, as the latter has
very confusing and undesirable semantics.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-06-03 15:04:30 +01:00
Ian Jackson 46051f0c1c libxl: disks: rename disk param "unpluggable" to "removable"
This property corresponds to what is called "removable" in xenstore,
and is the conventional meaning of "removable": ie, the _media_ can be
removed even as the _device_ remains present.

"unpluggable" is a misleading name for this.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-02 18:46:35 +01:00
Ian Jackson 3c54832f67 libxl: disks: expose new "script" parameter for external block scripts
This is not currently implemented.  Applications setting it to
anything but NULL will cause an error.  Code to set it from xl
configuration files will appear later in this series.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-02 18:46:34 +01:00
Ian Jackson f1c76c0160 libxl: make libxl_ctx_free tolerate NULL ctx argument
This is purely for convenience (eg, when debugging).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-02 18:46:33 +01:00
Ian Jackson d72ede734d libxl: provide TOSTRING in libxl_internal.h and libxlu_internal.h
Provide a copy of the standard TOSTRING macro in libxlu_internal.h,
for the benefit of patches later in this series.

Also, move TOSTRING to libxl_internal.h from a .c file for the
benefit of future other callers in libxl proper.

(These cannot be combined because libxlu cannot include
libxl_internal.h and libxl should not include libxlu_internal.h.)

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-02 18:46:32 +01:00
Ian Jackson dc7f5bd00c libxl: add missing copyright notices to autogenerated files
Copyright notices in libxlu_cfg_[ly].[ly] end up in the .[ch] files,
copied there by flex and bison.  Regenerate those files (flex 2.5.35
and bison 2.3, from Debian lenny i386).

No manual edits in this patch.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-02 18:46:32 +01:00
Ian Jackson d32e1379d6 libxl: add missing copyright notices to some files
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2011-06-02 18:46:31 +01:00
Ian Jackson ba387827ce Merge 2011-05-26 15:08:44 +01:00
Ian Jackson 6b9ac99653 libxl: add missing ":" in log messages
libxl__logv would fail to put a ":" between the function name and the
rest of the message.

Reported-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-05-26 14:35:39 +01:00
Ian Jackson 142cbfcc6d libxl: Fix apic/acpi confusion
"apic" was written a couple of times where "acpi" was meant.

Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-05-17 17:28:12 +01:00
Ian Jackson 778d29bc95 libxc: [CVE-2011-1583] pv kernel image validation
The functions which interpret the kernel image supplied for a
paravirtualised guest, and decompress it into memory when booting the
domain, are incautious.  Specifically:

 (i) Integer overflow in the decompression loop memory allocator might
    result in overrunning the buffer used for the decompressed image;
 (ii) Integer overflows and lack of checking of certain length fields
    can result in the loader reading its own address space beyond the
    size of the supplied kernel image file.
 (iii) Lack of error checking in the decompression loop can lead to an
    infinite loop.

This patch fixes these problems.

CVE-2011-1583.

Signed-off-by: Ian Campbell <Ian.Campbell@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-05-09 15:00:57 +01:00
Ian Jackson 8afc46b70c libxl: add CODING_STYLE
libxenlight and xl grew enough to need a CODING_STYLE, that I blatantly
copied from qemu and linux, just adding few specific modifications.
The result should be as less controversial as possible, mostly
documenting what we are already doing.

[ Message and document originally posted to xen-devel on 2010-09-01 ]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-04-04 14:54:46 +01:00
Ian Jackson bb25b4b913 tools: blktap2: copy xenstore/hashtable.h into blktap2 (really)
hg add the missing files from 23112:e15ca5c3effc
2011-03-31 18:16:34 +01:00
Ian Jackson 350fbe91b9 libxl: export libxl_utils.h
libxl_utils.h is the header for libxlu.{so,a} and should have been
exported for the benefit of libxl callers.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Jim Fehlig <jfehlig@novell.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-31 18:15:35 +01:00
Ian Jackson 86f1eae2bc tools: add missing libxl_uuid.c
This should have been added in 23087:d9faf0aa9755.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-23 17:07:11 +00:00