]> xenbits.xensource.com Git - xen.git/log
xen.git
12 years agolibxl: correct some comments regarding event API and fds
Ian Jackson [Fri, 3 Aug 2012 10:57:10 +0000 (11:57 +0100)]
libxl: correct some comments regarding event API and fds

* libxl may indeed register more than one callback for the same fd,
  with some restrictions.  The allowable range of responses to this by
  the application means that this should pose no problems for users.
  But the documentation comment should be fixed.

* Document the relaxed synchronicity semantics of the fd_modify
  registration callback.

* A couple of comments referred to old names for functions.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoIntel VT-d: Dump IOMMU supported page sizes
Santosh Jodh [Fri, 3 Aug 2012 09:38:04 +0000 (10:38 +0100)]
Intel VT-d: Dump IOMMU supported page sizes

Signed-off-by: Santosh Jodh <santosh.jodh@citrix.com>
12 years agonestedhvm: fix nested page fault build error on 32-bit
Ian Campbell [Fri, 3 Aug 2012 08:54:17 +0000 (09:54 +0100)]
nestedhvm: fix nested page fault build error on 32-bit

    cc1: warnings being treated as errors
    hvm.c: In function ‘hvm_hap_nested_page_fault’:
    hvm.c:1282: error: passing argument 2 of ‘nestedhvm_hap_nested_page_fault’ from incompatible pointer type /local/scratch/ianc/devel/xen-unstable.hg/xen/include/asm/hvm/nestedhvm.h:55: note: expected ‘paddr_t *’ but argument is of type ‘long unsigned int *’

hvm_hap_nested_page_fault takes an unsigned long gpa and passes &gpa
to nestedhvm_hap_nested_page_fault which takes a paddr_t *. Since both
of the callers of hvm_hap_nested_page_fault (svm_do_nested_pgfault and
ept_handle_violation) actually have the gpa which they pass to
hvm_hap_nested_page_fault as a paddr_t I think it makes sense to
change the argument to hvm_hap_nested_page_fault.

The other user of gpa in hvm_hap_nested_page_fault is a call to
p2m_mem_access_check, which currently also takes a paddr_t gpa but I
think a paddr_t is appropriate there too.

Jan points out that this is also an issue for >4GB guests on the 32
bit hypervisor.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: const correctness for libxl__xs_path_cleanup
Ian Campbell [Fri, 3 Aug 2012 08:54:16 +0000 (09:54 +0100)]
libxl: const correctness for libxl__xs_path_cleanup

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: add a comment re the memory management API instability
Ian Jackson [Fri, 3 Aug 2012 08:54:15 +0000 (09:54 +0100)]
libxl: add a comment re the memory management API instability

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: idl: always initialise the KeyedEnum keyvar in the member init function
Ian Campbell [Fri, 3 Aug 2012 08:54:14 +0000 (09:54 +0100)]
libxl: idl: always initialise the KeyedEnum keyvar in the member init function

Previously we only initialised it if an explicit keyvar_init_val was
given but not if the default was implicitly 0.

