]> xenbits.xensource.com Git - xen.git/log
xen.git
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>
12 years agolibxl: check backend state before setting it to "closing"
Roger Pau Monne [Mon, 23 Jul 2012 12:09:39 +0000 (13:09 +0100)]
libxl: check backend state before setting it to "closing"

Check backend state before unconditionally setting it to "closing"
(5), since it might already be in "closed" (6).

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 agolibxc: restore: bounds check for start_info.{store_mfn,console.domU.mfn}
Ian Campbell [Mon, 23 Jul 2012 12:09:38 +0000 (13:09 +0100)]
libxc: restore: bounds check for start_info.{store_mfn,console.domU.mfn}

These fields are canonicalised by the guest on suspend and therefore must be
valid pfns during restore.

Reported-by: Jonathan Ludlam <Jonathan.Ludlam@eu.citrix.com>
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 agoxl: remove stray timer mode debug print
Ian Campbell [Mon, 23 Jul 2012 12:09:37 +0000 (13:09 +0100)]
xl: remove stray timer mode debug print

Reported-by: Andre Przywara <andre.przywara@amd.com>
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: do not blunder on if bootloader fails
Ian Jackson [Mon, 23 Jul 2012 12:09:36 +0000 (13:09 +0100)]
libxl: do not blunder on if bootloader fails

If the bootloader failed, we would call the creation failure callback
but _also_ blunder on trying to recreate the domain, due to a missing
"return".

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reported-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 agodocs/cmdline: Add some more entries
Andrew Cooper [Sun, 22 Jul 2012 15:37:25 +0000 (16:37 +0100)]
docs/cmdline: Add some more entries

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agodocs/cmdline: Remove ia64 specific arguments
Andrew Cooper [Sun, 22 Jul 2012 15:36:59 +0000 (16:36 +0100)]
docs/cmdline: Remove ia64 specific arguments

grep claims that all of these command line arguments no longer exist
in the xen source tree.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agodocs/cmdline: Tweak some markdown formatting
Andrew Cooper [Sun, 22 Jul 2012 15:36:30 +0000 (16:36 +0100)]
docs/cmdline: Tweak some markdown formatting

Some for readability, and some to escape underscores.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agox86/numa: Remove warning about small NUMA nodes
Andrew Cooper [Thu, 19 Jul 2012 14:47:28 +0000 (15:47 +0100)]
x86/numa: Remove warning about small NUMA nodes

This logic came with the other NUMA logic from Linux 2.6.16 in c/s
11893:f312c2d01d8b.  It appears that the Xen memory management
subsystem does not suffer from the expressed problems.  Furthermore,
NUMA nodes with no memory are now quite easy to find, and are not BIOS
bugs in the SRAT ACPI table.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agox86/numa: Correct assumption that each NUMA node has memory
Andrew Cooper [Thu, 19 Jul 2012 14:46:51 +0000 (15:46 +0100)]
x86/numa: Correct assumption that each NUMA node has memory

It is now quite easy to buy servers with incorrectly populated DIMMs,
especially with AMD Magny-Cours and Interlagos systems which have two
NUMA nodes per socket.

Currently, Xen will assign all CPUs on nodes without memory to node 0,
which leads to interestingly wrong NUMA information, causing numa
aware functionality such as alloc_domheap_pages() to get things very
wrong.

This patch splits the current logic to accept NUMA nodes without
memory, which corrects the accounting of CPUs to online NUMA nodes.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agovt-d: fix wrong addr in IOTLB invalidation descriptor
Yang Zhang [Thu, 19 Jul 2012 14:46:02 +0000 (15:46 +0100)]
vt-d: fix wrong addr in IOTLB invalidation descriptor

According to vt-d specs, the addr in IOTLB invalidation descriptor
should be 4K page aligned.

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agoXen/MCE: stick all 1's to MCi_CTL of vMCE
Liu, Jinsong [Thu, 19 Jul 2012 14:45:22 +0000 (15:45 +0100)]
Xen/MCE: stick all 1's to MCi_CTL of vMCE

