]> xenbits.xensource.com Git - xen.git/log
xen.git
12 years agolibxl: child processes cleanups
Ian Jackson [Fri, 11 May 2012 17:59:06 +0000 (18:59 +0100)]
libxl: child processes cleanups

Abolish libxl_fork.  Its only callers were in xl.  Its functionality
is now moved elsewhere, as follows:

* The "logging version of fork", which is what it was billed as, is now
  xl_fork, which also dies on failure.

* Closing the xenstore handle in the child is now done in
  libxl__ev_child_fork, which is the only remaining place where fork
  is called in libxl.

* We provide a new function libxl__ev_child_xenstore_reopen for
  in-libxl children to make the ctx useable for xenstore again.

* Consequently libxl__spawn_record_pid now no longer needs to mess
  about with its own xenstore handle.  As a bonus it can now just use
  libxl__xs_write.

Also, since we have now converted all the forkers in libxl, we can
always honour the fork_replacement childproc hook - so do so.

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>
12 years agolibxl: clarify definition of "slow" operation
Ian Jackson [Fri, 11 May 2012 17:59:06 +0000 (18:59 +0100)]
libxl: clarify definition of "slow" operation

Update the comment in libxl_internal.h to be clearer about which
application-facing libxl operations need to take an ao_how.

Reported-by: Dan Magenheimer <dan.magenheimer@oracle.com>
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>
12 years agolibxl: convert console callback to libxl_asyncprogress_how
Ian Jackson [Fri, 11 May 2012 17:59:06 +0000 (18:59 +0100)]
libxl: convert console callback to libxl_asyncprogress_how

Remove the old console callback.  (Its reentrancy properties were
troublesome: in principle, the event loop might be reentered during
the callback, and the libxl__domain_create_state swept out from under
the feet of the domain creation.)

As a side effect of the new code arrangements, the console callback
for non-bootloader-using PV guests now occurs near the end of domain
creation, in the same place as for HVM guests, rather than near the
start.

The new arrangements should in principle mean that by the time the
console is described as ready by the callback, the xenstore key is
indeed ready.  So in the future the timeout might be removed from
the console client.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: remove malloc failure handling from NEW_EVENT
Ian Jackson [Fri, 11 May 2012 17:59:05 +0000 (18:59 +0100)]
libxl: remove malloc failure handling from NEW_EVENT

Change to use libxl__zalloc, where allocation failure is fatal.

Also remove a spurious semicolon from the helper macro.

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>
12 years agolibxl: provide progress reporting for long-running operations
Ian Jackson [Fri, 11 May 2012 17:59:05 +0000 (18:59 +0100)]
libxl: provide progress reporting for long-running operations

This will be used for reporting, during domain creation, that the
console is ready.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes since v7:
 * If aop->how.callback, actually add the aop to the for_callback list (!)
 * Document the threadsafety of aop's, and make appropriate cross-references.
 * Allocate the actual aop from its thread's egc; do not free it.
 * Remove pointless code motion of libxl__ao_create.
 * Minor formatting fixes.
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: Fix an ao completion bug; document locking policy
Ian Jackson [Fri, 11 May 2012 17:59:04 +0000 (18:59 +0100)]
libxl: Fix an ao completion bug; document locking policy

Document the concurrent access policies for libxl__ao and libxl__egc,
and their corresponding gcs.

Fix a violation of the policy:

If an ao was submitted and a callback requested, and while the
initiating function was still running on the original thread, the ao
is completed on another thread, the completing thread would improperly
concurrently access the ao with the initiating 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>
12 years agolibxl: make libxl_create run bootloader via callback
Ian Jackson [Fri, 11 May 2012 17:59:04 +0000 (18:59 +0100)]
libxl: make libxl_create run bootloader via callback

Change initiate_domain_create to properly use libxl__bootloader_run
rather than improperly calling libxl_run_bootloader with NULL ao_how.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes since v7:
 * constify convenience aliases.

Changes since v6:
 * Bugfixes from testing.
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: set guest_domid even if libxl__domain_make fails
Roger Pau Monne [Fri, 11 May 2012 17:59:03 +0000 (18:59 +0100)]
libxl: set guest_domid even if libxl__domain_make fails

This is needed in order to perform the domain destruction if
libxl__domain_make fails.

Also move doc comment about error behaviour of libxl__domain_make from
implementation to declaration.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: ao: convert libxl__spawn_*
Ian Jackson [Fri, 11 May 2012 17:59:03 +0000 (18:59 +0100)]
libxl: ao: convert libxl__spawn_*

libxl__spawn_spawn becomes a callback-style asynchronous function.
The implementation is now in terms of libxl__ev_* including
libxl_ev_child.

All the callers need to be updated.  This includes the device model
spawning functions libxl__create_device_model and
libxl__create_stubdom; these are replaced with libxl__spawn_local_dm
and libxl__spawn_stubdom.  libxl__confirm_device_model_startup is
abolished; instead the dm spawner calls back.

(The choice of which kind of device model to create is lifted out of
what used to be libxl__create_device_model, because that function was
indirectly recursive.  Recursive callback-style operations are clumsy
because they require a pointer indirection for the nested states.)

Waiting for proper device model startup it is no longer notionally
optional.  Previously the code appeared to tolerate this by passing
NULL for various libxl__spawner_starting* parameters to device model
spawners.  However, this was not used anywhere.

Conversely, the "for_spawn" parameter to libxl__wait_for_offspring is
no longer supported.  It remains as an unused formal parameter to
avoid updating, in this patch, all the call sites which pass NULL.
libxl__wait_for_offspring is in any case itself an obsolete function,
so this wrinkle will go away when its callers are updated to use the
event system.  Consequently libxl__spawn_check is also abolished.

The "console ready" callback also remains unchanged in this patch.
The API for this needs to be reviewed in the context of the event
series and its reentrancy restrictions documented.

Thus their callers need to be updated.  These are the domain creation
functions libxl_domain_create_new and _restore.  These functions now
take ao_hows, and have a private state structure.