In the generated code this only changes the unused libxl_event_init_type
function:

 void libxl_event_init_type(libxl_event *p, libxl_event_type type)
 {
+    assert(!p->type);
+    p->type = type;
     switch (p->type) {
     case LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN:
         break;

However I think it is wrong that this function is unused, this and
libxl_event_init should be used by libxl__event_new. As it happens
both are just memset to zero but for correctness we should use the
init functions (in case the IDL changes).

In the generator we also need to properly handle init_var == 0 which
the current if statements incorrectly treat as False. This doesn't
actually have any impact on the generated code.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: remove an unused numainfo parameter
Ian Jackson [Fri, 3 Aug 2012 08:54:14 +0000 (09:54 +0100)]
libxl: remove an unused numainfo parameter

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: remus: mark TODOs more clearly
Ian Jackson [Fri, 3 Aug 2012 08:54:13 +0000 (09:54 +0100)]
libxl: remus: mark TODOs more clearly

Change the TODOs in the remus code to "REMUS TODO" which will make
them easier to grep for later.  AIUI all of these are essential for
use of remus in production.

Also add a new TODO and a new assert, to check rc on entry to
remus_checkpoint_dm_saved.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: do not blunder on if bootloader fails (again)
Ian Jackson [Fri, 3 Aug 2012 08:54:12 +0000 (09:54 +0100)]
libxl: do not blunder on if bootloader fails (again)

Do not lose the rc value passed to bootloader_callback.  Do not lose
the rc value from the bl when the local disk detach succeeds.

While we're here rationalise the use of bl->rc to make things clearer.
Set it to zero at the start and always update it conditionally; copy
it into bootloader_callback's argument each time.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: rename aodevs to multidev
Ian Jackson [Fri, 3 Aug 2012 08:54:11 +0000 (09:54 +0100)]
libxl: rename aodevs to multidev

To be consistent with the new function naming, rename
libxl__ao_devices to libxl__multidev and all variables aodevs to
multidev.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: abolish useless `start' parameter to libxl__add_*
Ian Jackson [Fri, 3 Aug 2012 08:54:11 +0000 (09:54 +0100)]
libxl: abolish useless `start' parameter to libxl__add_*

0 is always passed for this parameter and the code doesn't, actually,
use it, now.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix formatting of DEFINE_DEVICES_ADD
Ian Jackson [Fri, 3 Aug 2012 08:54:10 +0000 (09:54 +0100)]
libxl: fix formatting of DEFINE_DEVICES_ADD

These lines were exactly 80 columns wide, which produces hideous wrap
damage in an 80 column emacs.  Reformat using emacs's C-c \,
which puts the \ in column 72 (by default) where possible.

Whitespace change only.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix device counting race in libxl__devices_destroy
Ian Jackson [Fri, 3 Aug 2012 08:54:09 +0000 (09:54 +0100)]
libxl: fix device counting race in libxl__devices_destroy

Don't have a fixed number of devices in the aodevs array, and instead
size it depending on the devices present in xenstore.  Somewhat
formalise the multiple device addition/removal machinery to make this
clearer and easier to do.

As a side-effect we fix a few "lost thread of control" bug which would
occur if there were no devices of a particular kind.  (Various if
statements which checked for there being no devices have become
redundant, but are retained to avoid making the patch bigger.)

Specifically:

 * Users of libxl__ao_devices are no longer expected to know in
   advance how many device operations they are going to do.  Instead
   they can initiate them one at a time, between bracketing calls to
   "begin" and "prepared".

 * The array of aodevs used for this is dynamically sized; to support
   this it's an array of pointers rather than of structs.

 * Users of libxl__ao_devices are presented with a more opaque interface.
   They are are no longer expected to, themselves,
      - look into the array of aodevs (this is now private)
      - know that the individual addition/removal completions are
        handled by libxl__ao_devices_callback (this callback function
        is now a private function for the multidev machinery)
      - ever deal with populating the contents of an aodevs

 * The doc comments relating to some of the members of
   libxl__ao_device are clarified.  (And the member `aodevs' is moved
   to put it with the other members with the same status.)

 * The multidev machinery allocates an aodev to represent the
   operation of preparing all of the other operations.  See
   the comment in libxl__multidev_begin.

A wrinkle is that the functions are called "multidev" but the structs
are called "libxl__ao_devices" and "aodevs".  I have given these
functions this name to distinguish them from "libxl__ao_device" and
"aodev" and so forth by more than just the use of the plural "s"
suffix.

In the next patch we will rename the structs.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: react correctly to bootloader pty master POLLHUP
Ian Jackson [Fri, 3 Aug 2012 08:54:08 +0000 (09:54 +0100)]
libxl: react correctly to bootloader pty master POLLHUP

Receive POLLHUP on the bootloader master pty is not an error.
Hopefully it means that the bootloader has exited and therefore the
pty slave side has no process group any more.  (At least NetBSD
indicates POLLHUP on the master in this case.)

So send the bootloader SIGTERM; if it has already exited then this has
no effect (except that on some versions of NetBSD it erroneously
returns ESRCH and we print a harmless warning) and we will then
collect the bootloader's exit status and be satisfied.

However, we remember that we have done this so that if we got POLLHUP
for some other reason than that the bootloader exited we report
something resembling a useful message.

In order to implement this we need to provide a way for users of
datacopier to handle POLLHUP rather than treating it as fatal.

We rename bootloader_abort to bootloader_stop since it now no longer
only applies to error situations.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: unify libxl__device_destroy and device_hotplug_done
Ian Jackson [Fri, 3 Aug 2012 08:54:07 +0000 (09:54 +0100)]
libxl: unify libxl__device_destroy and device_hotplug_done

device_hotplug_done contains an open-coded but improved version of
libxl__device_destroy.  So move the contents of device_hotplug_done
into libxl__device_destroy, deleting the old code, and replace it at
its old location with a function call.

Add the missing call to libxl__xs_transaction_abort (which was present
in neither version and technically speaking is always a no-op with
this code as it stands at the moment because no-one does "goto out"
other than after libxl__xs_transaction_start or _commit).

Also fix the error handling: the rc from the destroy should be
propagated into the aodev.

Reported-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agotools/vtpm: fix tpm_version.h error during parallel build
Olaf Hering [Fri, 3 Aug 2012 08:54:07 +0000 (09:54 +0100)]
tools/vtpm: fix tpm_version.h error during parallel build

Generating the tpm_version.h is not make -j safe:

In file included from ../tpm/tpm_emulator.h:25:0,
                 from ../tpm/tpm_startup.c:18:
../tpm/tpm_version.h:1:0: error: unterminated #ifndef
make[5]: *** [tpm_startup.o] Error 1

This happens because make can not know that 'all-recursive' depends on
'version'. Fix this by calling the individual make targets. Doing it
this way avoids adding yet another patch to the downloaded source.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: only read script once in libxl__hotplug_*
Ian Campbell [Fri, 3 Aug 2012 08:54:06 +0000 (09:54 +0100)]
libxl: only read script once in libxl__hotplug_*

instead of duplicating the error handling etc in get_hotplug_env just pass the
script already read by the caller down.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: prefix *.for-check with _ to mark it as a generated file.
Ian Campbell [Fri, 3 Aug 2012 08:54:05 +0000 (09:54 +0100)]
libxl: prefix *.for-check with _ to mark it as a generated file.

Keeps it out of my greps etc.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: fix gic_init_secondary_cpu.
Ian Campbell [Fri, 3 Aug 2012 08:54:04 +0000 (09:54 +0100)]
arm: fix gic_init_secondary_cpu.

Using spin_lock_irq here is unnecessary (interrupts are not yet enabled) and
wrong (since they will get unexpectedly renabled by spin_unlock_irq).

We can just use spin_lock/spin_unlock.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: make libxl_device_pci_{add,remove,destroy} interfaces asynchronous
Ian Campbell [Fri, 3 Aug 2012 08:54:03 +0000 (09:54 +0100)]
libxl: make libxl_device_pci_{add,remove,destroy} interfaces asynchronous

This does not make the implementation fully asynchronous but just
updates the API to support asynchrony in the future.

Currently although these functions do not call hotplug scripts etc and
therefore are not "slow" (per the comment about ao machinery in
libxl_internal.h) they do interact with the device model and so are
not quite "fast" either. We can live with this for now.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agocpufreq: P state stats aren't available if there is no cpufreq driver
David Vrabel [Fri, 3 Aug 2012 07:50:28 +0000 (09:50 +0200)]
cpufreq: P state stats aren't available if there is no cpufreq driver

If there is no cpufreq driver (e.g., with an AMD Opteron 8212) then
reading the P state statistics causes a deadlock as an uninitialized
spinlock is locked in do_get_pm_info(). The spinlock is initialized in
cpufreq_statistic_init() which is not called if cpufreq_driver == NULL.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
12 years agonestedhvm: return the pfec from the pagetable walk.
Tim Deegan [Thu, 2 Aug 2012 13:44:53 +0000 (14:44 +0100)]
nestedhvm: return the pfec from the pagetable walk.

Don't clobber it with the pfec from teh p2m walk behind it; the guest
will not expect (or be able to handle) error codes that come from the
p2m table, which it can't see or control.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Tim Deegan <tim@xen.org>
12 years agonestedhvm: fix write access fault on ro mapping
Christoph Egger [Thu, 2 Aug 2012 13:38:09 +0000 (14:38 +0100)]
nestedhvm: fix write access fault on ro mapping

Fix write access fault when host npt is mapped read-only.
In this case let the host handle the #NPF.
Apply host p2mt to hap-on-hap pagetable entry.
This fixes the l2 guest graphic display refresh problem.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
12 years agoxen: detect compiler version with '--version' rather than '-v'
Tim Deegan [Thu, 2 Aug 2012 11:04:31 +0000 (12:04 +0100)]
xen: detect compiler version with '--version' rather than '-v'

This allows us to get rid of the 'grep version', which doesn't
work with localized compilers.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
12 years agox86: also allow disabling LAPIC NMI watchdog on newer CPUs
Jan Beulich [Thu, 2 Aug 2012 09:49:37 +0000 (11:49 +0200)]
x86: also allow disabling LAPIC NMI watchdog on newer CPUs

This complements c/s 9146:941897e98591, and also replaces a literal
zero with a proper manifest constant.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agopygrub: add quoting to install receipe
Olaf Hering [Thu, 2 Aug 2012 09:46:02 +0000 (10:46 +0100)]
pygrub: add quoting to install receipe

The changeset 25694:e20085770cb5 causes a syntax error if readline
returns nothing due to non-existant path:

[  148s] set -e; if [ `readlink -f /home/abuild/rpmbuild/BUILD/xen-4.2.25700/non-dbg/dist/install//usr/bin` != \
[  148s]              `readlink -f /usr/lib64/xen/bin` ]; then \
[  148s]     ln -sf /usr/lib64/xen/bin/pygrub /home/abuild/rpmbuild/BUILD/xen-4.2.25700/non-dbg/dist/install//usr/bin; \
[  148s] fi
[  148s] /bin/sh: line 0: [: /home/abuild/rpmbuild/BUILD/xen-4.2.25700/non-dbg/dist/install/usr/bin: unary operator expected

Add quoting to fix the error.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: enforce prohibitions of internal callers
Ian Jackson [Wed, 1 Aug 2012 11:46:52 +0000 (12:46 +0100)]
libxl: enforce prohibitions of internal callers

libxl_internal.h says:

 * Functions using LIBXL__INIT_EGC may *not* generally be called from
 * within libxl, because libxl__egc_cleanup may call back into the
 * application. ...

and

 *                    ...  [Functions which take an ao_how] MAY NOT
 * be called from inside libxl, because they can cause reentrancy
 * callbacks.

However, this was not enforced.  Particularly the latter restriction
is easy to overlook, especially since during the transition period to
the new event system we have bent this rule a couple of times, and the
bad pattern simply involves passing 0 or NULL for the ao_how.

So use the compiler to enforce this property, as follows:

 - Mark all functions which take a libxl_asyncop_how, or which
   use EGC_INIT or LIBXL__INIT_EGC, with a new annotation
   LIBXL_EXTERNAL_CALLERS_ONLY in the public header.

 - Change the documentation comment for asynch operations and egcs to
   say that this should always be done.

 - Arrange that if libxl.h is included via libxl_internal.h,
   LIBXL_EXTERNAL_CALLERS_ONLY expands to __attribute__((warning(...))),
   which generates a message like this:
      libxl.c:1772: warning: call to 'libxl_device_disk_remove'
             declared with attribute warning:
             may not be called from within libxl
   Otherwise, the annotation expands to nothing, so external
   callers are unaffected.

 - Forbid inclusion of both libxl.h and libxl_internal.h unless
   libxl_internal.h came first, so that the above check doesn't have
   any loopholes.  Files which include libxl_internal.h should not
   include libxl.h as well.

   This is enforced explicitly using #error.  However, in practice
   with the current tree it just changes the error message when this
   mistake is made; otherwise we would carry on to immediately
   following #define which would cause the compiler to complain that
   LIBXL_EXTERNAL_CALLERS_ONLY was redefined.  Then the developer
   might be tempted to add a #ifndef which would be wrong - it would
   leave the affected translation unit unprotected by the new
   enforcement regime.  So let's be explicit.

 - Fix the one source of files which violate the above principle, the
   output from the idl compiler, by removing the redundant inclusion
   of libxl.h from the output.

Also introduce a new script "check-libxl-api-rules" which contains
some ad-hoc regexps to spot and complain when libxl.h contains
functions which mention libxl_asyncop_how but not
LIBXL_EXTERNAL_CALLERS_ONLY.  This isn't a full C parser but is likely
to get the common cases right and err on the side of complaining.

While we are here, the invocation of perl for the bsd queue.h seddery
to $(PERL).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agotools/config: Allow building of components to be controlled from .config
Andrew Cooper [Wed, 1 Aug 2012 11:46:51 +0000 (12:46 +0100)]
tools/config: Allow building of components to be controlled from .config

For build systems which build certain Xen components separately, allow certain
components to be conditionally built based on .config, rather than always
building them.

This patch allows qemu and blktap to be configured in this manner.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agotools/ocaml: ignore and clean .spot and .spit files
Andrew Cooper [Wed, 1 Aug 2012 11:46:50 +0000 (12:46 +0100)]
tools/ocaml: ignore and clean .spot and .spit files

Newer ocaml toolchains generate .spot and .spit files which are ocaml metadata
about their respective source files.

Add them to the clean rules as well as the .{hg,git}ignore files.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix unitialized variables in libxl__primary_console_find
Olaf Hering [Wed, 1 Aug 2012 11:46:49 +0000 (12:46 +0100)]
libxl: fix unitialized variables in libxl__primary_console_find

gcc 4.5 as shipped with openSuSE 11.4 does not recognize the case of
LIBXL_DOMAIN_TYPE_INVALID properly:

cc1: warnings being treated as errors
libxl.c: In function 'libxl_primary_console_exec':
libxl.c:1408:14: error: 'domid' may be used uninitialized in this function
libxl.c:1409:9: error: 'cons_num' may be used uninitialized in this function
libxl.c:1410:24: error: 'type' may be used uninitialized in this function
libxl.c: In function 'libxl_primary_console_get_tty':
libxl.c:1421:14: error: 'domid' may be used uninitialized in this function
libxl.c:1422:9: error: 'cons_num' may be used uninitialized in this function
libxl.c:1423:24: error: 'type' may be used uninitialized in this function
make[3]: *** [libxl.o] Error 1

Fix this by adding a default case.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoinit/NetBSD: move xenbackendd to xend init script
Roger Pau Monne [Wed, 1 Aug 2012 11:46:48 +0000 (12:46 +0100)]
init/NetBSD: move xenbackendd to xend init script

xenbackendd is not needed by the xl toolstack, so move it's launch to
the xend script.

We have to iterate until we are sure there are no xend processes left,
since doing a single pkill usually leaves xend processes running.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: call hotplug scripts from xl for NetBSD
Roger Pau Monne [Wed, 1 Aug 2012 11:46:47 +0000 (12:46 +0100)]
libxl: call hotplug scripts from xl for NetBSD

Add the missing NetBSD functions to call hotplug scripts, and disable
xenbackendd if libxl/disable_udev is not set.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agotools/build: fix pygrub linking
Roger Pau Monne [Wed, 1 Aug 2012 11:46:47 +0000 (12:46 +0100)]
tools/build: fix pygrub linking

Prevent creating a symlink to $(DESTDIR)/$(BINDIR) if it is the same
as $(PRIVATE_BINDIR)

This fixes NetBSD install, where $(DESTDIR)/$(BINDIR) ==
$(PRIVATE_BINDIR).

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoSome automatic NUMA placement documentation
Dario Faggioli [Wed, 1 Aug 2012 11:46:46 +0000 (12:46 +0100)]
Some automatic NUMA placement documentation

About rationale, usage and (some small bits of) API.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoUpdate Xen version to 4.2.0-rc2-pre
Keir Fraser [Mon, 30 Jul 2012 15:16:09 +0000 (16:16 +0100)]
Update Xen version to 4.2.0-rc2-pre

12 years agoAdded signature for changeset 8e620dc570ce
Keir Fraser [Mon, 30 Jul 2012 15:15:37 +0000 (16:15 +0100)]
Added signature for changeset 8e620dc570ce

12 years agoAdded tag 4.2.0-rc1 for changeset 8e620dc570ce
Keir Fraser [Mon, 30 Jul 2012 15:15:27 +0000 (16:15 +0100)]
Added tag 4.2.0-rc1 for changeset 8e620dc570ce

12 years agoUpdate Xen version to 4.2.0-rc1 4.2.0-rc1
Keir Fraser [Mon, 30 Jul 2012 15:15:18 +0000 (16:15 +0100)]
Update Xen version to 4.2.0-rc1

12 years agox86: fix off-by-one in nr_irqs_gsi calculation
Jan Beulich [Fri, 27 Jul 2012 10:22:13 +0000 (12:22 +0200)]
x86: fix off-by-one in nr_irqs_gsi calculation

highest_gsi() returns the last valid GSI, not a count.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Joe Jin <joe.jin@oracle.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86-64: drop updating of UREGS_rip when converting sysenter to #GP
Jan Beulich [Fri, 27 Jul 2012 08:00:12 +0000 (10:00 +0200)]
x86-64: drop updating of UREGS_rip when converting sysenter to #GP

This was set to zero immediately before the #GP injection code, since
SYSENTER doesn't really have a return address.

Reported-by: Ian Campbell <Ian.Campbell@citrix.com>
Furthermore, UREGS_cs and UREGS_rip don't need to be written a second
time, as the PUSHes above already can/do take care of putting in place
the intended values.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agouse C11's _Static_assert() for BUILD_BUG_ON etc when available
Jan Beulich [Fri, 27 Jul 2012 07:59:25 +0000 (09:59 +0200)]
use C11's _Static_assert() for BUILD_BUG_ON etc when available

This produces a more meaningful compiler diagnostic in case it happens
to trigger.

As a minor piece of cleanup, at once also use BUILD_BUG_ON_ZERO() to
actually define BUILD_BUG_ON() in the legacy case, slightly reducing
redundancy.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agoserial: don't waste space allocated for the tx buffer(s)
Jan Beulich [Fri, 27 Jul 2012 07:57:20 +0000 (09:57 +0200)]
serial: don't waste space allocated for the tx buffer(s)

We're allocating minimally a full page, so no reason to not also use
all that space.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86/mm/p2m: use NX bit for p2m entries
Christoph Egger [Thu, 26 Jul 2012 18:02:44 +0000 (19:02 +0100)]
x86/mm/p2m: use NX bit for p2m entries

In addition to c/s 25614:7d8a2e8412f2 also use the NX bit
for non-ram types.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
12 years agolibxl: fix reentrancy hazard in fd event processing
Ian Jackson [Thu, 26 Jul 2012 16:22:39 +0000 (17:22 +0100)]
libxl: fix reentrancy hazard in fd event processing

In afterpoll_internal, the callback functions may register and
deregister events arbitrarily.  This means that we need to consider
the reentrancy-safety of the event machinery state variables.

Most of the code is safe but the fd handling is not.  Fix this by
arranging to restart the fd scan loop every time we call one of these
callback functions.

For this loop to terminate, we modify afterpoll_check_fd so that it
returns only once for each of afterpoll's efds.

Another possible solution would be simply to return from
afterpoll_internal after calling efd->func.  That would be a small and
more obviously correct change but would prevent the process from
handling more than one fd event with a single call to poll.

This is apropos of a report from Roger Pau Monne to me (pers.comm.)
of this crash on NetBSD:

  Program terminated with signal 11, Segmentation fault.
  #0  0x00007f7ff743131b in afterpoll_check_fd (poller=<optimized out>, fds=0x7f7ff7b241c0, nfds=7, fd=-1, events=1)
      at libxl_event.c:856
  856             if (fds[slot].fd != fd)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reported-by: Roger Pau Monne <roger.pau@citrix.com>
Tested-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86/hvm: don't leave emulator in inconsistent state
Jan Beulich [Thu, 26 Jul 2012 15:51:51 +0000 (16:51 +0100)]
x86/hvm: don't leave emulator in inconsistent state

The fact that handle_mmio(), and thus the instruction emulator, is
being run through twice for emulations that require involvement of the
device model, allows for the second run to see a different guest state
than the first one. Since only the MMIO-specific emulation routines
update the vCPU's io_state, if they get invoked on the second pass,
internal state (and particularly this variable) can be left in a state
making successful emulation of a subsequent MMIO operation impossible.

Consequently, whenever the emulator invocation returns without
requesting a retry of the guest instruction, reset io_state.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agolibxl: convert libxl_device_vfb_add to an async operation
Roger Pau Monne [Thu, 26 Jul 2012 15:47:37 +0000 (16:47 +0100)]
libxl: convert libxl_device_vfb_add to an async operation

Split libxl_device_vfb_add into libxl__device_vfb_add (to be used
inside already running ao's), and make libxl_device_vfb_add a stub
to call libxl__device_vfb_add.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: convert libxl_device_vkb_add to an async operation
Roger Pau Monne [Thu, 26 Jul 2012 15:47:36 +0000 (16:47 +0100)]
libxl: convert libxl_device_vkb_add to an async operation

Split libxl_device_vkb_add into libxl__device_vkb_add (to be used
inside already running ao's), and make libxl_device_vkb_add a stub to
call libxl__device_vkb_add.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: call hotplug scripts for nic devices from libxl
Roger Pau Monne [Thu, 26 Jul 2012 15:47:35 +0000 (16:47 +0100)]
libxl: call hotplug scripts for nic devices from libxl

Since most of the needed work is already done in previous patches,
this patch only contains the necessary code to call hotplug scripts
for nic devices, that should be called when the device is added or
removed from a guest.

Added another parameter to libxl__get_hotplug_script_info, that is
used to know the number of times hotplug scripts have been called for
that device. This is currently used by IOEMU nics on Linux.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson<ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: call hotplug scripts for disk devices from libxl
Roger Pau Monne [Thu, 26 Jul 2012 15:47:34 +0000 (16:47 +0100)]
libxl: call hotplug scripts for disk devices from libxl

Since most of the needed work is already done in previous patches,
this patch only contains the necessary code to call hotplug scripts
for disk devices, that should be called when the device is added or
removed from a guest.

We will chain the launch of the disk hotplug scripts after the
device_backend_callback callback, or directly from
libxl__initiate_device_{add,remove} if the device is already in the
desired state.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: set correct nic type depending on the guest
Roger Pau Monne [Thu, 26 Jul 2012 15:47:33 +0000 (16:47 +0100)]
libxl: set correct nic type depending on the guest

Fix the use of nic type, which results in the following for each type
of domain:

 * HVM: let the user choose, if none specified use VIF_IOEMU.
 * PV: use VIF is none provided, return error if VIF_IOEMU requested.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: add option to choose who executes hotplug scripts
Roger Pau Monne [Thu, 26 Jul 2012 15:47:32 +0000 (16:47 +0100)]
libxl: add option to choose who executes hotplug scripts

Add and option to xl.conf file to decide if hotplug scripts are
executed from the toolstack (xl) or from udev as it used to be in the
past.

This option is only introduced in this patch, but it has no effect
since the code to call hotplug scripts from libxl is introduced in a
latter patch.

This choice will be saved in "libxl/disable_udev", as specified in the
DISABLE_UDEV_PATH constant.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: convert libxl_device_nic_add to an async operation
Roger Pau Monne [Thu, 26 Jul 2012 15:47:31 +0000 (16:47 +0100)]
libxl: convert libxl_device_nic_add to an async operation

This patch converts libxl_device_nic_add to an ao operation that
waits for device backend to reach state XenbusStateInitWait and then
marks the operation as completed. This is not really useful now, but
will be used by latter patches that will launch hotplug scripts after
we reached the desired xenbus state.

Calls to libxl_device_nic_add have also been moved to occur after the
device model has been launched, so when hotplug scripts are called
from this functions the interfaces already exists.

As usual, libxl_device_nic_add callers have been modified, and the
internal function libxl__device_disk_add has been used if the call was
inside an already running ao.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: convert libxl_device_disk_add to an async op
Roger Pau Monne [Thu, 26 Jul 2012 15:47:30 +0000 (16:47 +0100)]
libxl: convert libxl_device_disk_add to an async op

This patch converts libxl_device_disk_add to an ao operation that
waits for device backend to reach state XenbusStateInitWait and then
marks the operation as completed. This is not really useful now, but
will be used by later patches that will launch hotplug scripts after
we reached the desired xenbus state.

As usual, libxl_device_disk_add callers have been modified, and the
internal function libxl__device_disk_add has been used if the call was
inside an already running ao.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
[ ijc -- drop hunk modifying libxl_cdrom_insert which is not needed after
         25670:3666e9712eaf "libxl: make libxl_cdrom_insert async" ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: convert libxl__device_disk_local_attach to an async op
Roger Pau Monne [Thu, 26 Jul 2012 15:47:29 +0000 (16:47 +0100)]
libxl: convert libxl__device_disk_local_attach to an async op

This will be needed in future patches, when libxl__device_disk_add
becomes async also. Create a new status structure that defines the
local attach of a disk device and use it in
libxl__device_disk_local_attach.

This is done in this patch to split the changes introduced when
libxl__device_disk_add becomes async.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: refactor disk addition to take a helper
Roger Pau Monne [Thu, 26 Jul 2012 15:47:29 +0000 (16:47 +0100)]
libxl: refactor disk addition to take a helper

Change libxl__device_disk_add to no longer take a xs transaction and
instead pass a helper for the local attach case that's used to get the
free vdev.

This function contains some non-functional changes due to an
indentation change.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix removal of secondary consoles
Roger Pau Monne [Thu, 26 Jul 2012 15:47:28 +0000 (16:47 +0100)]
libxl: fix removal of secondary consoles

Secondary consoles are processed by libxl with the rest of the
devices by calling libxl__initiate_device_remove that waits for the
device to reach state 6 before procceeding with the removal.

When libxl is destroying the console devices, Qemu is already dead or
dying, and xenconsoled completely ignores the state backend entry for
console devices, since it performs the cleanup based on the result of
reads/writes to the tty.

Since we don't want to execute hotplug scripts for consoles, leave the
behaviour as it was previously, and just nuke the backend/frontend
xenstore entries by calling libxl__device_destroy.

Report: http://markmail.org/message/yqgppcsdip6tnmh6

Reported-by: Ian Campbell <ian.campbell@eu.citrix.com>
Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: make libxl_cdrom_insert async.
Ian Campbell [Thu, 26 Jul 2012 14:58:18 +0000 (15:58 +0100)]
libxl: make libxl_cdrom_insert async.

This functionality is a bit of a mess and several configurations are
not properly supported.

The protocol for changing is basically to change the params node in
the disk xenstore backend. There is no interlock or error reporting in
this protocol. Completely removing the device and recreating it is not
necessary nor expected. For reference the equivalent xend code is
tools/python/xen/xend/server/blkif.py::BlkifController::reconfigureDevice().

Device model stub domains are not supported. There appears to be no
way correctly to do a media change on the emulated device while also
changing the stub domains PV backend to point to the new
backend. Reworking this is a significant task deferred until 4.3. xend
(via the equivalent "xm block-configure" functionality) also does not
support media change for stub domains (confirmed by code inspection
and experiment). Unlike xend this version errors out instead of
silently not achieving anything in this case.

There is no support for qemu-xen (upstream) media change. I expect
this is supported on the qemu side and required QMP plumbing on the
libxl side. Again this is deferred until 4.3.

On the plus side the current implementation is trivially "asynchronous".

Adds a libxl__xs_writev_atonce helper to write a key-value list to
xenstore in one go.

Tested with Windows 7.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: have NUMA placement deal with cpupools
Dario Faggioli [Thu, 26 Jul 2012 14:41:54 +0000 (15:41 +0100)]
libxl: have NUMA placement deal with cpupools

In such a way that only the cpus belonging to the cpupool of the
domain being placed are considered for the placement itself.

This happens by filtering out all the nodes in which the cpupool
has not any cpu from the placement candidates. After that ---as
cpu pooling not necessarily happens at NUMA nodes boundaries--- we
also make sure only the actual cpus that are part of the pool are
considered when counting how much processors a placement candidate
provides.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: enable automatic placement of guests on NUMA nodes
Dario Faggioli [Thu, 26 Jul 2012 14:41:54 +0000 (15:41 +0100)]
libxl: enable automatic placement of guests on NUMA nodes

If a domain does not have a VCPU affinity, try to pin it automatically
to some PCPUs. This is done taking into account the NUMA characteristics
of the host. In fact, we look for a combination of host's NUMA nodes
with enough free memory and number of PCPUs for the new domain, and pin
it to the VCPUs of those nodes.

Deciding which placement is the best happens by means of some heuristics.
For instance, smaller candidates are better, both from a domain perspective
(less memory spreading among nodes) and from the entire system perspective
(smaller memory fragmentation). In case of candidates of equal sizes
(i.e., with the same number of nodes), the amount of free memory and
the number of domains' vCPUs already pinned to the candidates' nodes are
both considered. Very often, candidates with greater amount of memory
are the one we wants, as this is good for keeping memory fragmentation
under control. However, we do not want to overcommit some node too much,
just because it has a lot of memory, and that's why the number of vCPUs
must be accounted for.

This all happens internally to libxl, and no API for driving the
mechanism is provided for now. This matches what xend already does.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: Andre Przywara <andre.przywara@amd.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: libxl__xs_path_cleanup don't print error if ENOENT
Roger Pau Monne [Thu, 26 Jul 2012 09:55:09 +0000 (10:55 +0100)]
libxl: libxl__xs_path_cleanup don't print error if ENOENT

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen: update xensource.com to xen.org
Andrew Cooper [Thu, 26 Jul 2012 09:35:37 +0000 (10:35 +0100)]
xen: update xensource.com to xen.org

This patch was constructed by grepping for xensource.com over the entire
repository and eyeballing which ones were sensible to update.

In addition, the xen-tools mailing list has been deprecated, so update xentop
to refer to xen-devel instead.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: support xend empty cdrom device syntax
Ian Jackson [Thu, 26 Jul 2012 09:35:36 +0000 (10:35 +0100)]
xl: support xend empty cdrom device syntax

xend accepts `,hdc:cdrom,r' as an empty CDROM drive.  However this is
not consistent with the existing xl syntax in
docs/misc/xl-disk-configuration.txt which requires `,,hdc:cdrom,r'
(the additional positional paramter is the format).

We fix this by spotting the case specially: when the target is empty
and the format contains a colon, reinterpret the format as
<vdev>:<devtype>.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: disk parsing preparation for empty cdrom devices
Ian Jackson [Thu, 26 Jul 2012 09:35:36 +0000 (10:35 +0100)]
xl: disk parsing preparation for empty cdrom devices

Prepare the ground for parsing the xend empty cdrom syntax, by
separating out some non-functional changes as this pre-patch:

* Clarify the disk syntax documentation wording to refer to deprecated
  syntaxes too.

* Make DPC in libxlu_disk_l.l useable in the helper functions as well
  as in lexer rules, by providing two definitions, each in force in
  the appropriate parts of the file.

* Break the <vdev>[:<devtype>] parsing out into a helper function,
  `vdev_and_devtype'.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: support empty CDROM devices
Ian Campbell [Thu, 26 Jul 2012 09:35:35 +0000 (10:35 +0100)]
xl: support empty CDROM devices

The important change here is to xlu_disk_parse to correctly set format == EMPTY
for CDROM devices which are empty. Test cases are added which check for
correctness here.

xend accepts ',hdc:cdrom,r'[0] as an empty CDROM drive however this is not
consistent with the xl syntax in docs/misc/xl-disk-configuration.txt which
requires ',,hdc:cdrom,r' (the additional positional paramter is the format).
I'm not sure if/how this can be fixed. Note that xend does not accept
',,hdc:cdrom,r'

There are several incidental cleanups included the the cdrom-{insert,eject}
commands:
  - add a dry-run mode
  - use the non-deprecated disk specification syntax
  - check for and report errors from libxl_cdrom_insert

[0] http://wiki.xen.org/wiki/CD_Rom_Support_in_Xen

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: set nic type of stub to PV instead of copying from the parent
Roger Pau Monne [Thu, 26 Jul 2012 09:35:34 +0000 (10:35 +0100)]
libxl: set nic type of stub to PV instead of copying from the parent

Set the type of the nics used in sutbdoms to PV unconditianlly, or the
call to setdefaults later is going to fail.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: main_blockdetach don't call destroy if remove succeeds
Roger Pau Monne [Thu, 26 Jul 2012 09:35:33 +0000 (10:35 +0100)]
xl: main_blockdetach don't call destroy if remove succeeds

xl was calling libxl_device_disk_destroy after a successful call to
libxl_device_disk_remove, which leads to an error.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: use libxl__xs_path_cleanup on device_destroy
Roger Pau Monne [Thu, 26 Jul 2012 09:35:32 +0000 (10:35 +0100)]
libxl: use libxl__xs_path_cleanup on device_destroy

Since the hotplug script that was in charge of cleaning the backend is
no longer launched, we need to clean the backend by ourselves, so use
libxl__xs_path_cleanup instead of xs_rm.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: rename _IOEMU nic type to VIF_IOEMU
Roger Pau Monne [Thu, 26 Jul 2012 09:35:31 +0000 (10:35 +0100)]
libxl: rename _IOEMU nic type to VIF_IOEMU

This change will avoid the confusion caused by the fact that IOEMU
means both PV and TAP network interfaces.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: rename vifs to nics
Roger Pau Monne [Thu, 26 Jul 2012 09:35:31 +0000 (10:35 +0100)]
libxl: rename vifs to nics

This change renames functions and struct values that used to contain
vifs in their names to nics, that provides a more clear name to
define network interfaces without referring to the backend that is
behind them.

This is not a functional change.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: libxl__device_model_version_running should return an int
Ian Campbell [Wed, 25 Jul 2012 16:57:22 +0000 (17:57 +0100)]
libxl: libxl__device_model_version_running should return an int

On error it returns -1 and therefore it needs to return int and not
libxl_device_model_enum. Otherwise gcc 4.6.2 complains:

    libxl.c: In function ‘libxl_domain_suspend’:
    libxl.c:778:9: error: case value ‘4294967295’ not in enumerated type ‘libxl_device_model_version’ [-Werror=switch]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoMerge
Ian Campbell [Wed, 25 Jul 2012 16:56:39 +0000 (17:56 +0100)]
Merge

12 years agolibxl: kill the need for checking and linking to libm
Dario Faggioli [Wed, 25 Jul 2012 16:39:23 +0000 (17:39 +0100)]
libxl: kill the need for checking and linking to libm

Which was introduced in 7b0dc7f3ddfe. This is because the NUMA
placement heuristic does not need FP arith anymore.

As usual when changing configure.ac, remember to rerun autoconf
after applying this change.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: libxl_domain_sched_params_set case for ARINC 653 scheduler
Andrew Kane [Wed, 25 Jul 2012 16:39:22 +0000 (17:39 +0100)]
libxl: libxl_domain_sched_params_set case for ARINC 653 scheduler

Implements sched_arinc653_domain_set to match the existing API. Currently,
there is no domain-specific configuration when using the ARINC 653 scheduler,
so we simply return success.

Signed-off-by: Andrew Kane <Andrew.Kane@dornerworks.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: implement hypercall continuations
Ian Campbell [Wed, 25 Jul 2012 16:39:21 +0000 (17:39 +0100)]
arm: implement hypercall continuations

Largely cribbed from x86, register names differ and the return value is r0 ==
the first argument rather than the hypercall number (which is r12).

We must only clobber the hypercall arguments if PC has not been changed since
continuations rely on them.

Multicall variant is untested, On ARM do_multicall_call is currently a BUG() so
we obviously don't use that yet. I have left a BUG in the hypercall
continuation path too since it will need validation once multicalls are
implemented.

Since the multicall state is local we do not need a globally atomic
{test,set}_bit. However we do need to be atomic WRT interrupts so can't just
use the naive RMW version. Stick with the global atomic implementation for now
but keep the __ as documentaion of the intention.

Signed-off-by: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: add bounds check on hypercall array
Ian Campbell [Wed, 25 Jul 2012 16:39:21 +0000 (17:39 +0100)]
arm: add bounds check on hypercall array

Otherwise a guest can cause us to run off the end of the array.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
[ ijc -- switched to >= not > ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: clobber only argument registers
Ian Campbell [Wed, 25 Jul 2012 16:39:20 +0000 (17:39 +0100)]
arm: clobber only argument registers

Previously it was declared that r1..r4 would all be clobbered by all
hypercalls. Instead declare that only actually used hypercall argument
registers are clobbered. This is more inline with generally expected
conventions and allows for more optimal code in the caller in some cases.

This is an ABI change, although an older guest which expects more things to be
clobbered than we do now won't be adversely impacted.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agopython: disable libxl bindings
Ian Campbell [Wed, 25 Jul 2012 16:39:19 +0000 (17:39 +0100)]
python: disable libxl bindings

They are rather incomplete and have no users or maintainer. Many of the
functions which do exsit raise a NotImplemented exception. Disable them so that
users of the 4.2 release aren't confused into trying to use them.

This only does the minimal to disable them and makes it easy to locally
reenable if anyone wants to hack these into shape in the future.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agobuild: include Tools.mk first in tools/Rules.mk
Roger Pau Monne [Wed, 25 Jul 2012 16:39:18 +0000 (17:39 +0100)]
build: include Tools.mk first in tools/Rules.mk

Tools.mk should be included first, or PREFIX is not honoured in the
other conf/ files that define the paths of several tools.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix comment regarding bootloader disk lifetime
Ian Jackson [Wed, 25 Jul 2012 16:39:17 +0000 (17:39 +0100)]
libxl: fix comment regarding bootloader disk lifetime

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix transaction leak in logdirty error path
Ian Jackson [Wed, 25 Jul 2012 16:39:17 +0000 (17:39 +0100)]
libxl: fix transaction leak in logdirty error path

libxl__domain_suspend_common_switch_qemu_logdirty would leak t if
there was an error.  Fix this.

Also, document the intended usage for libxl__xs_transaction_* in the
doc comment in libxl_internal.h.

Reported-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agohotplug: network-bridge: fix for interfaces with no gateway
Ian Campbell [Wed, 25 Jul 2012 16:39:16 +0000 (17:39 +0100)]
hotplug: network-bridge: fix for interfaces with no gateway

This comes from an old Debian bug report
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=588477 which refers to
http://lists.xen.org/archives/html/xen-users/2010-06/msg00420.html.

Although we no longer have a trap in _claim_lock as described (this was removed
in 25590:bb250383a4f5 "hotplug/Linux: use flock based locking") and the use of
network-* scripts is discouraged (in favour of using distro provided
mechanisms) the general principal that relying on the semantics of /bin/sh's &&
is unwise seems sound.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agohotplug: fix ip_of for systems using a peer-to-peer link
Ian Campbell [Wed, 25 Jul 2012 16:39:15 +0000 (17:39 +0100)]
hotplug: fix ip_of for systems using a peer-to-peer link

This is from an old Debian bug at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=437127

I'm slightly inferring what the configuration which trigger this issue is, the
bug report says:

    This code however fails if no slash is present in the address, which is the
    case in my configuration:

    $ ip addr show dev eth0
    2: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
        link/ether 00:16:17:90:b4:35 brd ff:ff:ff:ff:ff:ff
        inet 88.198.12.XXX peer 88.198.12.XXX/32 brd 88.255.255.255 scope global eth0

I hope either Marc or Stefan can correct me if I have surmised wrongly what
this configuration represents.

This function is used in the vif-route configuration.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: refuse to try and migrate an HVM guest using qemu-xen
Ian Campbell [Wed, 25 Jul 2012 16:39:14 +0000 (17:39 +0100)]
libxl: refuse to try and migrate an HVM guest using qemu-xen

libxl/qemu-upstream currently do not collude together to enable log-dirty mode
and therefore migrations are unsafe. Refuse to even try for now.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86/EFI: define and use EFI_DIR make variable, defaulting to /usr/lib64/efi
Matt Wilson [Tue, 24 Jul 2012 15:02:04 +0000 (17:02 +0200)]
x86/EFI: define and use EFI_DIR make variable, defaulting to /usr/lib64/efi

After commit 25594:ad08cd8e7097, EFI Xen binaries were installed to
/efi instead of /usr/lib64/efi. This patch restores the previous
behaviour established in commit 23645:638f31a30b6c.

Signed-off-by: Matt Wilson <msw@amazon.com>
Reported-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Jan Beulich <jbeulich@suse.com>
12 years agolibxl: fix bug the number of running vcpu inconsistent with config file
Zhang, Yang Z [Tue, 24 Jul 2012 09:29:18 +0000 (10:29 +0100)]
libxl: fix bug the number of running vcpu inconsistent with config file

The following patch will fix the bug 1825. http://bugzilla.xen.org/bugzilla/show_bug.cgi?id=1825

When using memcpy to update vcpu_online, the high bits of vcpu_online
may unmodified if the size of avail_vcpus less than vcpu_online. So we
need to clear it before the memory copying.

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Acked-by: Ian Campbell <ian.campbelL@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agodocs: fix link in qemu-upstream doc
Ian Campbell [Tue, 24 Jul 2012 09:29:17 +0000 (10:29 +0100)]
docs: fix link in qemu-upstream doc

The current syntax created a link back to the source page rather than to the
wiki. I couldn't find the markdown syntax to make the link text be the link as
well, without repreating the URL, so I reworded it slightly.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix vif.ifname when used with stub device model.
Ian Campbell [Tue, 24 Jul 2012 09:29:17 +0000 (10:29 +0100)]
libxl: fix vif.ifname when used with stub device model.

Currently the same libxl_device_nic is used to create both the HVM domain and
its stub domain's NICs. This means that if a vifname is provided both the HVM
domains PV NIC and the stub domains PV NIC will get the same name and the
DM's NIC will fail to be attached.

Instead launder the libxl_device_nic to add the TAP_DEVICE_SUFFIX ("-emu").
This is a bit of a misnomer, since the device is actually PV, but it is used to
"back" the emulated device in the stub domain and this naming scheme is
consistent with the non-stub case and is known to work e.g. with our hotplug
scripts.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoautoconf: only check for dev86 and iasl checks on x86
Roger Pau Monne [Tue, 24 Jul 2012 08:35:44 +0000 (09:35 +0100)]
autoconf: only check for dev86 and iasl checks on x86

The previous patch (25331:dfe39bd65137) only touched the definition of the
variables used to refer to the paths to the tools but didn't remove the actual
checks.

Run autogen after applying this patch.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- added a comment about "build" vs "host" terminology and a note about
         the previous attempt to the changelog, reintroduce AC_CANONICAL_HOST
         which was remove by 25303:078c7d4cde1d after this patch was posted but
         is required for $host_cpu ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoautoconf: revert 25178:181478052ea2
Ian Campbell [Tue, 24 Jul 2012 08:35:44 +0000 (09:35 +0100)]
autoconf: revert 25178:181478052ea2

This change only removed the variables used to supply the path to the tool but
didn't remove the checks. Will be fixed properly in a subsequent patch.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoQEMU_TAG update
Ian Jackson [Mon, 23 Jul 2012 16:58:33 +0000 (17:58 +0100)]
QEMU_TAG update

12 years agoxen/arm: set paging_mode_translate and paging_mode_external
Stefano Stabellini [Mon, 23 Jul 2012 16:29:28 +0000 (17:29 +0100)]
xen/arm: set paging_mode_translate and paging_mode_external

On ARM, given the kind of guests we support, it makes sense to set
paging_mode_translate and paging_mode_external by default.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Initialize lr_queue in vcpu_vgic_init for the first 32 irqs
Stefano Stabellini [Mon, 23 Jul 2012 16:29:28 +0000 (17:29 +0100)]
xen/arm: Initialize lr_queue in vcpu_vgic_init for the first 32 irqs

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agohotplug: vif: fail if a duplicate vifname is used.
Ian Campbell [Mon, 23 Jul 2012 12:09:46 +0000 (13:09 +0100)]
hotplug: vif: fail if a duplicate vifname is used.

This is based on a patch from Hans van Kranenburg in
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=658305. Quoting that bug
report:

    When configurating a duplicate custom vifname for interfaces in the Xen
    dom0 that are added to a bridge (which is obviously a configuration error),
    the hotplug scripts fail silently to rename the new vifX.0 to
    the custom vifname, if it's already existing.

    The result of this, is that the domU will start normally, but no network
    traffic between domU and the dom0 bridge is possible, because the vifX.0
    never gets added to the bridge.

    Worse... when doing xm shutdown on the newly created domU, while
    investigating the issue, the interface of another running domU gets shut
    down, and remains hanging around in a DOWN state, because it cannot be
    removed (the other unrelated domU is still running, but succesfully made
    unavailable on the network!).

    When starting the new domU again, the interface of the other domU will
    be added to the bridge again, and while looking at the output of brctl
    show, tcpdump and ping, which make no sense, because everything will
    seem to be right, nagios will notify you of another host being down. :|

Note that libxl doesn't actually check the hotplug status yet, this changes
with Rogers hotplug script changes. xend correctly picks the failure up.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agopygrub: don't leave fds open
Roger Pau Monne [Mon, 23 Jul 2012 12:09:45 +0000 (13:09 +0100)]
pygrub: don't leave fds open

On NetBSD a block device can only be opened once, so make sure pygrub
closes it every time, if this is not done libfsimage is not able to
open the disk later.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxenstore: don't print an error when gntdev cannot be opened
Roger Pau Monne [Mon, 23 Jul 2012 12:09:44 +0000 (13:09 +0100)]
xenstore: don't print an error when gntdev cannot be opened

NetBSD doesn't have a gntdev, but we should not print an error when
falling back to the previous implementation.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: rename stubdomain when renaming domain.
Ian Campbell [Mon, 23 Jul 2012 12:09:43 +0000 (13:09 +0100)]
libxl: rename stubdomain when renaming domain.

Otherwise after a localhost migrate of an HVM domain with a stubdomain we end
up with domains called "FOO" and "FOO--incoming-dm". This because we initially
create the domains as "FOO--incoming" and then rename to "FOO" inorder to
maintain the uniqueness of domain names on a host.

In this state a second attempt to migrate will fail upon attempting to create
a new domain named "FOO--incoming-dm"

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: move bootloader data strucutres and prototypes
Roger Pau Monne [Mon, 23 Jul 2012 12:09:42 +0000 (13:09 +0100)]
libxl: move bootloader data strucutres and prototypes

Move bootloader and related data after all the device stuff, since
libxl__bootloader_state will depend on libxl__ao_device (to perform
the local attach of a device).

This is pure code motion.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: convert libxl_domain_destroy to an async op
Roger Pau Monne [Mon, 23 Jul 2012 12:09:42 +0000 (13:09 +0100)]
libxl: convert libxl_domain_destroy to an async op

This change introduces some new structures, and breaks the mutual
dependency that libxl_domain_destroy and libxl__destroy_device_model
had. This is done by checking if the domid passed to
libxl_domain_destroy has a stubdom, and then having the bulk of the
destroy machinery in a separate function (libxl__destroy_domid) that
doesn't check for stubdom presence, since we check for it in the upper
level function. The reason behind this change is the need to use
structures for ao operations, and it was impossible to have two
different self-referencing structs.

All uses of libxl_domain_destroy have been changed, and either
replaced by the new libxl_domain_destroy ao function or by the
internal libxl__domain_destroy that can be used inside an already
running ao.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: move device model creation prototypes
Roger Pau Monne [Mon, 23 Jul 2012 12:09:41 +0000 (13:09 +0100)]
libxl: move device model creation prototypes

Move prototypes regarding device model creation, since they will
depend on domain destruction in future patches.

This patch is pure code motion.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: change ao_device_remove to ao_device
Roger Pau Monne [Mon, 23 Jul 2012 12:09:40 +0000 (13:09 +0100)]
libxl: change ao_device_remove to ao_device

Introduce a new structure to track state of device backends, that will
be used in following patches on this series.

This structure if used for both device creation and device
destruction and removes libxl__ao_device_remove.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>