This patch is a middle-work patch, prepare for future new vMCE model.
It remove mci_ctl array, and keep MCi_CTL all 1's.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agonestedhvm: initialize pfec for l1 pagetable walk
Christoph Egger [Thu, 19 Jul 2012 10:15:58 +0000 (11:15 +0100)]
nestedhvm: initialize pfec for l1 pagetable walk

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 agox86/mm/p2m: use NX bit in p2m entries.
Christoph Egger [Thu, 19 Jul 2012 10:09:39 +0000 (11:09 +0100)]
x86/mm/p2m: use NX bit in p2m entries.

In p2m_type_to_flags() honor _PAGE_NX_BIT for grant type mappings.
This brings this code in line with PV and EPT.

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/arm: disable the event optimization in the gic
Stefano Stabellini [Tue, 17 Jul 2012 16:33:31 +0000 (17:33 +0100)]
xen/arm: disable the event optimization in the gic

Currently we have an optimization in the GIC driver that allows us not
to request maintenance interrupts for Xen events. The basic idea is that
every time we are about to inject a new interrupt or event into a guest,
we check whether we can remove some old event irqs from one or more LRs.
We can do this because we know when a guest finishes processing event
notifications: it sets the evtchn_upcall_pending bit to 0.

However it is unsafe: the guest resets evtchn_upcall_pending before
EOI'ing the event irq, therefore a small window of time exists when Xen
could jump in and remove the event irq from the LR register before the
guest has EOI'ed it.

This is not a good practice according to the GIC manual.
Remove the optimization for now.

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 agoxen/arm: gic and vgic fixes
Stefano Stabellini [Tue, 17 Jul 2012 16:33:30 +0000 (17:33 +0100)]
xen/arm: gic and vgic fixes

- the last argument of find_next_bit is the maximum number of bits, not
the maximum number of bytes;

- use list_for_each_entry_safe instead of list_for_each_entry in
gic_restore_pending_irqs because we are actually deleting entries in the
loop.

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: implement do_hvm_op for ARM
Stefano Stabellini [Tue, 17 Jul 2012 16:33:29 +0000 (17:33 +0100)]
xen/arm: implement do_hvm_op for ARM

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 agoarm/vgic: initialize pending_irqs.lr_queue
Stefano Stabellini [Tue, 17 Jul 2012 16:22:07 +0000 (17:22 +0100)]
arm/vgic: initialize pending_irqs.lr_queue

Properly initialize all the pending_irqs.lr_queue like we do for
inflight.
Check whether we already have the irq in lr_queue before adding it.

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 agoarm/vgic: vgic: support irq enable/disable
Stefano Stabellini [Tue, 17 Jul 2012 16:22:06 +0000 (17:22 +0100)]
arm/vgic: vgic: support irq enable/disable

If vgic_vcpu_inject_irq is called (for example by a device emulator like
vtimer.c) but the corresponding irq is not enabled in the virtual gicd
just queue it in the inflight_irqs list.

When the irq is enabled make sure to call gic_set_guest_irq.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm/gic: support injecting IRQs even to VCPUs not currently running
Stefano Stabellini [Tue, 17 Jul 2012 16:22:05 +0000 (17:22 +0100)]
arm/gic: support injecting IRQs even to VCPUs not currently running

The lr_pending list belongs to the vgic rather than the gic, so move it
there.

gic_set_guest_irq should take into account whether the vcpu is currently
running and if it is not it should add the irq to the right lr_pending
list.

When restoring the gic state we need to go through the lr_pending list
because it is possible that some irqs have been "injected" while the
vcpu wasn't running.

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 agoarm/gic: fix gic context switch
Stefano Stabellini [Tue, 17 Jul 2012 16:22:04 +0000 (17:22 +0100)]
arm/gic: fix gic context switch

gic_save/restore_state should also save and restore lr_mask and
event_mask too.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm/vtimer: do not let the guest interact with the physical timer
Stefano Stabellini [Tue, 17 Jul 2012 16:22:04 +0000 (17:22 +0100)]
arm/vtimer: do not let the guest interact with the physical timer

The guest can read the physical counter but it shouldn't be able to
cause interrupts of the physical timer to go to the hypervisor.
Trap physical timer reads/writes in vtimer.c instead.

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 agoxsm/flask: avoid struct page lookup in mmu_normal_update
Daniel De Graaf [Mon, 9 Jul 2012 09:10:27 +0000 (10:10 +0100)]
xsm/flask: avoid struct page lookup in mmu_normal_update