However domain creation remains not completely converted to the event
mechanism; in particular it runs the outward-facing function
libxl_run_bootloader with a NULL ao_how, which is quite wrong.  As it
happens in the current code this is not a bug because none of the rest
of the functionality surrounding the bootloader call will mind if the
event loop is reentered in the middle of its execution.

The file-scope function libxl__set_fd_flag which was used by the
previous spawn arrangements becomes unused and is removed; other
places in libxl can use libxl_fd_set_nonblock and
libxl_fd_set_cloexec, which of course remain.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes since v8:
 * Make midproc_cb callback with correct pid (that of the grandchild,
   not "middle" which is zero).  Reported by Roger Pau Monne.

Changes since v7:
 * Rename libxl__spawn_stubdom to libxl__spawn_stub_dm (and ..._state);
   rename the state's stubdom_* members to dm_*.
 * Eliminate the union between the two dm creation states in
   libxl__domain_create_state.  Instead, the domain creation code
   simply uses libxl__stub_dm_spawn_state.dm directly, if we're
   taking the local dm path.
 * Remove a spurious "break".
 * In domain creation, move the PV non-qemu case into the switch.
 * Code style fixes.
 * Constify some convenience aliases.
 * Improve comments (including typo fixes).
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: change some structures to unit arrays
Ian Jackson [Fri, 11 May 2012 17:59:02 +0000 (18:59 +0100)]
libxl: change some structures to unit arrays

In the next patch these variables will turn into actual pointers.

To clarify that patch, prepare the ground by changing these variables
from "struct foo var" to "struct foo var[1]".  This enables accesses
to them and their members to be made as if they were pointers.

No functional change.

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>
12 years agolibxl: remove ctx->waitpid_instead
Ian Jackson [Fri, 11 May 2012 17:59:02 +0000 (18:59 +0100)]
libxl: remove ctx->waitpid_instead

Remove this obsolete hook.  Callers inside libxl which create and reap
children should use the mechanisms provided by the event system.

(This has no functional difference since there is no way for
ctx->waitpid_instead ever to become set.)

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>
12 years agolibxl: add a dummy ao_how to libxl_domain_core_dump
Ian Campbell [Fri, 11 May 2012 17:59:02 +0000 (18:59 +0100)]
libxl: add a dummy ao_how to libxl_domain_core_dump

Although this function is not currently slow it may become so in the
future (this also depends somewhat on the size of the guest).
Therefore arrange for it to take an ao_how which it completes
immediately.  This will allow us to make it asynchronous in the future
without breaking API compatibility.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: Allow AO_GC and EGC_GC even if not used
Ian Jackson [Fri, 11 May 2012 17:59:01 +0000 (18:59 +0100)]
libxl: Allow AO_GC and EGC_GC even if not used

Mark the gc produced by AO_GC and EGC_GC with the gcc feature
__attribute__((unused)).  This allows the use of EGC_INIT and
STATE_AO_GC by functions which do actually use the gc.

This is convenient because those functions might want to use the ao or
egc, rather than the gc; and also because it means that functions
which morally ought to be fishing any gc they use out of an egc or
state structure can be written do so regardless of whether the gc is
actually used right then.

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>
12 years agolibxl: log bootloader output
Ian Jackson [Fri, 11 May 2012 17:59:01 +0000 (18:59 +0100)]
libxl: log bootloader output

This involves adding a new log feature to libxl__datacopier, and then
using it.

If the bootloader exits nonzero we print the log filename in a log
message from libxl.

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>
12 years agolibxl: make libxl_create_logfile const-correct
Ian Jackson [Fri, 11 May 2012 17:59:00 +0000 (18:59 +0100)]
libxl: make libxl_create_logfile 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>
12 years agolibxl: ao: Convert libxl_run_bootloader
Ian Jackson [Fri, 11 May 2012 17:59:00 +0000 (18:59 +0100)]
libxl: ao: Convert libxl_run_bootloader

Convert libxl_run_bootloader to an ao_how-taking function.

It's implemented in terms of libxl__bootloader_run, which can be used
internally.  The resulting code is pretty much a rewrite.

Significant changes include:

- We direct the bootloader's results to a file, not a pipe.  This
  makes it simpler to deal with as we don't have to read it
  concurrently along with everything else.

- We now issue a warning if we find unexpected statements in the
  bootloader results.

