xen.git
14 years agohvmloader: Don't set hpet->header.length twice
Andrew Cooper [Fri, 14 Oct 2011 17:10:46 +0000 (18:10 +0100)]
hvmloader: Don't set hpet->header.length twice

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
14 years agoReturn -EINVAL when trying to kick/kill a nonexistent domain watchdog
Keir Fraser [Fri, 14 Oct 2011 17:08:04 +0000 (18:08 +0100)]
Return -EINVAL when trying to kick/kill a nonexistent domain watchdog

... to be more in-line with the NR_DOMAIN_WATCHDOG_TIMERS check at the
top of domain_watchdog(), and also to follow the
timer_(delete|settime)
POSIX API's EINVAL return value.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Also, replace EEXIST with ENOSPC when failing to allocate a new
domain watchdog.

Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
14 years agox86/MSI: drop local cpumask_t variable from msi_compose_msg()
Jan Beulich [Fri, 14 Oct 2011 12:34:15 +0000 (14:34 +0200)]
x86/MSI: drop local cpumask_t variable from msi_compose_msg()

The function gets called only during initialization/resume (when no
other CPUs are running) or with the IRQ descriptor lock held, so
there's no way for the CPU mask to change under its feet.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agop2m: use xzalloc() for struct p2m_domain allocation
Jan Beulich [Fri, 14 Oct 2011 10:27:15 +0000 (12:27 +0200)]
p2m: use xzalloc() for struct p2m_domain allocation

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
14 years agox86: clean up physid_mask_t handling
Jan Beulich [Fri, 14 Oct 2011 10:26:20 +0000 (12:26 +0200)]
x86: clean up physid_mask_t handling

This eliminates passing and returning by value of this type (making it
unnecessary for the compiler to create temporary variables for doing so
on the stack), thus dramatically reducing the stack frame sizes of a
couple of functions (was in one case over 12k for a 4095-CPU build).

In one case a local variable gets converted to a static one, possible
because the function gets called at most once (during early boot).

Some accessors get eliminated altogether as being unused or as being
equally well open coded at the place of use.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agox86: remove dead member from struct _cpuid4_info
Jan Beulich [Fri, 14 Oct 2011 08:17:22 +0000 (10:17 +0200)]
x86: remove dead member from struct _cpuid4_info

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agorcu: move private declarations and definitions from header to implementation
Jan Beulich [Fri, 14 Oct 2011 08:16:39 +0000 (10:16 +0200)]
rcu: move private declarations and definitions from header to implementation

No consumer of RCU should need to see these, and there's also no need
to clutter the global name space with them.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agocpufreq: error path fixes
Jan Beulich [Fri, 14 Oct 2011 08:15:54 +0000 (10:15 +0200)]
cpufreq: error path fixes

This fixes an actual bug (failure to exit from a function after an
allocation failure), an inconsistency (not removing the cpufreq_dom
list member upon failure), and a latent bug (not clearing the current
governor upon governor initialization failure when there was no old
one; latent because the only current code path leading to this
situation frees the policy upon failure and hence the governor not
getting cleared is benign).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agox86: Simplify smpboot_alloc by merging x86-{32,64} code as far as
Keir Fraser [Thu, 13 Oct 2011 14:59:22 +0000 (15:59 +0100)]
x86: Simplify smpboot_alloc by merging x86-{32,64} code as far as
possible.

We still need one ifdef, as x86-32 does not have a compat_gdt_table.

On x86-32 there is 1/2-page wastage due to allocating a whole page for
the per-CPU IDT, however we expect very few users of the x86-32
hypervisor. Those that cannot move to the 64-bit hypervisor are likely
using old single-processor systems or new single-procesor netbooks. On
UP and small MP systems, the wastage is insignificant.

Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
14 years agox86: Further fixes for xsave leaf in pv_cpuid().
Shan Haitao [Thu, 13 Oct 2011 14:58:55 +0000 (15:58 +0100)]
x86: Further fixes for xsave leaf in pv_cpuid().

Signed-off-by: Shan Haitao <haitao.shan@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
14 years agonestedsvm: fix checks of guest writes to HSAVE_PA MSR
Christoph Egger [Thu, 13 Oct 2011 11:21:10 +0000 (12:21 +0100)]
nestedsvm: fix checks of guest writes to HSAVE_PA MSR

Accessing HSAVE_PA MSR does not require SVM to be enabled nor any
special guest paging mode.
But accessing HSAVE_PA MSR requires the address to be 4k aligned.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
14 years agoxenpaging: handle evict failures
Olaf Hering [Thu, 13 Oct 2011 11:21:10 +0000 (12:21 +0100)]
xenpaging: handle evict failures

Evict of a nominated gfn must fail if some other process mapped the
page without checking the p2mt of that gfn first.
Add a check to cancel eviction if the page usage count is not 1.

Handle the possible eviction failure in the page-in paths.
After nominate and before evict, something may check the p2mt and call
populate. Handle this case and let the gfn enter the page-in path. The
gfn may still be connected to a mfn, so there is no need to allocate a
new page in prep.

Adjust do_mmu_update to return -ENOENT only if the gfn has entered the
page-in path and if it is not yet connected to a mfn. Otherwise
linux_privcmd_map_foreign_bulk() may loop forever.