Since the mmu_normal_update hook is called even when mapping MFNs
without an associated struct page, attempting to use the struct page
to map between GFN and MFN will cause crashes. Use get_gfn_query
instead.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
12 years agoxsm/flask: fix memory AVC formatting
Daniel De Graaf [Mon, 9 Jul 2012 09:09:44 +0000 (10:09 +0100)]
xsm/flask: fix memory AVC formatting

A space was missing in the format string.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
12 years agonestedsvm: fix DRn handling
Christoph Egger [Mon, 9 Jul 2012 09:09:03 +0000 (10:09 +0100)]
nestedsvm: fix DRn handling

Always use l1 vmcb to handle DRn access. This avoids to interfere
with l1 hypervisor's DRn handling when it doesn't intercept DRn.
Fixes Hyper-V hang.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agolibxl: explicitly check for libmath in autoconf
Dario Faggioli [Fri, 6 Jul 2012 12:17:45 +0000 (13:17 +0100)]
libxl: explicitly check for libmath in autoconf

As well as explicitly add -lm to libxl's Makefile.

This is because next patch uses floating point arithmetic, and
it is better to state it clearly that we need libmath (just in
case we find a libc  that wants that to be explicitly enforced).

Notice that autoconf should be rerun after applying this change.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- s/libmath/libm/ in error message ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: introduce some node map helpers
Dario Faggioli [Fri, 6 Jul 2012 12:17:44 +0000 (13:17 +0100)]
libxl: introduce some node map helpers

To allow for allocating a node specific libxl_bitmap (as it
is for cpu number and maps). Helper unctions to convert a node
map it its coresponding cpu map and vice versa are also
implemented.

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: expand the libxl_bitmap API a bit
Dario Faggioli [Fri, 6 Jul 2012 12:17:43 +0000 (13:17 +0100)]
libxl: expand the libxl_bitmap API a bit