- The arrangements for buffering of bootloader input and output
  are completely changed.  Now we have a fixed limit of 64k
  on output, and 4k on input, and discard the oldest data when
  this overflows (which it shouldn't).  There is no timeout
  any more.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes since v6:
 * Use libxl__ev_child_inuse rather than testing pid directly.
 * Fix a code style error.
 * Properly initialise the sub-operations' aos in _init.
 * Bugfixes.
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: provide libxl__openpty_*
Ian Jackson [Fri, 11 May 2012 17:58:59 +0000 (18:58 +0100)]
libxl: provide libxl__openpty_*

General facility for ao operations to open ptys.

This will be used by the bootloader machinery.

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>
12 years agolibxl: provide libxl__datacopier_*
Ian Jackson [Fri, 11 May 2012 17:58:59 +0000 (18:58 +0100)]
libxl: provide libxl__datacopier_*

General facility for ao operations to shovel data between fds.

This will be used by the bootloader machinery.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes in v7:
 * assert that the ao is non-null on _init.
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: Clean up setdefault in do_domain_create
Ian Jackson [Fri, 11 May 2012 17:58:58 +0000 (18:58 +0100)]
libxl: Clean up setdefault in do_domain_create

do_domain_create called libxl__domain_create_info_setdefault twice.

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>
12 years agolibxl: Introduce libxl__sendmsg_fds and libxl__recvmsg_fds
Ian Jackson [Fri, 11 May 2012 17:58:58 +0000 (18:58 +0100)]
libxl: Introduce libxl__sendmsg_fds and libxl__recvmsg_fds

Provide functions for sending and receiving fds.

There used to be fd-sending functionality in libxl_qmp.c before
25298:84ae90427c54, which this implementation is partially derived
from.

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>
12 years agolibxl: provide libxl__remove_file et al.
Ian Jackson [Fri, 11 May 2012 17:58:58 +0000 (18:58 +0100)]
libxl: provide libxl__remove_file et al.

These utility functions cope with EINTR AND ENOENT, do error logging,
and we provide a recursive version to delete whole directory trees.

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>
12 years agoautoconf: New test for openpty et al.
Ian Jackson [Fri, 11 May 2012 17:58:57 +0000 (18:58 +0100)]
autoconf: New test for openpty et al.

We may need to #include <libutil.h>, and/or link with -lutil, to use
openpty, login_tty, and the like.  Provide INCLUDE_LIBUTIL_H
(preprocessor constant, not always defined) and PTYFUNCS_LIBS
(makefile variable).

We link libxl against PTYFUNCS_LIBS (which comes from autoconf) rather
than UTIL_LIBS, and #include <libutil.h> where appropriate.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes since v7:
 * Actually include the call to AX_CHECK_PTYFUNCS in this patch,
   not the previous one, and regenerate configure accordingly.

Changes since v6:
 * Put failure macro call in correct place so it might actually happen.
 * Try both with -lutil and without.
 * Patch now contains update for config.h.in.
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agoautoconf: trim the configure script; use autoheader
Ian Jackson [Fri, 11 May 2012 17:58:57 +0000 (18:58 +0100)]
autoconf: trim the configure script; use autoheader

Remove a lot of unnecessary tests.  Specifically, we no longer test
for standard POSIX facilities which we expect to be provided
everywhere and which we don't in any case have any alternative for.

Switch to generating config.h.in with autoheader.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Roger Pau Monne <roger.pau@entel.upc.edu>
Changes since v7:
 * Removed AX_CHECK_PTYFUNCS (snuck in from previous patch)
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agoof SIGCHLD. The application can tell us whether it wants to own
Ian Jackson [Fri, 11 May 2012 17:58:56 +0000 (18:58 +0100)]
of SIGCHLD.  The application can tell us whether it wants to own
SIGCHLD or not; if it does, it has to tell us about deaths of our
children.

Currently there are no callers in libxl which use these facilities.
All code in libxl which forks needs to be converted and libxl_fork
needse to be be abolished.

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>
12 years agolibxl: support multiple libxl__ev_fds for the same fd
Ian Jackson [Fri, 11 May 2012 17:58:55 +0000 (18:58 +0100)]
libxl: support multiple libxl__ev_fds for the same fd

We need a slightly more sophisticated data structure to allow this,
where we record the slot not just for each fd but also for each
(fd,eventbit) where eventbit is POLLIN, POLLPRI, POLLOUT.

Document the new relaxed restriction.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes since v6:
 * Fix typo
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: handle POLLERR, POLLHUP, POLLNVAL properly
Ian Jackson [Fri, 11 May 2012 17:58:55 +0000 (18:58 +0100)]
libxl: handle POLLERR, POLLHUP, POLLNVAL properly

Pass POLLERR and POLLHUP to fd callbacks, as is necessary.
Crash on POLLNVAL since that means our fds are messed up.

Document the behaviour (including the fact that poll sometimes sets
POLLHUP or POLLERR even if only POLLIN was requested.

Fix the one current fd callback to do something with POLLERR|POLLHUP.

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>
12 years agoblktap2: Fix naked unchecked uses of read/write/chdir.
Keir Fraser [Fri, 11 May 2012 17:30:29 +0000 (18:30 +0100)]
blktap2: Fix naked unchecked uses of read/write/chdir.

These cause warnings under warn_unused_result, and for read/write we
ought to deal with partial io results.

Signed-off-by: Keir Fraser <keir@xen.org>
12 years agolibxl_qmp: remove libxl__qmp_migrate, introduce libxl__qmp_save
Stefano Stabellini [Fri, 11 May 2012 16:46:16 +0000 (17:46 +0100)]
libxl_qmp: remove libxl__qmp_migrate, introduce libxl__qmp_save

Following the recent changes to upstream Qemu, the best monitor command
to suit or needs is "xen-save-devices-state" rather than "migrate".
This patch removes libxl__qmp_migrate and introduces libxl__qmp_save
instead, that uses "xen-save-devices-state".

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agolibxl: save/restore qemu's physmap
Stefano Stabellini [Fri, 11 May 2012 16:46:15 +0000 (17:46 +0100)]
libxl: save/restore qemu's physmap

Read Qemu's physmap from xenstore and save it using toolstack_save.
Restore Qemu's physmap using toolstack_restore.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agolibxc: introduce XC_SAVE_ID_TOOLSTACK
Stefano Stabellini [Fri, 11 May 2012 16:46:15 +0000 (17:46 +0100)]
libxc: introduce XC_SAVE_ID_TOOLSTACK

Introduce a new save_id to save/restore toolstack specific extra
information.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agoxl: Call xlu_cfg_destroy in main_cpupoolcreate
George Dunlap [Fri, 11 May 2012 16:34:24 +0000 (17:34 +0100)]
xl: Call xlu_cfg_destroy in main_cpupoolcreate

This involves making a goto clean-up path, rather than calling
return directly.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agoxl: Call xlu_cfg_destroy in the pciattach and pcidetach
George Dunlap [Fri, 11 May 2012 16:34:23 +0000 (17:34 +0100)]
xl: Call xlu_cfg_destroy in the pciattach and pcidetach

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agoxl: Replace memset with libxl_device_pci_init
George Dunlap [Fri, 11 May 2012 16:34:23 +0000 (17:34 +0100)]
xl: Replace memset with libxl_device_pci_init

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agoxl: use libxl_cpumap_set_none not memset
Ian Campbell [Fri, 11 May 2012 11:20:43 +0000 (12:20 +0100)]
xl: use libxl_cpumap_set_none not memset

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agolibxl: default to xenconsoled for pv guests
Ian Campbell [Fri, 11 May 2012 14:52:52 +0000 (15:52 +0100)]
libxl: default to xenconsoled for pv guests

Default to xenconsoled for pv guests, even if qemu is running.

Currently we prefer to use qemu for the disk backend if we are starting qemu
anyway (e.g. to service a disk).

Unfortunately qemu doesn't log the console, which xenconsoled can do via
XENCONSOLED_TRACE=guest. Since xenconsoled is also running anyway it seems like
there is no particular reason to prefer qemu just because it happens to be
running.

However we must use qemu if thereis more than one console (xenconsoled only
supports a single console).

Therefore push the logic to change the console backend down into
libxl__need_xenpv_qemu so that it can do the right thing.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl/xend: name tap devices vifX.Y-emu
Ian Campbell [Wed, 25 Apr 2012 11:55:57 +0000 (12:55 +0100)]
libxl/xend: name tap devices vifX.Y-emu

This prevents the udev scripts from operating on other tap devices (e.g.
openvpn etc)

Correct the documentation for the "vifname" option which suggested it applied
to HVM tap devices only, which is not the case.

Reported by Michael Young.

Also fix the use of vifname with emulated devices. This is slightly complex.
The current hotplug scripts rely on being able to parse the "tapX.Y" (now
"vifX.Y-emu") name in order to locate the xenstore backend dir relating to the
corresponding vif. This is because we cannot inject our own environment vars
into the tap hotplug events. However this means that if the tap is initially
named with a user specified name (which will not match the expected scheme) we
fail to do anything useful with the device. So now we create the initial tap
device with the standard "vifX.Y-emu" name and the hotplug script will handle
the rename to the desired name. This is also how PV vif devices work -- they
are always created by netback with the name vifX.Y and renamed in the script.

Lastly also move libxl__device_* to a better place in the header, otherwise the
comment about evgen stuff isn't next to the associated functions (noticed jsut
because I was going to add nic_devname near to the setdefault functions)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agoQEMU_TAG update
Ian Jackson [Fri, 11 May 2012 11:42:57 +0000 (12:42 +0100)]
QEMU_TAG update

12 years agolibxl: use xc_topologyinfo to figure out how many CPUs we actually have
Darrio Faggioli [Fri, 11 May 2012 11:39:43 +0000 (12:39 +0100)]
libxl: use xc_topologyinfo to figure out how many CPUs we actually have

Within libxl_get_cpu_topology(), considering all the CPUs the hypervisor
supports to be valid topology entries might lead to misleading and incorrect
behaviours, e.g., the output of `xl info -n' below on a 16 cores machine:
...
cpu_topology           :
cpu:    core    socket     node
  0:       0        1        0
  1:       0        1        0
  2:       1        1        0
  3:       1        1        0
  4:       9        1        0
  5:       9        1        0
  6:      10        1        0
  7:      10        1        0
  8:       0        0        1
  9:       0        0        1
 10:       1        0        1
 11:       1        0        1
 12:       9        0        1
 13:       9        0        1
 14:      10        0        1
 15:      10        0        1
 16:       0        0        0
 17:       0        0        0
 18:       0        0        0
 19:       0        0        0
 20:       0        0        0
 ...
 ...
 62:       0        0        0
 63:       0        0        0

However, xc_topologyinfo() tells us (in max_cpu_index) how many entries
arrays it returns corresponds to actually valid CPUs, so let's use that
information.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agodocs: add vpmu description to xen-command-line.markdown
Dietmar Hahn [Fri, 27 Apr 2012 09:09:26 +0000 (11:09 +0200)]
docs: add vpmu description to xen-command-line.markdown

Add a short description to the vpmu boot option in the
xen-command-line.markdown

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
13 years agolibxl: fix indentation in libxl_dm.c for qemu
Roger Pau Monne [Thu, 10 May 2012 16:33:59 +0000 (17:33 +0100)]
libxl: fix indentation in libxl_dm.c for qemu

Fixed indentation on Qemu argument construction for network devices.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: add "downscript=no" to Qemu call
Roger Pau Monne [Thu, 10 May 2012 16:33:58 +0000 (17:33 +0100)]
libxl: add "downscript=no" to Qemu call

Currently we only pass script=no to Qemu, to avoid calling any scripts when
attaching a tap interface, but we should also pass downscript=no to avoid Qemu
trying to execute a script when disconnecting the interface. This prevents the
following harmless error message:

/etc/qemu-ifdown: could not launch network script

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agotools/vtpm: use LDLIBS to pass -lgmp
Olaf Hering [Fri, 4 May 2012 17:43:25 +0000 (19:43 +0200)]
tools/vtpm: use LDLIBS to pass -lgmp

Linking tpmd will fail with recent toolchains because -lgmp is passed
via LDFLAGS instead of LDLIBS. With this change -lgpm is placed at the
end of the gcc cmdline and linking tpmd succeeds again.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agotools/hotplug: remove 4 from default runlevel in init scripts
Olaf Hering [Fri, 4 May 2012 17:38:02 +0000 (19:38 +0200)]
tools/hotplug: remove 4 from default runlevel in init scripts

Remove 4 from default runlevel in xen-watchdog, xend and xendomains.

Similar to what changeset 24847:0900b1c905f1 does in xencommons, remove
runlevel 4 from the other runlevel scripts. LSB defines runlevel 4 as
reserved for local use, the local sysadmin is responsible for symlink
creation in rc4.d.

Runlevel 4 was specified in Default-Start since a very long time. Then
it was copied also to the new xen-watchdog in 21861:fb3649141e19. Until
now this was not an issue since only xencommons is automatically enabled
during package install, and a custom xend and xendomains script is
included in the SuSE packages. Since some time a rpmlint check complains
about the wrong Default-Start entry in xen-watchdog.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agotools/vtpm_manager: add missing DESTDIR to install rule
Olaf Hering [Fri, 4 May 2012 15:40:40 +0000 (17:40 +0200)]
tools/vtpm_manager: add missing DESTDIR to install rule

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agoblktap2: Fix another uninitialised value error
Ian Jackson [Thu, 10 May 2012 13:26:14 +0000 (14:26 +0100)]
blktap2: Fix another uninitialised value error

gcc  -O1 -fno-omit-frame-pointer -m32 -march=i686 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement   -D__XEN_TOOLS__ -MMD -MF .block-remus.o.d -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -mno-tls-direct-seg-refs -Werror -g -Wno-unused -fno-strict-aliasing -I../include -I../drivers -I/home/osstest/build.12828.build-i386/xen-unstable/tools/blktap2/drivers/../../../tools/libxc -I/home/osstest/build.12828.build-i386/xen-unstable/tools/blktap2/drivers/../../../tools/include -D_GNU_SOURCE -DUSE_NFS_LOCKS  -c -o block-remus.o block-remus.c

block-remus.c: In function 'ramdisk_flush':
block-remus.c:508: error: 'buf' may be used uninitialized in this function
make[5]: *** [block-remus.o] Error 1

This is because gcc can see that merge_requests doesn't always set
*mergedbuf but gcc isn't able to prove that it always does so if
merge_requests returns 0 and that in that case the value of
ramdisk_flush::buf isn't used.

This is too useful a warning to disable, despite the occasional false
positive of this form.  The conventional approach is to suppress the
warning by explicitly initialising the variable to 0.

This has just come to light because 25275:27d63b9f111a reenabled
optimisation for this area of code, and gcc's data flow analysis
(which is required to trigger the uninitialised variable warning) only
occurs when optimisation is turned on.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agoMAINTAINERS: add Ian Campbell as a tools maintainer
Ian Campbell [Thu, 10 May 2012 11:19:16 +0000 (12:19 +0100)]
MAINTAINERS: add Ian Campbell as a tools maintainer

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: log failure from libxl__blktap_devpath in libxl_device_disk_add
Ian Campbell [Tue, 8 May 2012 13:24:31 +0000 (14:24 +0100)]
libxl: log failure from libxl__blktap_devpath in libxl_device_disk_add

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: Fix incorrect return of OSEVENT_HOOK macro
Daniel De Graaf [Thu, 10 May 2012 11:19:15 +0000 (12:19 +0100)]
libxl: Fix incorrect return of OSEVENT_HOOK macro

The OSEVENT_HOOK_INTERN macro incorrectly returned the value of the
expression CTX->osevent_in_hook-- (usually 1) instead of the value of
the function call it made. Fix the macro to return the proper value.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxl/libxl_event.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

13 years agoxl: xl.cfg: fix typo in opengl section
Olaf Hering [Mon, 7 May 2012 15:54:08 +0000 (17:54 +0200)]
xl: xl.cfg: fix typo in opengl section

Add missing i to qemu-xen-traditonal

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
13 years agoRemove bool return code from evtchn_set_pending() and callers.
Keir Fraser [Thu, 10 May 2012 10:58:33 +0000 (11:58 +0100)]
Remove bool return code from evtchn_set_pending() and callers.

Signed-off-by: Keir Fraser <keir@xen.org>
13 years agoblktap2: Do not build with -O0
Keir Fraser [Thu, 10 May 2012 10:22:18 +0000 (11:22 +0100)]
blktap2: Do not build with -O0

Signed-off-by: Keir Fraser <keir@xen.org>
13 years agoblktap2: Fix uninitialised value error.
Keir Fraser [Thu, 10 May 2012 10:21:59 +0000 (11:21 +0100)]
blktap2: Fix uninitialised value error.

Signed-off-by: Keir Fraser <keir@xen.org>
13 years agotools/blktap2: fix out of bounds access in block-log.c
Olaf Hering [Thu, 10 May 2012 10:20:04 +0000 (11:20 +0100)]
tools/blktap2: fix out of bounds access in block-log.c

block-log.c: In function 'ctl_close_sock':
block-log.c:363:23: warning: array subscript is above array bounds
[-Warray-bounds]

Adjust loop condition in ctl_close_sock() to fix warning.
Adjust array acccess in ctl_close() to actually access the array
member.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agotools/blktap2: fix build errors caused by Werror in
Olaf Hering [Thu, 10 May 2012 10:19:05 +0000 (11:19 +0100)]
tools/blktap2: fix build errors caused by Werror in
vhd_journal_write_entry

-O2 -Wall -Werror triggers these warnings:

libvhd-journal.c: In function 'vhd_journal_write_entry':
libvhd-journal.c:335: warning: statement with no effect

Really return the error from vhd_journal_write() to caller.

v2:
 - simplify the patch by just adding the missing return statement

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Keir Fraser <keir@xen.org>
13 years agox86_64: Fix off-by-one error setting up the Interrupt Stack Tables
Andrew Cooper [Thu, 10 May 2012 10:04:32 +0000 (11:04 +0100)]
x86_64: Fix off-by-one error setting up the Interrupt Stack Tables

The Interrupt Stack Table entries in a 64bit TSS are a 1 based data
structure as far as hardware is concerned.  As a result, the code
setting up stacks in subarch_percpu_traps_init() fills in the wrong
IST entries.

The result is that the MCE handler executes on the stack set up for
NMIs; the NMI handler executes on a stack set up for Double Faults,
and Double Faults are executed with a stack pointer set to 0.

Once the #DF handler starts to execute, it will usually take a page
fault looking up the address at 0xfffffffffffffff8, which will cause a
triple fault.  If a guest has mapped a page in that location, then it
will have some state overwritten, but as the #DF handler always calls
panic(), this is not a problem the guest will have time to care about.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agox86_64: fix naming of rflags in elf regset structure
Andrew Cooper [Thu, 10 May 2012 10:02:54 +0000 (11:02 +0100)]
x86_64: fix naming of rflags in elf regset structure

'pushfq' pushes rflags, not eflags.  Fix up naming of the structure.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agofix vmce MCi_ADDR/MCi_MISC wrmsr bug
Liu, Jinsong [Tue, 8 May 2012 11:36:24 +0000 (13:36 +0200)]
fix vmce MCi_ADDR/MCi_MISC wrmsr bug

This patch fixes a bug related to wrmsr vmce MCi_ADDR/MCi_MISC
registers, since they are not read-only.

Intel SDM recommanded os mce driver clear MCi_ADDR/MCi_MISC, so guest
MCE driver may clear MCi_ADDR/MCi_MISC registers. In such case, old
vmce wrmsr logic would generate a #GP fault in guest MCE context,
causing the guest to crash.

When wrmsr MCi_ADDR/MCi_MISC, writing all 1s will cause #GP.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
13 years agons16550: adjust suspend/resume logic
Jan Beulich [Tue, 8 May 2012 11:34:14 +0000 (13:34 +0200)]
ns16550: adjust suspend/resume logic

- no need to read BAR during suspend
- command register is 16-bits rather than 32
- BAR and command register must be restored before trying to access
  the device
- use ps_bdf[] for storing the device coordinates (pb_bdf[] is used to
  store the bridge's ones)

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agox86: merge .text.* into .text while linking
Jan Beulich [Tue, 8 May 2012 11:33:16 +0000 (13:33 +0200)]
x86: merge .text.* into .text while linking

For xen.efi, this eliminates a pointless gap between .text and
.text.unlikely of almost 2Mb size.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agovgabios: Make Windows 8 support greater resolutions
Frediano Ziglio [Mon, 7 May 2012 12:39:27 +0000 (13:39 +0100)]
vgabios: Make Windows 8 support greater resolutions

Apparently Windows 8 refuse to use any mode if has more than one page.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agovgabios: Check if mode is currently supported as vesa specifications
Frediano Ziglio [Mon, 7 May 2012 12:38:57 +0000 (13:38 +0100)]
vgabios: Check if mode is currently supported as vesa specifications

Vesa specification require that mode information return if a given
mode is supported or not so test if we can support it checking
required memory and set correctly supported bit.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agovgabios: Reduce stack usage getting mode informations
Frediano Ziglio [Mon, 7 May 2012 12:38:23 +0000 (13:38 +0100)]
vgabios: Reduce stack usage getting mode informations

Informations are stored in a structure that is smaller than final one.
Previous code copy this structure to stack extending with zeroes then
update it and copy to caller while now the not-extended version is
copied into stack and then is extended during copy reducing stack
usage.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agovgabios: Report mode not supported getting mode informations
Frediano Ziglio [Mon, 7 May 2012 12:37:47 +0000 (13:37 +0100)]
vgabios: Report mode not supported getting mode informations

If you try to get mode information for an unsupported mode
interrupt should return error but not that the function is not
supported.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agovgabios: Fix size computation overflow
Frediano Ziglio [Mon, 7 May 2012 12:37:10 +0000 (13:37 +0100)]
vgabios: Fix size computation overflow

Remove an overflow computing width x height x bit which does
not fit into a 16 bits. I wrote a routine to multiple these value
and get the size required for framebuffer in segment unit (64k).

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agokexec: clear notes during setup
Andrew Cooper [Mon, 7 May 2012 12:32:28 +0000 (13:32 +0100)]
kexec: clear notes during setup

Explicity zero the memory backing the crash notes during setup.

This allows the crash environment to be rather more certain whether
the crash notes were actually written, rather than trusting that the
memory was clear beforehand.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agox86/MSI: remove stray endianness definition
Jan Beulich [Mon, 7 May 2012 08:13:15 +0000 (10:13 +0200)]
x86/MSI: remove stray endianness definition

... as it conflicts with the one made in asm/byteorder.h, and hence
build fails when both happen to be included from the same source file.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agotools/vtpm: Revert 25142:c5b7d49ca3ee (LDLIBS)
Ian Jackson [Fri, 4 May 2012 10:18:48 +0000 (11:18 +0100)]
tools/vtpm: Revert 25142:c5b7d49ca3ee (LDLIBS)

25142:c5b7d49ca3ee is broken; it edits the patch context.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agox86/mm: Eliminate _shadow_mode_refcounts
Andres Lagar-Cavilla [Thu, 3 May 2012 16:21:09 +0000 (17:21 +0100)]
x86/mm: Eliminate _shadow_mode_refcounts

Replace its only useer with paging_mode_refcounts().

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agorombios: remove sdtint.h dependency
Roger Pau Monne [Tue, 1 May 2012 13:20:37 +0000 (14:20 +0100)]
rombios: remove sdtint.h dependency

Hardcode uint8_t, uint16_t and uint32_t typedefs, so we no longer need
stdint.h

Resolves problem reported by Wang Zhihao on 64bit Ubuntu systems.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agox86: Add FS and GS base to HVM VCPU context
Aravindh Puthiyaparambil [Fri, 27 Apr 2012 15:57:55 +0000 (17:57 +0200)]
x86: Add FS and GS base to HVM VCPU context

Add FS and GS base to the HVM VCPU context returned by
xc_vcpu_getcontext().

Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
13 years agox86/hvm: Add get_shadow_gs_base() wrapper function
Aravindh Puthiyaparambil [Fri, 27 Apr 2012 15:54:00 +0000 (17:54 +0200)]
x86/hvm: Add get_shadow_gs_base() wrapper function

Add a wrapper function to the HVM function table that returns the
shadow GS base.

Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
13 years agox86/mem_sharing: For shared pages with many references, use a hash table
Andres Lagar-Cavilla [Thu, 26 Apr 2012 09:03:08 +0000 (10:03 +0100)]
x86/mem_sharing: For shared pages with many references, use a hash table

For shared frames that have many references, the doubly-linked list used to
store the rmap results in costly scans during unshare operations. To alleviate
the overhead, replace the linked list by a hash table. However, hash tables are
space-intensive, so only use them for pages that have "many" (arbitrary
threshold) references.

Unsharing is heaviliy exercised during domain destroy. In experimental testing,
for a domain that points over 100 thousand pages to the same shared frame,
domain destruction dropped from over 7 minutes(!) to less than two seconds.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agox86/mem_sharing: modularize reverse map for shared frames
Andres Lagar-Cavilla [Thu, 26 Apr 2012 09:03:08 +0000 (10:03 +0100)]
x86/mem_sharing: modularize reverse map for shared frames

Each shared frame maintains a reverse map of <domain, gfn> tuples, so we know
which tuples this shared frame is backing. This is useful for auditing and
sanity-checking, and necessary to update all relevant p2m entries when sharing.

The reverse map is maintained as a doubly linked list, but the interface is
open-coded throughout the mem_sharing.c subsystem. Bury it inside a level of
abstraction, so it can later support different (more scalable) rmap
implementations.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agox86/mem_sharing: Don't destroy a page's shared state before depleting its <gfn, domid...
Andres Lagar-Cavilla [Thu, 26 Apr 2012 09:03:08 +0000 (10:03 +0100)]
x86/mem_sharing: Don't destroy a page's shared state before depleting its <gfn, domid> tuple list

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agox86/mem_sharing: Fix saved mfns stat for failed unsharing
Andres Lagar-Cavilla [Thu, 26 Apr 2012 09:03:08 +0000 (10:03 +0100)]
x86/mem_sharing: Fix saved mfns stat for failed unsharing

If unsharing fails, the decrease of the nr_saved_mfns stat was not being
undone. This would result in an underflow of the stat, as the retry would later
decrease the counter again.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agox86/mm/shadow: don't use locking p2m lookups with the paging lock held.
Tim Deegan [Thu, 26 Apr 2012 09:03:08 +0000 (10:03 +0100)]
x86/mm/shadow: don't use locking p2m lookups with the paging lock held.

The existing interlock between shadow and p2m (where p2m table updates
are done under the paging lock) keeps us safe from the p2m changing
under our feet, and using the locking lookups is a violation of the
locking discipline (which says always to take the p2m lock first).

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agodocs: use "a4" not "a4wide" paper type for doxygen and latex
Ian Campbell [Wed, 25 Apr 2012 12:55:26 +0000 (13:55 +0100)]
docs: use "a4" not "a4wide" paper type for doxygen and latex

a4wide is no longer shipped in texlive.

Reported by Bastian Blank
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agovvmx: fix instruction decode segment limit check
Jan Beulich [Wed, 25 Apr 2012 12:54:36 +0000 (13:54 +0100)]
vvmx: fix instruction decode segment limit check

- no limit check for 64-bit mode (and GS: is not special in any way)
- limit check is needed in compatibility mode
- canonical address check should instead be performed for 64-bit mode
- the last accessed byte must be within limits, not the first byte
- past the accessed range
- segment base address should be ignored for 64-bit mode unless FS: or
  GS: is in use

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
13 years agosvm: Do not intercept RDTSC(P) when TSC scaling is supported by hardware
Boris Ostrovsky [Wed, 25 Apr 2012 12:53:14 +0000 (13:53 +0100)]
svm: Do not intercept RDTSC(P) when TSC scaling is supported by hardware

When running in TSC_MODE_ALWAYS_EMULATE mode on processors that
support TSC scaling we don't need to intercept RDTSC/RDTSCP
instructions.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Acked-by: Wei Huang <wei.huang2@amd.com>
Tested-by: Wei Huang <wei.huang2@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoMerge
Ian Jackson [Wed, 25 Apr 2012 11:00:08 +0000 (12:00 +0100)]
Merge

13 years agolibxl, configure: print a warning if flex/bison are needed
Roger Pau Monne [Wed, 25 Apr 2012 10:44:09 +0000 (11:44 +0100)]
libxl, configure: print a warning if flex/bison are needed

This patch adds better support for both Flex and Bison, which might
be needed to compile libxl. Now configure script sets BISON and FLEX
Makefile vars if bison and flex are found, but doesn't complain if
they are not found.

Also, added some Makefile soccery to print a warning message if
Bison or Flex are needed but not found.

[ Improved the warning message slightly. -iwj ]

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: set domain scheduling parameters while creating the domU
Dieter Bloms [Wed, 25 Apr 2012 10:38:26 +0000 (11:38 +0100)]
libxl: set domain scheduling parameters while creating the domU

the domain specific scheduling parameters like cpu_weight, cap, slice, ...
will be set during creating the domain, so this parameters can be defined
in the domain config file

[ Improved the documentation wording slightly. -iwj ]

Signed-off-by: Dieter Bloms <dieter@bloms.de>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agox86-64: Fix memory hotplug epfn upper limit test for updating the compat M2P table
Malcolm Crossley [Wed, 25 Apr 2012 10:35:56 +0000 (12:35 +0200)]
x86-64: Fix memory hotplug epfn upper limit test for updating the compat M2P table

The epfn is being compared to (RDWR_COMPAT_MPT_VIRT_END -
RDWR_COMPAT_MPT_VIRT_START) without a 2 bit shift, resulting in the
epfn being compared to the size of the RDWR_COMPAT_MPT table in bytes
instead of the maximum page frame number that the RDWR_COMPAT_MPT
table can map.

Signed-off-by: Malcolm Crossley <malcolm.crossley@citrix.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
13 years agolibxl: use libxl_domain_config_init and not memset 0
Ian Campbell [Wed, 25 Apr 2012 10:35:42 +0000 (11:35 +0100)]
libxl: use libxl_domain_config_init and not memset 0

I missed a couple of memsets in 25237:31489be80c51, we need to use
libxl_domain_config_init everywhere and not memset since not all fields are
initialised to zero now (the type field in particular). This fixes an abort
with "xl list <dom>" for a specific domain due to assert(type == -1) in
libxl_domain_build_info_init_type().

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agotools/firmware: pass PYTHON as an env var to sub-makes in this subtree
Christoph Egger [Wed, 25 Apr 2012 10:21:25 +0000 (11:21 +0100)]
tools/firmware: pass PYTHON as an env var to sub-makes in this subtree

This fixes the Seabios build on platforms where just "python" is not
correct, which includes NetBSD.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: passthrough: avoid passing through devices not owned by pciback
Xudong Hao [Wed, 25 Apr 2012 10:18:45 +0000 (11:18 +0100)]
libxl: passthrough: avoid passing through devices not owned by pciback

This patch makes sure the passthrough device belongs to pciback before
allow them passthrough to the guest.  There are still many other
checks missing.

xm terminates the guest startup process when this type of condition is
found.  This patch just allows the guest to continue to boot but with
no device passthrough.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
Signed-off-by: Xudong Hao <xudong.hao@intel.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxc: Document the sharing interface
Andres Lagar-Cavilla [Tue, 24 Apr 2012 18:06:42 +0000 (19:06 +0100)]
libxc: Document the sharing interface

(also make note about AMD support's experimental status)

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agox86/mem_sharing: Clean up debugging calls
Andres Lagar-Cavilla [Tue, 24 Apr 2012 18:05:08 +0000 (19:05 +0100)]
x86/mem_sharing: Clean up debugging calls

- Remove debug_mfn from the user-space interface
- Clean up errno codes

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: provide libxl_domain_config_init.
Ian Campbell [Wed, 4 Apr 2012 09:51:11 +0000 (10:51 +0100)]
libxl: provide libxl_domain_config_init.

Currently this struct is too complicated for the IDL to represent (arrays) so
for now implement by hand.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years ago[v2] xl: Don't require a config file for cpupools
George Dunlap [Tue, 24 Apr 2012 17:51:56 +0000 (18:51 +0100)]
[v2] xl: Don't require a config file for cpupools

Since the key information can be fairly simply put on the command-line,
there's no need to require an actual config file.

Also improve the help to cross-reference the xlcpupool.cfg manpage.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agoxl, cpupools: Create empty pool if no cpus are specified
George Dunlap [Tue, 24 Apr 2012 17:51:56 +0000 (18:51 +0100)]
xl, cpupools: Create empty pool if no cpus are specified

Currently, if "xl cpupool-create" is called with no cpus configured,
xl will choose a cpu at random from the list of unassigned cpus, and
if no unassigned cpus are available, it will fail.

This seems to me to be a poor interface.  For one, it makes it impossible
to create an empty cpupool using the xl command-line, except by creating
a pool and then removing the cpus from it.  For two, I don't think assigning
a random cpu is a feature; it's not unreasonable for the user to specify
which cpus to add to which pools.

This patch changes the behavior of "xl cpupool-create" to create an empty
pool if no cpus are specified.  I believe this interface to be more expected
and more script-friendly.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: make most libxl_FOO_path() functions internal.
Ian Campbell [Thu, 12 Apr 2012 08:12:58 +0000 (09:12 +0100)]
libxl: make most libxl_FOO_path() functions internal.

Only libxl_xen_config_dir_path and libxl_lock_dir_path are used outside the
library. Also bindir, sbindir, sharedir and xenpagingdir appeared to be
completely unused so nuke them.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agoautoconf: use python-config when present, if not switch to distuti
Roger Pau Monne [Tue, 24 Apr 2012 17:42:24 +0000 (18:42 +0100)]
autoconf: use python-config when present, if not switch to distuti

Use python-config utility when possible, and if it is not present switch to
distutils.

Should fix the bug reported by Olaf Hering on SuSE.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Tested-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: mark internal functions hidden
Ian Campbell [Tue, 24 Apr 2012 17:40:15 +0000 (18:40 +0100)]
libxl: mark internal functions hidden

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agotools: Fix FPU save area definition in xen-hvmctx
Tim Deegan [Tue, 24 Apr 2012 17:39:18 +0000 (18:39 +0100)]
tools: Fix FPU save area definition in xen-hvmctx

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agotools/build: fix distclean
Roger Pau Monne [Tue, 24 Apr 2012 17:20:07 +0000 (18:20 +0100)]
tools/build: fix distclean

distclean removed config/Tools.mk which was needed by tools/Rules.mk, thus
preventing distclean from running properly in the tools directory. This patch
only enforces config/Tools.mk presence when not performing a clean/distclean
target

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agotools: xen-access: Check return values and clean up on errors during init
Aravindh Puthiyaparambil [Tue, 24 Apr 2012 17:17:51 +0000 (18:17 +0100)]
tools: xen-access: Check return values and clean up on errors during init

Check the return values of the libxc mem_access calls.  Free allocated
structures (platform_info, domain_info) on errors during
initialization and exit.  Unbind VIRQ, close event channel and
connection to Xen on errors during initialization

Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agotools/blktap: fix build error w/o MEMSHR
Christoph Egger [Tue, 24 Apr 2012 17:16:30 +0000 (18:16 +0100)]
tools/blktap: fix build error w/o MEMSHR

Do not include memshr.h when MEMSHR is not defined.
Fixes build error when MEMSHR is disabled.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: fix rtc_timeoffset setting
Lin Ming [Tue, 24 Apr 2012 16:45:45 +0000 (17:45 +0100)]
libxl: fix rtc_timeoffset setting

libxl__domain_build_info_setdefault may be called several times,
so rtc_timeoffset can't be setted in it.

Move rtc_timeoffset setting logic to libxl__build_pre.

Reported-by: Teck Choon Giam <giamteckchoon@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
 tools/libxl/libxl_create.c |    9 ---------
 tools/libxl/libxl_dom.c    |   17 +++++++++++++++--
 2 files changed, 15 insertions(+), 11 deletions(-)

13 years agolibxl: Remove libxl_tmem_destroy and associated xl command
Ian Campbell [Mon, 16 Apr 2012 15:00:47 +0000 (16:00 +0100)]
libxl: Remove libxl_tmem_destroy and associated xl command

Dan Magenheimer explains in <4c2f7fca-dda2-4598-aaab-3a6a3fe532cd@default>:

I think the tmem_destroy functionality pre-dates the
existence of tmem "freeable" memory* and was a way for
a toolset to force the hypervisor to free up the hypervisor
memory used by some or all ephemeral tmem pools.  Once the
tmem allocation/free process was directly linked into
alloc_heap_pages() in the hypervisor (see call to
tmem_relinquish_pages()), this forcing function was
no longer needed.

So, bottom line, I *think* it can be ripped out, or at least
for now removed from the definition of the stable xl API/UI.
The libxl.c routine libxl_tmem_destroy() could also be
removed if you like, but I guess I'd prefer to leave the
lower level droppings in xc.c and in the hypervisor in case
I am misremembering.

Accordingly remove this interface from libxl and xl but don't touch libxc or
the hypervisor.

This is the only libxl_tmem_* function which might potentially have required
conversion to be asynchronous and which therefore might have been a potential
API stability concern.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>