Add MEM_EVENT_FLAG_EVICT_FAIL to inform pager that a page-in request for
a possible not-evicted page was sent. xenpaging does currently not need
that flag because failure to evict a gfn will be caught.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
14 years agoVMX: extend last branch MSR info to cover newer CPU models
Jan Beulich [Thu, 13 Oct 2011 08:09:28 +0000 (10:09 +0200)]
VMX: extend last branch MSR info to cover newer CPU models

There are still a couple of family 6 models missing here: 37, 44, 46,
and 47 (according to SDM doc changes May 2011); presumably they would
all go into the Nehalem/Sandy Bridge group. Intel?

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Haitao Shan <maillists.shan@gmail.com>
14 years agoxmalloc: return unused full pages on multi-page allocations
Jan Beulich [Thu, 13 Oct 2011 08:03:43 +0000 (10:03 +0200)]
xmalloc: return unused full pages on multi-page allocations

Certain (boot time) allocations are relatively large (particularly when
building with high NR_CPUS), but can also happen to be pretty far away
from a power-of-two size. Utilize the page allocator's (other than
Linux'es) capability of allowing to return space from higher-order
allocations in smaller pieces to return the unused parts immediately.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agox86-64: don't use xmalloc_array() for allocation of the (per-CPU) IDTs
Jan Beulich [Thu, 13 Oct 2011 08:02:34 +0000 (10:02 +0200)]
x86-64: don't use xmalloc_array() for allocation of the (per-CPU) IDTs

The IDTs being exactly a page in size, using xmalloc() here is rather
inefficient, as this requires double the amount to be allocated (with
almost an entire page wasted). For hot plugged CPUs, this at once
eliminates one more non-order-zero runtime allocation.

For x86-32, however, the IDT is exactly half a page, so allocating a
full page seems wasteful here, so it continues to use xmalloc() as
before.

With most of the affected functions' bodies now being inside #ifdef-s,
it might be reasonable to split those parts out into subarch-specific
code...

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agoconstify vcpu_set_affinity()'s second parameter
Jan Beulich [Thu, 13 Oct 2011 08:00:13 +0000 (10:00 +0200)]
constify vcpu_set_affinity()'s second parameter

None of the callers actually make use of the function's returning of
the old affinity through its second parameter, and eliminating this
capability allows some callers to no longer use a local variable here,
reducing their stack footprint significantly when building with large
NR_CPUS.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agoRevert part of 23811:f1349a968a5a "ns16550: Simplify UART..."
Keir Fraser [Wed, 12 Oct 2011 16:11:28 +0000 (17:11 +0100)]
Revert part of 23811:f1349a968a5a "ns16550: Simplify UART..."

The change to poll LSR.THRE in a loop from __ns16550_poll is a bug.
We can loop indefinitely if there are no chars to transmit.

Thanks to Jan for spotting it.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agolibxl: fixup incorrect indentation
Ian Campbell [Wed, 12 Oct 2011 15:21:32 +0000 (16:21 +0100)]
libxl: fixup incorrect indentation

Several places which were previsously indented using hard tabs are now
incorrectly indented. Fix them up.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: fixup incorrect indentation
Ian Campbell [Tue, 11 Oct 2011 13:34:07 +0000 (14:34 +0100)]
libxl: fixup incorrect indentation

Several places which were previsously indented using hard tabs are now
incorrectly indented. Fix them up.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: expand hard tab stops
Ian Campbell [Tue, 11 Oct 2011 13:26:00 +0000 (14:26 +0100)]
libxl: expand hard tab stops

I ran the following and committed the result. ^I is an actual hard tab