By adding copying and *_is_full/*_is_empty facilities.

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: rename libxl_cpumap to libxl_bitmap
Dario Faggioli [Fri, 6 Jul 2012 12:17:42 +0000 (13:17 +0100)]
libxl: rename libxl_cpumap to libxl_bitmap

And leave to the caller the burden of knowing and remembering what kind
of bitmap each instance of libxl_bitmap is.

This is basically just some s/libxl_cpumap/libxl_bitmap/ (and some other
related interface name substitution, e.g., libxl_for_each_cpu) in a bunch
of files, with no real functional change involved.

A specific allocation helper is introduced, besides libxl_bitmap_alloc().
It is called libxl_cpu_bitmap_alloc() and is meant at substituting the old
libxl_cpumap_alloc(). It is just something easier to use in cases where one
wants to allocate a libxl_bitmap that is going to serve as a cpu map.

This is because we want to be able to deal with both cpu and NUMA node
maps, but we don't want to duplicate all the various helpers and wrappers.

While at it, add the usual initialization function, common to all libxl
data structures.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.eu.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: add more NUMA information to `xl info -n'
Dario Faggioli [Fri, 6 Jul 2012 12:17:42 +0000 (13:17 +0100)]
xl: add more NUMA information to `xl info -n'

So that the user knows how much memory there is on each node and
how far they are from each others.

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,libxc: introduce libxl_get_numainfo()
Dario Faggioli [Fri, 6 Jul 2012 12:17:41 +0000 (13:17 +0100)]
libxl,libxc: introduce libxl_get_numainfo()

Make some NUMA node information available to the toolstack. Achieve
this by means of xc_numainfo(), which exposes memory size and amount
of free memory of each node, as well as the relative distances of
each node to all the others.

For properly exposing distances we need the IDL to support arrays.

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: add a new Array type to the IDL
Ian Campbell [Fri, 6 Jul 2012 12:17:40 +0000 (13:17 +0100)]
libxl: add a new Array type to the IDL

And make all the required infrastructure updates to enable this.

Since there are currently no uses of this type there is no change to
the generated code.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agohotplug/Linux: do not leak lockfiles
Ian Jackson [Thu, 5 Jul 2012 11:40:25 +0000 (12:40 +0100)]
hotplug/Linux: do not leak lockfiles

25590:bb250383a4f5 introduced a new locking scheme.  Unfortunately it
leaves behind files in /var/run/xen-hotplug.  These are spotted as
regressions by the autotester.

Fix this.  This involves changing the locking protocol to allow
lockfiles to be deleted (as removing lockfiles is unsafe with a naive
flock-based algorithm).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agotools: honour --libdir when it is passed to ./configure
Matt Wilson [Thu, 5 Jul 2012 10:00:28 +0000 (11:00 +0100)]
tools: honour --libdir when it is passed to ./configure

Currently shared libraries are automatically installed into /usr/lib
or /usr/lib64, depending on the supplied --prefix value and
$(XEN_TARGET_ARCH). Some systems, like recent Debian and Ubuntu releases,
do not use /usr/lib64, but instead /usr/lib/x86_64-linux-gnu.

With this change, packagers can supply the desired location for shared
libraries on the ./configure command line. Packagers need to note that
the default behaviour on 64-bit Linux systems will be to install shared
libraries in /usr/lib, not /usr/lib64, unless a --libdir value is provided
to ./configure.

Additionally, the libfsimage plugins are now loaded explicitly from
$LIBDIR/fs, removing platform-based decision trees in code.

Signed-off-by: Matt Wilson <msw@amazon.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- resolve rejects in configure by rerunning autogen.sh. Dropped changes
to remove m4/default_lib.m4 and update m4/pkg.m4 since they cause LIBDIR=/lib
instead of /usr/lib. Reran ./autogen.sh after that too ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agotools/m4: add AC_LANG_SOURCE to fix autoconf warnings
Olaf Hering [Wed, 4 Jul 2012 14:46:17 +0000 (15:46 +0100)]
tools/m4: add AC_LANG_SOURCE to fix autoconf warnings

I see these warnings with autoconf 2.68, add AC_LANG_SOURCE as suggested
by upstream documentation.

...
 # bash autogen.sh
configure.ac:141: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
../../lib/autoconf/lang.m4:194: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2662: _AC_LINK_IFELSE is expanded from...
../../lib/autoconf/general.m4:2679: AC_LINK_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
../../lib/autoconf/general.m4:2032: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2053: AC_CACHE_CHECK is expanded from...
m4/pthread.m4:21: AX_CHECK_PTHREAD is expanded from...
configure.ac:141: the top level
configure.ac:142: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
../../lib/autoconf/lang.m4:194: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2662: _AC_LINK_IFELSE is expanded from...
../../lib/autoconf/general.m4:2679: AC_LINK_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
../../lib/autoconf/general.m4:2032: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2053: AC_CACHE_CHECK is expanded from...
m4/ptyfuncs.m4:1: AX_CHECK_PTYFUNCS is expanded from...
configure.ac:142: the top level
configure.ac:141: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
../../lib/autoconf/lang.m4:194: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2662: _AC_LINK_IFELSE is expanded from...
../../lib/autoconf/general.m4:2679: AC_LINK_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
../../lib/autoconf/general.m4:2032: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2053: AC_CACHE_CHECK is expanded from...
m4/pthread.m4:21: AX_CHECK_PTHREAD is expanded from...
configure.ac:141: the top level
configure.ac:142: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
../../lib/autoconf/lang.m4:194: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2662: _AC_LINK_IFELSE is expanded from...
../../lib/autoconf/general.m4:2679: AC_LINK_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
../../lib/autoconf/general.m4:2032: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2053: AC_CACHE_CHECK is expanded from...
m4/ptyfuncs.m4:1: AX_CHECK_PTYFUNCS is expanded from...
configure.ac:142: the top level

Please rerun autoconf after applying this.

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 agotools/configure.ac: add version check for glib2
Olaf Hering [Wed, 4 Jul 2012 14:46:16 +0000 (15:46 +0100)]
tools/configure.ac: add version check for glib2

xen-unstable fails to build in a SLES10SP4 environment since a long time
because the included version of glib is slightly older than the required
glib version. According to the glib docs version 2.12 includes base64
support, but SLES10 is shipped with glib 2.8.6:

qemu-timer-common.o: In function `init_get_clock':
/usr/src/packages/BUILD/xen-4.2.25432/non-dbg/tools/qemu-xen-dir/qemu-timer-common.c:57:
undefined reference to `clock_gettime'
qga/guest-agent-commands.o: In function `qmp_guest_file_write':
qga/guest-agent-commands.c:249: undefined reference to `g_base64_decode'
qga/guest-agent-commands.o: In function `qmp_guest_file_read':
qga/guest-agent-commands.c:224: undefined reference to `g_base64_encode'
collect2: ld returned 1 exit status
make[3]: *** [qemu-ga] Error 1

Add a version check to toplevel configure to require at least glib 2.12.
This makes sure configure can detect the condition early instead of
failing later in the middle of tools build when qemu-upstream errors
out.

Please rerun autoconf after applying this.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: Allow use of /dev/null with xl create to enable command-line definition
W. Michael Petullo [Wed, 4 Jul 2012 14:46:15 +0000 (15:46 +0100)]
xl: Allow use of /dev/null with xl create to enable command-line definition

xm allows specifying /dev/null as the domain configuration argument to its
create option; add same functionality to xl. xl treats the configuration
argument /dev/null as a special case.  This allows specifying an entire
domain configuration on the command line.

Signed-off-by: W. Michael Petullo <mike@flyn.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- ported to xen-unstable from 4.1 ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agohotplug/Linux: use flock based locking
Zhigang Wang [Wed, 4 Jul 2012 14:46:14 +0000 (15:46 +0100)]
hotplug/Linux: use flock based locking

In the normal case of a single domain booting with one disk, the disk hotplug
script will fire once. In this case taking out the lock will never cause a
sleep because there's no other concurrent invocations. If a domain has 4 disks
configured, then the hotplug script will fire 4 times, all 4 invocations at
pretty much the same time. If there is even a little load on the system, the
locking function in the shell script will sleep for a few seconds - as many as
5 seconds, or potentially even time out & fail completely.

If say 4 or even more domains each with 4 disks start up at once, that's 16
invocations of the hotplug script running at once. There will be a lot of
sleep's done & because of the very coarse 1 second granularity the delay can
add up significantly.

The change to using flock() removes the arbitrary 1 second sleep, so the very
instant once hotplug script finishes, another can start & there is no repeated
attempts & failures to lock which would add more delay.

In addition the current locking implementation would allow two processes get
the lock simultaneously if one decided the other had timed out.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agopygrub: cope better with big files in the guest.
M A Young [Wed, 4 Jul 2012 14:46:14 +0000 (15:46 +0100)]
pygrub: cope better with big files in the guest.

Only read the first megabyte of a configuration file (grub etc.) and read the
kernel and ramdisk files from the guest in one megabyte pieces so pygrub
doesn't use a lot of memory if the files are large.  With --not-really option
check that the chosen kernel and ramdisk files exist.  If there are problems
writing the copy of the kernel or ramdisk, delete the copied files and exit in
case they have filled the filesystem.

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Matt Wilson <msw@amazon.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 agoxen: event channel remapping for emulated MSIs
Stefano Stabellini [Tue, 3 Jul 2012 12:39:01 +0000 (13:39 +0100)]
xen: event channel remapping for emulated MSIs

Linux PV on HVM guests remap all the MSIs onto event channels,
including MSIs corresponding to QEMU's emulated devices.  This patch
makes sure that we handle correctly the case of emulated MSI that have
been remapped, sending a pirq to the guest instead.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Deep Debroy <ddebroy@gmail.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agoxen: Fix off-by-one error when parsing command line arguments
Andrew Cooper [Tue, 3 Jul 2012 12:38:19 +0000 (13:38 +0100)]
xen: Fix off-by-one error when parsing command line arguments

As Xen currently stands, it will attempt to interpret the first few
bytes of the initcall section as a struct kernel_param.

The reason that this not caused problems is because in the overflow
case, param->name is actually a function pointer to the first
initcall, and intepreting it as string is very unlikely to match an
ASCII command line parameter name.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agoxen: add assertion in default_vcpu0_location to protect against broken masks
Ian Campbell [Tue, 3 Jul 2012 09:52:33 +0000 (10:52 +0100)]
xen: add assertion in default_vcpu0_location to protect against broken masks

When setting up the cpu sibling/etc masks on ARM I accidentally and
incorrectly omitted a CPU from it's own sibling mask which caused this
function to return an invalid cpu number which caused errors later when we
tried to access per_cpu data for that invalid cpu.

Add an assert to catch this in the future.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: fix typo s/approprately/appropriately/g
Ian Campbell [Tue, 3 Jul 2012 09:52:32 +0000 (10:52 +0100)]
arm: fix typo s/approprately/appropriately/g

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 agoarm: move PSR flag definitions into interface, for tools use.
Ian Campbell [Tue, 3 Jul 2012 09:52:31 +0000 (10:52 +0100)]
arm: move PSR flag definitions into interface, for tools use.

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 agoarm: unwind allocations etc on arch_domain_create_failure
Ian Campbell [Tue, 3 Jul 2012 09:52:30 +0000 (10:52 +0100)]
arm: unwind allocations etc on arch_domain_create_failure

This involves adding the necessary teardown/free functions for some modules.

Don't initialise full arch domain state for the idle domain, it's not needed.

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 agoarm: the hyp timer seems to work in newer model versions, default to using it.
Ian Campbell [Tue, 3 Jul 2012 09:52:29 +0000 (10:52 +0100)]
arm: the hyp timer seems to work in newer model versions, default to using it.

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 agoarm: context switch virtual timer registers
Ian Campbell [Tue, 3 Jul 2012 09:52:29 +0000 (10:52 +0100)]
arm: context switch virtual timer registers

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 agoarm: gic.lock can be taken in interrupt context, so lock appropriately.
Ian Campbell [Tue, 3 Jul 2012 09:52:28 +0000 (10:52 +0100)]
arm: gic.lock can be taken in interrupt context, so lock appropriately.

In particular it is taken by gic_set_guest_irq which is called by
vgic_vcpu_inject_irq

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 agoarm: Upgrade guest barriers to Outer-Shareable. Enable Protected Table Walk.
Ian Campbell [Tue, 3 Jul 2012 09:52:27 +0000 (10:52 +0100)]
arm: Upgrade guest barriers to Outer-Shareable. Enable Protected Table Walk.

Upgrading barriers is conservative and may not be necessary.

Protected Table Walk traps stage 1 page tables which refer to device memory
(per stage 2) using a non-device mapping. This generally indicates a guest
error but trapping it as a fault for now helps us know if something odd is
going on.

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 agoarm: enable data-cache at the same time as enabling the MMU, not before
Ian Campbell [Tue, 3 Jul 2012 09:52:26 +0000 (10:52 +0100)]
arm: enable data-cache at the same time as enabling the MMU, not before

With enough warnings enabled the model seemed to be complaining that pages
cached before paging was enabled had been mapped with to inconsistent sets of
attributes. I'm not convinced that isn't a model issue, nor am I convinced
this has really fixed anything, but it seems sensible enough.

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 agoarm: map GICV in all domains, not just dom0.
Ian Campbell [Tue, 3 Jul 2012 09:52:25 +0000 (10:52 +0100)]
arm: map GICV in all domains, not just dom0.

This requires that we allocate all p2m pages from domheap without a particular
dom because max pages is not setup yet so there is no allocation available to
us.

At some point we should create a separate p2m allocation (similar to x86's shadow allocation) and use that.

Also we seem to have been calling p2m_alloc_table twice for dom0.

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: make vgic lock safe for use in interrupt context.
Ian Campbell [Tue, 3 Jul 2012 09:52:25 +0000 (10:52 +0100)]
arm: make vgic lock safe for use in interrupt context.

In particular vgic_vcpu_inject_irq can be called in both interrupt and regular
context.

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: split pending SPIs (global) out from pending PPIs and SGIs (per CPU)
Ian Campbell [Tue, 3 Jul 2012 09:52:24 +0000 (10:52 +0100)]
arm: split pending SPIs (global) out from pending PPIs and SGIs (per CPU)

This tracks SPIs in struct arch_domain and PPIs+SGIs in struct arch_vcpu which
seems more logical.

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: use correct attributes for mappings in copy_from_paddr()
Ian Campbell [Tue, 3 Jul 2012 09:52:23 +0000 (10:52 +0100)]
arm: use correct attributes for mappings in copy_from_paddr()

The DTB is in RAM (hence bufferable), kernel is in flash and therefor requires
a device type mapping (hence dev shared).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: implement vcpu_show_execution_state
Ian Campbell [Tue, 3 Jul 2012 09:52:22 +0000 (10:52 +0100)]
arm: implement vcpu_show_execution_state

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>