for i in $(grep -l --exclude=*_[ly].\[ch\] '^I' tools/libxl/*.[ch]) ; do
     cat $i | expand | sponge $i
done

There are some actually wrong indentations too, I'll fix those up
manually.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agopygrub: add debug flag
Guido Gunther [Tue, 11 Oct 2011 11:02:58 +0000 (12:02 +0100)]
pygrub: add debug flag

Debugging config file errors is tedious so help a bit by not silently
dropping parsing exceptions when --debug is given. Also intialize the
logging API at debug level in this case.

Signed-off-by: Guido Gunther <agx@sigxcpu.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoxenpaging: clear page content after evict
Olaf Hering [Tue, 11 Oct 2011 09:46:28 +0000 (10:46 +0100)]
xenpaging: clear page content after evict

If the guest happens to read from the gfn while xenpaging is in the process of
evicting the page, the guest may read zeros instead of actual data.
Also if eviction fails the page content will be corrupted and xenpaging wont
attempt to restore the page.

Remove page scrubbing from pager and do it after successful eviction.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
14 years agotools/check: check for yajl (needed by libxl)
Ian Campbell [Mon, 10 Oct 2011 15:49:48 +0000 (16:49 +0100)]
tools/check: check for yajl (needed by libxl)

We need precisely version 1 so check for .so.1. In the future we should handle
yajl v2 as well.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agotools/ocaml: Small improvement to the ocaml xenctrl library
Jon Ludlam [Mon, 10 Oct 2011 15:41:17 +0000 (16:41 +0100)]
tools/ocaml: Small improvement to the ocaml xenctrl library

Add a new field 'max_nr_cpus' to the physinfo type in the ocaml xc bindings

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools/ocaml: Fix 2 bit-twiddling bugs and an off-by-one
Jon Ludlam [Mon, 10 Oct 2011 15:41:16 +0000 (16:41 +0100)]
tools/ocaml: Fix 2 bit-twiddling bugs and an off-by-one

The bit bugs are in ocaml vcpu affinity calls, and the off-by-one
error is in the ocaml console ring code

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
14 years agotools/ocaml: Remove log library from tools/ocaml/libs
Jon Ludlam [Mon, 10 Oct 2011 15:41:16 +0000 (16:41 +0100)]
tools/ocaml: Remove log library from tools/ocaml/libs

The only user was oxenstored, which has had the relevant bits
merged in.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
14 years agotools/ocaml: Remove the uuid library
Jon Ludlam [Mon, 10 Oct 2011 15:41:16 +0000 (16:41 +0100)]
tools/ocaml: Remove the uuid library

The library was only minimally used, and was really rather redundant.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
14 years agotools/ocaml: Add a missing dependency to the xenctrl ocaml package
Jon Ludlam [Mon, 10 Oct 2011 15:38:08 +0000 (16:38 +0100)]
tools/ocaml: Add a missing dependency to the xenctrl ocaml package

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools/ocaml: Rename the ocaml libraries
Jon Ludlam [Mon, 10 Oct 2011 15:37:07 +0000 (16:37 +0100)]
tools/ocaml: Rename the ocaml libraries

ocamlfind does not support namespaces, so to avoid
name clashes the module names have become longer.
Additionally, the xenstore and xenbus subdirs, which
contain several modules each, have been packed into
toplevel Xenstore and Xenbus modules.

xb becomes xenbus, xc becomes xenctrl, xl becomes xenlight,
xs becomes xenstore, eventchn becomes xeneventchn and
mmap becomes xenmmap.

[ Patch modified from that submitted, to update the .hgignore, and to
  cope with intervening changes to mmap_stubs.c -iwj ]

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: correctly parse disk "backendtype" field
Daniel De Graaf [Mon, 10 Oct 2011 10:21:51 +0000 (11:21 +0100)]
libxl: correctly parse disk "backendtype" field

The expression for backendtype was missing a comma.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agox86/AMD: Remove AMD_ERRATUM_400 definition
Boris Ostrovsky [Mon, 10 Oct 2011 08:09:17 +0000 (10:09 +0200)]
x86/AMD: Remove AMD_ERRATUM_400 definition

AMD_ERRATUM_400 was used to determine whether the processor supports
Always Running APIC Counter (ARAT) feature in init_amd(). Now that
ARAT support is based solely on family number this macro is no longer
needed.

Keep it in comments section as an example in case we ever need to use
it for somethnig else.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
14 years agopassthrough: update bus2bridge mapping as PCI devices get added/removed
Jan Beulich [Mon, 10 Oct 2011 07:21:32 +0000 (09:21 +0200)]
passthrough: update bus2bridge mapping as PCI devices get added/removed

This deals with two limitations at once: On device removal, the
mapping did not get updated so far at all, and hotplugged devices as
well as such not discoverable by Xen's initial bus scan (including the
case where a non-zero PCI segment wasn't accessible during Xen boot,
but became accessible after Dom0 validated access information against
ACPI data) wouldn't cause updates to the mapping either.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: "Kay, Allen M" <allen.m.kay@intel.com>
14 years agoAdjust 23931:6a9466e1753d.
Jan Beulich [Fri, 7 Oct 2011 15:57:07 +0000 (17:57 +0200)]
Adjust 23931:6a9466e1753d.

Committed a stale patch - this was missing from what was actually acked.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
14 years agoVT-d: don't reject possibly valid DRHD or RMRR
Jan Beulich [Fri, 7 Oct 2011 15:50:50 +0000 (17:50 +0200)]
VT-d: don't reject possibly valid DRHD or RMRR

If a non-zero PCI segment isn't accessible during Xen boot (because
firmware decided to not enter the necessary MMIO space into the E820
table), devices referred to on those segments through DRHD or RMRR
structures should not be rejected just because the devices can't be
found.

This is in line with what is being done in at least one other case
already: Systems with more than one PCI segment (usually high end
ones) are assumed to have valid firmware provided data, while systems
with just segment 0 continue to have their firmware tables validated.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: "Kay, Allen M" <allen.m.kay@intel.com>
14 years agotools/check: remove check_logging
Olaf Hering [Fri, 7 Oct 2011 13:33:15 +0000 (14:33 +0100)]
tools/check: remove check_logging

Remove tools/check/check_logging.  Python 2.3 is the minimal required
python version so the checked function is available anyway.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agotools/check: update python version check
Olaf Hering [Fri, 7 Oct 2011 13:32:36 +0000 (14:32 +0100)]
tools/check: update python version check

Python 2.3 is the minimal version according to the README.
Adjust check script.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibvchan: remove erroneously-committed libvchan-node[12]; add them to .hgignore
Ian Jackson [Fri, 7 Oct 2011 09:47:04 +0000 (10:47 +0100)]
libvchan: remove erroneously-committed libvchan-node[12]; add them to .hgignore

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoConfig.mk: error out on non-absolute $(XEN_ROOT)
Ian Campbell [Fri, 7 Oct 2011 08:35:31 +0000 (09:35 +0100)]
Config.mk: error out on non-absolute $(XEN_ROOT)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
14 years agotools/libfsimage: Avoid relative XEN_ROOT specification
Juergen Gross [Fri, 7 Oct 2011 08:35:12 +0000 (09:35 +0100)]
tools/libfsimage: Avoid relative XEN_ROOT specification

XEN_ROOT must be set to an absolute path to avoid out of the tree
references

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Committed-by: Keir Fraser <keir@xen.org>
14 years agox86/AMD: Do not enable ARAT feature on AMD processors below family 0x12
Boris Ostrovsky [Fri, 7 Oct 2011 08:32:15 +0000 (10:32 +0200)]
x86/AMD: Do not enable ARAT feature on AMD processors below family 0x12

Determining whether an AMD processor is affected by erratum 400 may
have some corner cases and handling these cases is somewhat complicated.
In the interest of simplicity we won't claim ARAT support on processor
families below 0x12.

Mirrors Linux commit e9cdd343a5e42c43bcda01e609fa23089e026470

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
14 years agolibvchan: interdomain communications library
Daniel De Graaf [Thu, 6 Oct 2011 18:44:40 +0000 (19:44 +0100)]
libvchan: interdomain communications library

This library implements a bidirectional communication interface between
applications in different domains, similar to unix sockets. Data can be
sent using the byte-oriented libvchan_read/libvchan_write or the
packet-oriented libvchan_recv/libvchan_send.

Channel setup is done using a client-server model; domain IDs and a port
number must be negotiated prior to initialization. The server allocates
memory for the shared pages and determines the sizes of the
communication rings (which may span multiple pages, although the default
places rings and control within a single page).

With properly sized rings, testing has shown that this interface
provides speed comparable to pipes within a single Linux domain; it is
significantly faster than network-based communication.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxc: add xc_gntshr_* functions
Daniel De Graaf [Thu, 6 Oct 2011 18:38:01 +0000 (19:38 +0100)]
libxc: add xc_gntshr_* functions

These functions and the xc_gntshr device (/dev/xen/gntalloc on linux)
allow applications to create pages shared with other domains.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxc: add xc_gnttab_map_grant_ref_notify
Daniel De Graaf [Thu, 6 Oct 2011 18:28:53 +0000 (19:28 +0100)]
libxc: add xc_gnttab_map_grant_ref_notify

Normally, when a userspace process mapping a grant crashes, the domain
providing the reference receives no indication that its peer has
crashed, possibly leading to unexpected freezes or timeouts. This
function provides a notification of the unmap by signalling an event
channel and/or clearing a specific byte in the page.

This also unifies the 3 very similar grant-mapping osdep interfaces into
a single function instead of introducing yet another minor variation.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
14 years agotools build: link to specific library version (libxs, libxl, xenstore, xenstat)
Roger Pau Monne [Thu, 6 Oct 2011 18:11:51 +0000 (19:11 +0100)]
tools build: link to specific library version (libxs, libxl, xenstore, xenstat)

To avoid linking to unexpected copies (eg wrong versions) of xen
libraries, explicitly pass the linker the library file to link to.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: fix libxl_mac_to_device_nic
Ian Campbell [Thu, 6 Oct 2011 17:50:22 +0000 (18:50 +0100)]
libxl: fix libxl_mac_to_device_nic

I think I broke this back in 22041:4c9ef5ec9146, using i as both the inner and
outer loop iterator.

I've added libxl__compare_macs which helps keep things clean.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: add and use parse_mac helper function
Ian Campbell [Thu, 6 Oct 2011 17:49:41 +0000 (18:49 +0100)]
libxl: add and use parse_mac helper function

rather than open coding a bunch it a bunch of times.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoQEMU_TAG update
Ian Jackson [Thu, 6 Oct 2011 17:43:03 +0000 (18:43 +0100)]
QEMU_TAG update

14 years agotools: ocaml: Change GET_C_STRUCT to Intf_val to follow common naming scheme
Zheng Li [Thu, 6 Oct 2011 16:47:05 +0000 (17:47 +0100)]
tools: ocaml: Change GET_C_STRUCT to Intf_val to follow common naming scheme

Change GET_C_STRUCT to Intf_val to follow the common naming scheme of
OCaml macros, and for better readability.

Signed-off-by: Zheng Li <dev@zheng.li>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agotools: ocaml: Fix invalid memory access in OCaml mmap library
Zheng Li [Thu, 6 Oct 2011 16:45:43 +0000 (17:45 +0100)]
tools: ocaml: Fix invalid memory access in OCaml mmap library

Fix invalid memory access in OCaml mmap library (to play nicely with the GC)

This was a bug reported by Roberto Di Cosmo. When he tried to reuse
the mmap library for his own project, Mmap.read occasionally got
different result when reading from the same map. This turned out to be
a bug in the binding, where a C pointer was created pointing to a
OCaml value, and the OCaml value was subsequently moved around by the
GC after memory allocation and hence invalidated the C pointer. This
patch removes the indirection of C pointer and uses OCaml macro to
access values directly.

Only Mmap.read function had this problem. The other functions, despite
having the same code style, didn't have memory allocation involved
hence wouldn't intrigue such an error. I've changed all of them to the
safer style for future proof. Directly casting OCaml value's *data
block* (rather than the value itself) as a C pointer is not a common
practice either, but I'll leave it as it is.

The bug hadn't occured on XenServer because XenServer didn't make use
of the Mmap.read function (except in one place for debugging). In
XenServer, most mmap operations were going through another pair of
separately implemented functions (Xs_ring.read/write).

Signed-off-by: Zheng Li <dev@zheng.li>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: create pci backend only when there are pci devices.
Roger Pau Monne [Thu, 6 Oct 2011 16:26:18 +0000 (17:26 +0100)]
libxl: create pci backend only when there are pci devices.

Creating empty pci entries made Linux DomUs under NetBSD Dom0 wait a very long time for devices to initialize during kernel boot.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoxenbackendd: fix incorrect usage of pidfile
Roger Pau Monne [Thu, 6 Oct 2011 16:24:36 +0000 (17:24 +0100)]
xenbackendd: fix incorrect usage of pidfile

Fix xenbackendd ignoring the pidfile passed through the command line.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoxl: wrap help output if command name is too long
Ian Campbell [Thu, 6 Oct 2011 16:18:38 +0000 (17:18 +0100)]
xl: wrap help output if command name is too long

Without this in the "xl help" line for pci-list-assignable-devices the command
name merges with the first word of the help. Since the bash completion support
parses "xl help" this leads to "pci-list-assignable-devicesList" being
presented as an option instead of the correct command name.

We also need to filter out lines which start with more than one space in the
bash completion support to stop "List" appearing as a possible command name
after the change to wrap it.

Doesn't address the fact that some help text overflows 80 columns.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: probe disk backend type in libxl_device_disk_add
Ian Campbell [Thu, 6 Oct 2011 15:19:46 +0000 (16:19 +0100)]
libxl: probe disk backend type in libxl_device_disk_add

Without this "xl block-attach" does not work. On create do_domain_create already
catches this.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxlu: correctly parse disk "backendtype" field
Ian Campbell [Thu, 6 Oct 2011 15:19:03 +0000 (16:19 +0100)]
libxlu: correctly parse disk "backendtype" field

Currently it tries to parse the value from the full "backendtype=FOO" string
but really it needs to parse from the equals.

Before:
# xl -N block-attach d32-1 backendtype=phy,vdev=xvdb,access=w,target=/dev/VG/debian-x86_32-1b
command line: config parsing error in disk specification: unknown value for backendtype: near `backendtype=phy' in `backendtype=phy,vdev=xvdb,access=w,target=/dev/VG/debian-x86_32-1b'

After [in new syntax, not yet in this tree -iwj]:
# xl -N block-attach d32-1 backendtype=phy,vdev=xvdb,access=w,target=/dev/VG/debian-x86_32-1b
disk: {
    "backend_domid": 0,
    "pdev_path": "/dev/VG/debian-x86_32-1b",
    "vdev": "xvdb",
    "backend": "phy",
    "format": "raw",
    "script": null,
    "removable": 0,
    "readwrite": 1,
    "is_cdrom": 0
}

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: undo 23728:548b2826293e whitespace cleanup to autogenerated file
Ian Campbell [Thu, 6 Oct 2011 15:15:33 +0000 (16:15 +0100)]
libxl: undo 23728:548b2826293e whitespace cleanup to autogenerated file

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: add comments describing the internal memory allocation helpers
Ian Campbell [Thu, 6 Oct 2011 14:24:34 +0000 (15:24 +0100)]
libxl: add comments describing the internal memory allocation helpers

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agop2m: query/modify p2mt with p2m_lock held
Olaf Hering [Thu, 6 Oct 2011 13:15:43 +0000 (14:15 +0100)]
p2m: query/modify p2mt with p2m_lock held

Query and update the p2mt in set_mmio_p2m_entry, clear_mmio_p2m_entry
and set_shared_p2m_entry with the p2m_lock held.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
14 years agop2m: use correct p2m_type_t in clear_mmio_p2m_entry
Olaf Hering [Thu, 6 Oct 2011 11:52:18 +0000 (12:52 +0100)]
p2m: use correct p2m_type_t in clear_mmio_p2m_entry

clear_mmio_p2m_entry() should mark the gfn as invalid.
Use proper name instead of numerical value. The currently used value of
zero means p2m_ram_rw.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
14 years agoxenpaging: remove confusing comment from p2m_mem_paging_populate
Olaf Hering [Thu, 6 Oct 2011 11:33:17 +0000 (12:33 +0100)]
xenpaging: remove confusing comment from p2m_mem_paging_populate

Currently there is no way to avoid the double check of the p2mt
because p2m_mem_paging_populate() is called from many places without
the p2m_lock held. Upcoming changes will move the function into
gfn_to_mfn(), so its interface could be changed and the extra
p2m_lock/get_entry can be removed.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
14 years agoxenpaging: fix locking in p2m_mem_paging functions
Olaf Hering [Thu, 6 Oct 2011 11:33:17 +0000 (12:33 +0100)]
xenpaging: fix locking in p2m_mem_paging functions

As suggested by <hongkaixing@huawei.com>, query and adjust the p2mt
under the p2m_lock to prevent races with PoD.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
14 years agoxenpaging: use p2m->get_entry() in p2m_mem_paging functions
Olaf Hering [Thu, 6 Oct 2011 11:33:17 +0000 (12:33 +0100)]
xenpaging: use p2m->get_entry() in p2m_mem_paging functions

Use p2m->get_entry() in the p2m_mem_paging functions. This preserves the
p2m_access type when gfn is updated with set_p2m_entry().
Its also a preparation for locking fixes in a subsequent patch.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
14 years agouse xzalloc in x86 code
Jan Beulich [Tue, 4 Oct 2011 12:18:30 +0000 (14:18 +0200)]
use xzalloc in x86 code

This includes the removal of a redundant memset() from microcode_amd.c.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agouse xzalloc in driver code
Jan Beulich [Tue, 4 Oct 2011 12:17:28 +0000 (14:17 +0200)]
use xzalloc in driver code

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agouse xzalloc in common code
Jan Beulich [Tue, 4 Oct 2011 12:16:32 +0000 (14:16 +0200)]
use xzalloc in common code

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agointroduce xzalloc() & Co
Jan Beulich [Tue, 4 Oct 2011 12:15:26 +0000 (14:15 +0200)]
introduce xzalloc() & Co

Rather than having to match a call to one of the xmalloc() flavors with
a subsequent memset(), introduce a zeroing variant of each of those
flavors.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agoAMD-IOMMU: remove dead variable references
Jan Beulich [Tue, 4 Oct 2011 12:11:56 +0000 (14:11 +0200)]
AMD-IOMMU: remove dead variable references

These got orphaned up by recent changes.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agobuild: fix grep invocation in cc-options
Keir Fraser [Fri, 30 Sep 2011 20:17:47 +0000 (21:17 +0100)]
build: fix grep invocation in cc-options

Currently the build produces lots of
        Usage: grep [OPTION]... PATTERN [FILE]...
        Try `grep --help' for more information.

This is due to the "grep -- $(2)" in cc-options. It seems that the
default of reading stdin is disabled when using "--". I don't know if
this is a bug in grep or how it is supposed to be but we can work
around it by explicitly passing in "-"

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
14 years agoX86 MCE: Prevent malicious guest access broken page again
Keir Fraser [Fri, 30 Sep 2011 20:16:43 +0000 (21:16 +0100)]
X86 MCE: Prevent malicious guest access broken page again

To avoid recursive mce.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
14 years agox86,irq: Clean up __clear_irq_vector
Keir Fraser [Fri, 30 Sep 2011 20:15:21 +0000 (21:15 +0100)]
x86,irq: Clean up __clear_irq_vector

Fix and clean up the logic to __clear_irq_vector().

We always need to clear the things related to cfg->vector.

If the IRQ is currently in motion, then we need to also clear
out things related to cfg->old_vector.

This patch reorganizes the function to make the parallels between
the two clean-ups more obvious.

The main functional change here is with cfg->used_vectors; make
sure to clear cfg->vector always (even if !cfg->move_in_progress);
if cfg->move_in_progress, clear cfg->old_vector as well.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
14 years agoIRQ Cleanup: rename nr_ioapic_registers to nr_ioapic_entries
Keir Fraser [Fri, 30 Sep 2011 20:14:34 +0000 (21:14 +0100)]
IRQ Cleanup: rename nr_ioapic_registers to nr_ioapic_entries

The name "nr_ioapic_registers" is wrong and actively misleading.  The
variable holds the number of redirection entries for each apic, which
is two registers fewer than the total number of registers.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
14 years agolibxl: libxl_qmp: use of libxl__fd_set_cloexec.
Anthony PERARD [Thu, 29 Sep 2011 15:31:24 +0000 (16:31 +0100)]
libxl: libxl_qmp: use of libxl__fd_set_cloexec.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: Introduce a QMP client
Anthony PERARD [Thu, 29 Sep 2011 15:30:54 +0000 (16:30 +0100)]
libxl: Introduce a QMP client

QMP stands for QEMU Monitor Protocol and it is used to query information
from QEMU or to control QEMU.

This implementation will ask QEMU the list of chardevice and store the
path to serial ports in xenstored. So we will be able to use xl console
with QEMU upstream.

In order to connect to the QMP server, a socket file is created in
/var/run/xen/qmp-libxl-$(domid).

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: Introduce JSON parser
Anthony PERARD [Thu, 29 Sep 2011 15:28:24 +0000 (16:28 +0100)]
libxl: Introduce JSON parser

We use the yajl parser, but we need to make a tree from the parse result
to use it outside the parser.

So this patch include json_object struct that is used to hold the JSON
data.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
14 years agolibxl: Intruduce libxl__strndup.
Anthony PERARD [Thu, 29 Sep 2011 15:28:23 +0000 (16:28 +0100)]
libxl: Intruduce libxl__strndup.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
14 years agolibxl: Introduce libxl__realloc.
Anthony PERARD [Thu, 29 Sep 2011 15:28:22 +0000 (16:28 +0100)]
libxl: Introduce libxl__realloc.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
14 years agolibxl: Introduce libxl_internal_types.idl.
Anthony PERARD [Thu, 29 Sep 2011 15:28:22 +0000 (16:28 +0100)]
libxl: Introduce libxl_internal_types.idl.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
14 years agolibxl: Add get/set_default_namespace in libxltypes.py.
Anthony PERARD [Thu, 29 Sep 2011 15:28:21 +0000 (16:28 +0100)]
libxl: Add get/set_default_namespace in libxltypes.py.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
14 years agolibxl: Rename libxl.idl to libxl_types.idl.
Anthony PERARD [Thu, 29 Sep 2011 15:28:20 +0000 (16:28 +0100)]
libxl: Rename libxl.idl to libxl_types.idl.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
--HG--
rename : tools/libxl/libxl.idl => tools/libxl/libxl_types.idl

14 years agolibxl: Introduce libxl__fd_set_cloexec
Anthony PERARD [Thu, 29 Sep 2011 15:06:02 +0000 (16:06 +0100)]
libxl: Introduce libxl__fd_set_cloexec

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoxl: fixup command line handling for several commands.
Ian Campbell [Thu, 29 Sep 2011 14:40:34 +0000 (15:40 +0100)]
xl: fixup command line handling for several commands.

def_getopt already checks for a minimum number of arguments for us.

"xl save" simply need to use the correct argument for that value,
contrary to the change I made in 23876:b113d626cfaf

"xl block-list" does not need to check for at least 2 arguments, since
it's already been done by def_getopt.

"xl network-list" would previous accept zero arguments and just print
the table header. Insist on a domain argument.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: Expose number of shared pages
Adin Scannell [Thu, 29 Sep 2011 14:26:04 +0000 (15:26 +0100)]
libxl: Expose number of shared pages

Signed-off-by: Adin Scannell <adin@scannell.ca>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: attempt to cleanup tapdisk processes on disk backend destroy.
Ian Campbell [Wed, 28 Sep 2011 15:42:11 +0000 (16:42 +0100)]
libxl: attempt to cleanup tapdisk processes on disk backend destroy.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: correct allocation size in libxl_list_nics
Ian Campbell [Wed, 28 Sep 2011 15:35:44 +0000 (16:35 +0100)]
libxl: correct allocation size in libxl_list_nics

The function returns a list of libxl_nicinfo not libxl_device_nic.

Causes memory corruption on free.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: correct allocation size in libxl_list_vm
Ian Campbell [Wed, 28 Sep 2011 15:34:00 +0000 (16:34 +0100)]
libxl: correct allocation size in libxl_list_vm

*ptr has type libxl_vminfo not libxl_domid, so correct calloc call.

This the second instance of this bug I've noticed recently, I did a
quick audit of other similar uses of sizeof(...) and all I spotted
were a couple of harmlessly reversed calloc arguments. It's a pretty
strong argument for "foo = ..alloc(sizeof(*foo))" rather than
"alloc(sizeof(foos_type))" though...

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: correctly propagate errors from libxl_domain_destroy
Ian Campbell [Wed, 28 Sep 2011 15:32:31 +0000 (16:32 +0100)]
libxl: correctly propagate errors from libxl_domain_destroy

currently it return success e.g. even if xc_domain_destroy fails.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: fail to parse disk vpath if a disk+part number needed but unavailable
Ian Campbell [Wed, 28 Sep 2011 15:31:11 +0000 (16:31 +0100)]
libxl: fail to parse disk vpath if a disk+part number needed but unavailable

libxl__device_disk_dev_number() can parse a virtpath which is an encoded
unsigned long but does not set *pdisk or *ppartition in that case.

Ideally we would parse the number but for now simply fail to prevent cascading
failures.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: do not try to redo incoming migration on reboot of migrated domain
Ian Campbell [Tue, 27 Sep 2011 17:39:15 +0000 (18:39 +0100)]
libxl: do not try to redo incoming migration on reboot of migrated domain

After a migration, reboot was trying to receive another incoming
migration, instead of restarting the domain it already has.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: Andreas Olsowski <andreas.olsowski@leuphana.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: make libxl__wait_for_device_model use libxl__spawn_starrting directly
Ian Campbell [Tue, 27 Sep 2011 17:03:11 +0000 (18:03 +0100)]
libxl: make libxl__wait_for_device_model use libxl__spawn_starrting directly

Instead of indirecting via libxl_device_model_starting. This fixes a
segmentation fault using stubdomains where starting->for_spawn is
(validly) NULL because starting a stubdom doesn't need to spawn a
process.

Most callers of libxl__wait_for_device_model already pass NULL for
this variable (because they are not on the starting path) so on
libxl__confirm_device_model_startup needs to change.

Reported-by: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoxl: fixup "xl save" command line handling.
Ian Campbell [Tue, 27 Sep 2011 16:32:16 +0000 (17:32 +0100)]
xl: fixup "xl save" command line handling.

The save file paramter is required so ensure we have enough arguments.

The config filename is optional so do not use argv[optind+3], which
may well happen to be NULL when the paramter is not present but
relying on that is pretty gross.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoAMD-IOMMU: fix initialization order (after 23863:9e0259239822)
Jan Beulich [Tue, 27 Sep 2011 15:15:09 +0000 (16:15 +0100)]
AMD-IOMMU: fix initialization order (after 23863:9e0259239822)

That original patch caused alloc_ivrs_mappings() to be called too
early, so things get moved back to where they were, just converting
the single call there to a loop over all IOMMUs.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
14 years agoxenpaging: track number of paged pages in struct domain
Olaf Hering [Mon, 26 Sep 2011 21:19:42 +0000 (22:19 +0100)]
xenpaging: track number of paged pages in struct domain

The toolstack should know how many pages are paged-out at a given point
in time so it could make smarter decisions about how many pages should
be paged or ballooned.

Add a new member to xen_domctl_getdomaininfo and bump interface version.
Use the new member in xc_dominfo_t.
The SONAME of libxc should be changed if this patch gets applied.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
14 years agoAdd save/restore support for viridian APIC assist pfn.
Paul Durrant [Mon, 26 Sep 2011 21:10:21 +0000 (22:10 +0100)]
Add save/restore support for viridian APIC assist pfn.

c/s 17b754cab7b0 introduced a per-VCPU viridian structure to
store the APIC assist pfn. This patch adds support for save and
restore of that value.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
14 years agotools: fix install of lomount
Ian Campbell [Thu, 22 Sep 2011 17:37:06 +0000 (18:37 +0100)]
tools: fix install of lomount

$(BIN) went away in 23124:e3d4c34b14a3.

Also there are no *.so, *.a or *.rpm built in here

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
14 years agox86: ucode-amd: Don't warn when no ucode is available for a CPU revision
Jan Beulich [Thu, 22 Sep 2011 17:35:30 +0000 (18:35 +0100)]
x86: ucode-amd: Don't warn when no ucode is available for a CPU revision

This patch originally comes from the Linus mainline kernel (2.6.33),
find below the patch details:

From: Andreas Herrmann <herrmann.der.user@googlemail.com>

There is no point in warning when there is no ucode available
for a specific CPU revision. Currently the container-file, which
provides the AMD ucode patches for OS load, contains only a few
ucode patches.

It's already clearly indicated by the printed patch_level
whenever new ucode was available and an update happened. So the
warning message is of no help but rather annoying on systems
with many CPUs.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
14 years agoXZ: Fix incorrect XZ_BUF_ERROR
Jan Beulich [Thu, 22 Sep 2011 17:34:27 +0000 (18:34 +0100)]
XZ: Fix incorrect XZ_BUF_ERROR

From: Lasse Collin <lasse.collin@tukaani.org>

xz_dec_run() could incorrectly return XZ_BUF_ERROR if all of the
following was true:

 - The caller knows how many bytes of output to expect and only
   provides
   that much output space.

 - When the last output bytes are decoded, the caller-provided input
   buffer ends right before the LZMA2 end of payload marker.  So LZMA2
   won't provide more output anymore, but it won't know it yet and
   thus
   won't return XZ_STREAM_END yet.

 - A BCJ filter is in use and it hasn't left any unfiltered bytes in
   the
   temp buffer.  This can happen with any BCJ filter, but in practice
   it's more likely with filters other than the x86 BCJ.

This fixes <https://bugzilla.redhat.com/show_bug.cgi?id=3D735408>
where Squashfs thinks that a valid file system is corrupt.

This also fixes a similar bug in single-call mode where the
uncompressed size of a block using BCJ + LZMA2 was 0 bytes and caller
provided no output space.  Many empty .xz files don't contain any
blocks and thus don't trigger this bug.

This also tweaks a closely related detail: xz_dec_bcj_run() could call
xz_dec_lzma2_run() to decode into temp buffer when it was known to be
useless.  This was harmless although it wasted a minuscule number of
CPU cycles.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
14 years agoXZ decompressor: Fix decoding of empty LZMA2 streams
Jan Beulich [Thu, 22 Sep 2011 17:33:48 +0000 (18:33 +0100)]
XZ decompressor: Fix decoding of empty LZMA2 streams

From: Lasse Collin <lasse.collin@tukaani.org>

The old code considered valid empty LZMA2 streams to be corrupt.
Note that a typical empty .xz file has no LZMA2 data at all,
and thus most .xz files having no uncompressed data are handled
correctly even without this fix.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
14 years agoVT-d: fix off-by-one error in RMRR validation
Jan Beulich [Thu, 22 Sep 2011 17:32:34 +0000 (18:32 +0100)]
VT-d: fix off-by-one error in RMRR validation

(base_addr,end_addr) is an inclusive range, and hence there shouldn't
be a subtraction of 1 in the second invocation of page_is_ram_type().
For RMRRs covering a single page that actually resulted in the
immediately preceding page to get checked (which could have resulted
in a false warning).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
14 years agoVT-d: eliminate a mis-use of pcidevs_lock
Jan Beulich [Thu, 22 Sep 2011 17:31:44 +0000 (18:31 +0100)]
VT-d: eliminate a mis-use of pcidevs_lock

dma_pte_clear_one() shouldn't acquire this global lock for the purpose
of processing a per-domain list. Furthermore the function a few lines
earlier has a comment stating that acquiring pcidevs_lock isn't
necessary here (whether that's really correct is another question).

Use the domain's mappin_lock instead to protect the mapped_rmrrs list.
Fold domain_rmrr_mapped() into its sole caller so that the otherwise
implicit dependency on pcidevs_lock there becomes more obvious (see
the comment there).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
14 years agox86: IO-APIC code has no dependency on PCI
Jan Beulich [Thu, 22 Sep 2011 17:31:02 +0000 (18:31 +0100)]
x86: IO-APIC code has no dependency on PCI

The IRQ handling code requires pcidevs_lock to be held only for MSI
interrupts.

As the handling of which was now fully moved into msi.c (i.e. while
applying fine without, the patch needs to be applied after the one
titled "x86: split MSI IRQ chip"), io_apic.c now also doesn't need to
include PCI headers anymore.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
14 years agoPCI multi-seg: config space accessor adjustments
Jan Beulich [Thu, 22 Sep 2011 17:29:19 +0000 (18:29 +0100)]
PCI multi-seg: config space accessor adjustments

Signed-off-by: Jan Beulich <jbeulich@suse.com>