]> xenbits.xensource.com Git - xen.git/log
xen.git
13 years agolibxl: add missing "break;" to do_pci_remove
Ian Campbell [Tue, 25 Oct 2011 16:04:41 +0000 (17:04 +0100)]
libxl: add missing "break;" to do_pci_remove

Otherwise we erroneously fall through the LIBXL_DOMAIN_TYPE_PV case into the
"default: abort()".

(I'm sure we fixed this once already...)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: Dario Faggioli <dario.faggioli@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agohvm: Clean up I/O emulation
Christoph Egger [Tue, 25 Oct 2011 15:48:17 +0000 (16:48 +0100)]
hvm: Clean up I/O emulation

Move HVM io fields into a structure.
On MMIO instruction failure print out some more bytes.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agox86 pm: provide CC7/PC2 residency
Yang Zhang [Tue, 25 Oct 2011 15:46:47 +0000 (16:46 +0100)]
x86 pm: provide CC7/PC2 residency

Sandy bridge introduces new MSR to get cc7/pc2 residency (core C-state
7/package C-state 2). Print the cc7/pc2 residency when on sandy bridge
platform.

Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agox86/hpet: fix cpumask allocation after 23990:1c8789852eaf
Jan Beulich [Mon, 24 Oct 2011 17:01:07 +0000 (18:01 +0100)]
x86/hpet: fix cpumask allocation after 23990:1c8789852eaf

hpet_fsb_cap_lookup(), if it doesn't find any FSB capable timer,
leaves hpet_events allocated, while hpet_events->cpumask may not have
been, As we're pretty generous with these one-time allocations already
(in that hpet_events doesn't get freed when no usable counters were
found, even if in that case only the first array entry [or none at
all] may get used), simply make the cpumask allocation in the legacy
case independent of whether hpet_events was NULL before.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agox86/ucode-amd: fix regression from c/s 23871:503ee256fecf
Jan Beulich [Mon, 24 Oct 2011 17:00:20 +0000 (18:00 +0100)]
x86/ucode-amd: fix regression from c/s 23871:503ee256fecf

microcode_fits() must return distinct values for the success and
no-fit-but-no-error cases, so the caller can react accordingly. Make
it return 1 in the success case, and adjust its single caller.

Also remove an impossible code path - install_equiv_cpu_table(), which
gets called prior to microcode_fits(), never leaves equiv_cpu_table
being NULL without also returning an error.

Note that this is still awaiting testing on a system where the
regression was actually observed (which also requires a new enough
microcode_ctl package). Note also that this will need to be
backported to 4.0 and 4.1 (or the broken c/s that got backported
there reverted).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agonestedhvm: handle l2 guest MMIO access
Tim Deegan [Mon, 24 Oct 2011 10:29:08 +0000 (11:29 +0100)]
nestedhvm: handle l2 guest MMIO access

Hyper-V starts a root domain which effectively an l2 guest.
Hyper-V passes its devices through to the root domain and
let it do the MMIO accesses. The emulation is done by
Xen (host) and Hyper-V forwards the interrupts to the l2 guest.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agocpumask <=> xenctl_cpumap: allocate CPU masks and byte maps dynamically
Jan Beulich [Fri, 21 Oct 2011 07:45:24 +0000 (09:45 +0200)]
cpumask <=> xenctl_cpumap: allocate CPU masks and byte maps dynamically

Generally there was a NR_CPUS-bits wide array in these functions and
another (through a cpumask_t) on their callers' stacks, which may get
a little large for big NR_CPUS. As the functions can fail anyway, do
the allocation in there.

For the x86/MCA case this require a little code restructuring: By using
different CPU mask accessors it was possible to avoid allocating a mask
in the broadcast case. Also, this was the only user that failed to
check the return value of the conversion function (which could have led
to undefined behvior).

Also constify the input parameters of the two functions.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agox86/hpet: allocate CPU masks dynamically
Jan Beulich [Fri, 21 Oct 2011 07:44:47 +0000 (09:44 +0200)]
x86/hpet: allocate CPU masks dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agocredit: allocate CPU masks dynamically
Jan Beulich [Fri, 21 Oct 2011 07:44:03 +0000 (09:44 +0200)]
credit: allocate CPU masks dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agocpupools: allocate CPU masks dynamically
Jan Beulich [Fri, 21 Oct 2011 07:43:35 +0000 (09:43 +0200)]
cpupools: allocate CPU masks dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agox86/p2m: allocate CPU masks dynamically
Jan Beulich [Fri, 21 Oct 2011 07:42:47 +0000 (09:42 +0200)]
x86/p2m: allocate CPU masks dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
--- 2011-10-18.orig/xen/arch/x86/hvm/nestedhvm.c 2011-10-11 17:24:46.000000000 +0200
+++ 2011-10-18/xen/arch/x86/hvm/nestedhvm.c 2011-10-18 16:45:02.000000000 +0200
@@ -114,9 +114,9 @@ nestedhvm_flushtlb_ipi(void *info)
 void
 nestedhvm_vmcx_flushtlb(struct p2m_domain *p2m)
 {
-    on_selected_cpus(&p2m->p2m_dirty_cpumask, nestedhvm_flushtlb_ipi,
+    on_selected_cpus(p2m->dirty_cpumask, nestedhvm_flushtlb_ipi,
         p2m->domain, 1);
-    cpumask_clear(&p2m->p2m_dirty_cpumask);
+    cpumask_clear(p2m->dirty_cpumask);
 }

 bool_t
--- 2011-10-18.orig/xen/arch/x86/mm/hap/nested_hap.c 2011-10-21 09:24:51.000000000 +0200
+++ 2011-10-18/xen/arch/x86/mm/hap/nested_hap.c 2011-10-18 16:44:35.000000000 +0200
@@ -88,7 +88,7 @@ nestedp2m_write_p2m_entry(struct p2m_dom
     safe_write_pte(p, new);

     if (old_flags & _PAGE_PRESENT)
-        flush_tlb_mask(&p2m->p2m_dirty_cpumask);
+        flush_tlb_mask(p2m->dirty_cpumask);

     paging_unlock(d);
 }
--- 2011-10-18.orig/xen/arch/x86/mm/p2m.c 2011-10-14 09:47:46.000000000 +0200
+++ 2011-10-18/xen/arch/x86/mm/p2m.c 2011-10-21 09:28:33.000000000 +0200
@@ -81,7 +81,6 @@ static void p2m_initialise(struct domain
     p2m->default_access = p2m_access_rwx;

     p2m->cr3 = CR3_EADDR;
-    cpumask_clear(&p2m->p2m_dirty_cpumask);

     if ( hap_enabled(d) && (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) )
         ept_p2m_init(p2m);
@@ -102,6 +101,8 @@ p2m_init_nestedp2m(struct domain *d)
         d->arch.nested_p2m[i] = p2m = xzalloc(struct p2m_domain);
         if (p2m == NULL)
             return -ENOMEM;
+        if ( !zalloc_cpumask_var(&p2m->dirty_cpumask) )
+            return -ENOMEM;
         p2m_initialise(d, p2m);
         p2m->write_p2m_entry = nestedp2m_write_p2m_entry;
         list_add(&p2m->np2m_list, &p2m_get_hostp2m(d)->np2m_list);
@@ -118,6 +119,11 @@ int p2m_init(struct domain *d)
     p2m_get_hostp2m(d) = p2m = xzalloc(struct p2m_domain);
     if ( p2m == NULL )
         return -ENOMEM;
+    if ( !zalloc_cpumask_var(&p2m->dirty_cpumask) )
+    {
+        xfree(p2m);
+        return -ENOMEM;
+    }
     p2m_initialise(d, p2m);

     /* Must initialise nestedp2m unconditionally
@@ -333,6 +339,9 @@ static void p2m_teardown_nestedp2m(struc
     uint8_t i;

     for (i = 0; i < MAX_NESTEDP2M; i++) {
+        if ( !d->arch.nested_p2m[i] )
+            continue;
+        free_cpumask_var(d->arch.nested_p2m[i]->dirty_cpumask);
         xfree(d->arch.nested_p2m[i]);
         d->arch.nested_p2m[i] = NULL;
     }
@@ -341,8 +350,12 @@ static void p2m_teardown_nestedp2m(struc
 void p2m_final_teardown(struct domain *d)
 {
     /* Iterate over all p2m tables per domain */
-    xfree(d->arch.p2m);
-    d->arch.p2m = NULL;
+    if ( d->arch.p2m )
+    {
+        free_cpumask_var(d->arch.p2m->dirty_cpumask);
+        xfree(d->arch.p2m);
+        d->arch.p2m = NULL;
+    }

     /* We must teardown unconditionally because
      * we initialise them unconditionally.
@@ -1200,7 +1213,7 @@ p2m_get_nestedp2m(struct vcpu *v, uint64
             if (p2m->cr3 == CR3_EADDR)
                 hvm_asid_flush_vcpu(v);
             p2m->cr3 = cr3;
-            cpu_set(v->processor, p2m->p2m_dirty_cpumask);
+            cpumask_set_cpu(v->processor, p2m->dirty_cpumask);
             p2m_unlock(p2m);
             nestedp2m_unlock(d);
             return p2m;
@@ -1217,7 +1230,7 @@ p2m_get_nestedp2m(struct vcpu *v, uint64
     p2m->cr3 = cr3;
     nv->nv_flushp2m = 0;
     hvm_asid_flush_vcpu(v);
-    cpu_set(v->processor, p2m->p2m_dirty_cpumask);
+    cpumask_set_cpu(v->processor, p2m->dirty_cpumask);
     p2m_unlock(p2m);
     nestedp2m_unlock(d);

--- 2011-10-18.orig/xen/include/asm-x86/p2m.h 2011-10-21 09:24:51.000000000 +0200
+++ 2011-10-18/xen/include/asm-x86/p2m.h 2011-10-18 16:39:34.000000000 +0200
@@ -198,7 +198,7 @@ struct p2m_domain {
      * this p2m and those physical cpus whose vcpu's are in
      * guestmode.
      */
-    cpumask_t          p2m_dirty_cpumask;
+    cpumask_var_t      dirty_cpumask;

     struct domain     *domain;   /* back pointer to domain */

13 years agoallocate CPU sibling and core maps dynamically
Jan Beulich [Fri, 21 Oct 2011 07:23:05 +0000 (09:23 +0200)]
allocate CPU sibling and core maps dynamically

... thus reducing the per-CPU data area size back to one page even when
building for large NR_CPUS.

At once eliminate the old __cpu{mask,list}_scnprintf() helpers.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agox86: allocate IRQ actions' cpu_eoi_map dynamically
Jan Beulich [Fri, 21 Oct 2011 07:22:02 +0000 (09:22 +0200)]
x86: allocate IRQ actions' cpu_eoi_map dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agoeliminate direct assignments of CPU masks
Jan Beulich [Fri, 21 Oct 2011 07:21:09 +0000 (09:21 +0200)]
eliminate direct assignments of CPU masks

Use cpumask_copy() instead of direct variable assignments for copying
CPU masks. While direct assignments are not a problem when both sides
are variables actually defined as cpumask_t (except for possibly
copying *much* more than would actually need to be copied), they must
not happen when the original variable is of type cpumask_var_t (which
may have lass space allocated to it than a full cpumask_t). Eliminate
as many of such assignments as possible (in several cases it's even
possible to collapse two operations [copy then clear one bit] into one
[cpumask_andnot()]), and thus set the way for reducing the allocation
size in alloc_cpumask_var().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agoeliminate cpumask accessors referencing NR_CPUS
Jan Beulich [Fri, 21 Oct 2011 07:19:44 +0000 (09:19 +0200)]
eliminate cpumask accessors referencing NR_CPUS

... in favor of using the new, nr_cpumask_bits-based ones.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agointroduce and use nr_cpu_ids and nr_cpumask_bits
Jan Beulich [Fri, 21 Oct 2011 07:17:42 +0000 (09:17 +0200)]
introduce and use nr_cpu_ids and nr_cpumask_bits

The former is the runtime equivalent of NR_CPUS (and users of NR_CPUS,
where necessary, get adjusted accordingly), while the latter is for the
sole use of determining the allocation size when dynamically allocating
CPU masks (done later in this series).

Adjust accessors to use either of the two to bound their bitmap
operations - which one gets used depends on whether accessing the bits
in the gap between nr_cpu_ids and nr_cpumask_bits is benign but more
efficient.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agox86/mm/p2m: don't leak state if nested-p2m init fails.
Tim Deegan [Thu, 20 Oct 2011 14:36:01 +0000 (15:36 +0100)]
x86/mm/p2m: don't leak state if nested-p2m init fails.

Signed-off-by: Tim Deegan <tim@xen.org>
13 years agoxenpaging: disallow paging in a PoD guest
Olaf Hering [Thu, 20 Oct 2011 10:25:58 +0000 (11:25 +0100)]
xenpaging: disallow paging in a PoD guest

Disallow xenpaging in a PoD guest until coexistance between the two features
is properly implemented.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agoxenpaging: document p2m_mem_paging functions
Olaf Hering [Thu, 20 Oct 2011 10:25:58 +0000 (11:25 +0100)]
xenpaging: document p2m_mem_paging functions

Add some documentation for each of the p2m_mem_paging functions to describe
what they ought to do.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agoxenpaging: check p2mt in p2m_mem_paging functions
Olaf Hering [Thu, 20 Oct 2011 10:25:55 +0000 (11:25 +0100)]
xenpaging: check p2mt in p2m_mem_paging functions

Add checks to forward the p2m_ram_paging* state properly during page-in.

Resume can be called several times if several vcpus called populate for
the gfn. Finish resume only once.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agox86: move generic IRQ code out of io_apic.c
Jan Beulich [Wed, 19 Oct 2011 10:51:42 +0000 (12:51 +0200)]
x86: move generic IRQ code out of io_apic.c

While doing so, eliminate the use of struct irq_cfg and convert the
CPU mask accessors to the new style ones as far as possible.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
13 years agofold struct irq_cfg into struct irq_desc
Jan Beulich [Wed, 19 Oct 2011 10:50:54 +0000 (12:50 +0200)]
fold struct irq_cfg into struct irq_desc

struct irq_cfg really has become an architecture extension to struct
irq_desc, and hence it should be treated as such (rather than as IRQ
chip specific data, which it was meant to be originally).

For a first step, only convert a subset of the uses; subsequent
patches (partly to be sent later) will aim at fully eliminating the
use of the old structure type.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
13 years agolibxl: remove QMP warning when no pty style serial device is configured
Ian Campbell [Thu, 13 Oct 2011 09:44:27 +0000 (10:44 +0100)]
libxl: remove QMP warning when no pty style serial device is configured

If the serial device is not "pty" then there is nothing to do but this is not
an error. Removes a spurious warning if e.g. serial="file:/tmp/serial.log" is used:

libxl: error: libxl_qmp.c:137:register_serials_chardev_callback: Failed to store serial port information in xenstore: No such file or directory

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxc: osdep: report missing backends in common code
Ian Campbell [Thu, 13 Oct 2011 09:32:09 +0000 (10:32 +0100)]
libxc: osdep: report missing backends in common code

Backends were inconsistent about reporting and it's a pain to edit them all
when adding a new class of osdep.

Signed-off-by: Ian Campbell <Ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
Requires Daniel De Graaf's "libxc: add xc_gntshr_* functions"

13 years agolibxl: libxl__e820_alloc must take a libxl__gc.
Ian Campbell [Thu, 13 Oct 2011 09:32:09 +0000 (10:32 +0100)]
libxl: libxl__e820_alloc must take a libxl__gc.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: correctly propagate errors from libxl_domain_resume
Ian Campbell [Thu, 13 Oct 2011 08:37:06 +0000 (09:37 +0100)]
libxl: correctly propagate errors from libxl_domain_resume

currently it return success no matter what.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agoocaml: align build output
Ian Campbell [Mon, 17 Oct 2011 16:05:30 +0000 (17:05 +0100)]
ocaml: align build output

Fix:
 MLI       op.mli
 MLI      op.cmi
 MLI       partial.mli
 MLI      partial.cmi
 MLI       packet.mli

Signed-off-by: Ian Cmpabell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: probe disk backend type in libxl_device_disk_add
Ian Campbell [Thu, 13 Oct 2011 09:31:00 +0000 (10:31 +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.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: add a test case for correct parsing of disk "backendtype" field
Ian Campbell [Fri, 7 Oct 2011 10:27:02 +0000 (11:27 +0100)]
libxl: add a test case for correct parsing of disk "backendtype" field

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agoxl: use libxl_device_disk_to_json to pretty print disk configuration
Ian Campbell [Fri, 7 Oct 2011 10:06:41 +0000 (11:06 +0100)]
xl: use libxl_device_disk_to_json to pretty print disk configuration

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agoxl: allow check-xl-disk-parse to run against installed xl as well as build dir
Ian Campbell [Fri, 7 Oct 2011 10:05:47 +0000 (11:05 +0100)]
xl: allow check-xl-disk-parse to run against installed xl as well as build dir

I can't run from the current directory since my build box isn't running Xen so
if ./xl doesn't exist use the installed version on the assumption that I've
copied the script to a test host.

I think running from the build dir needs the blktap2 libraries, so update
LD_LIBRARY_PATH as appropriate.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: IDL: autogenerate functions to produce JSON from libxl data structures.
Ian Campbell [Fri, 7 Oct 2011 10:05:45 +0000 (11:05 +0100)]
libxl: IDL: autogenerate functions to produce JSON from libxl data structures.

Two functions are provided. TYPE_gen_json exposes an interface which is
compatible with the YAGL generator infrastructure. TYPE_to_string uses this to
produce a pretty printed string.

The TYPE_gen_json functions are defined in a new header libxl_json.h which is
not exposed via libxl.h due to the use of YAGL datatypes to avoid poluting the
namespace us libxl users which don't use the library themselves.  If a libxl
user is interested in integrating at the YAGL level then it should #include
this file itself.

Also update testidl to generate a random version of each IDL datastructure and
convert it to JSON. Unfortunately this requires a libxl_ctx and therefore the
test must be run on a Xen system now.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agohvmloader: Add the WAET since Microsoft are demanding it for Windows 8
Andrew Cooper [Fri, 14 Oct 2011 17:11:25 +0000 (18:11 +0100)]
hvmloader: Add the WAET since Microsoft are demanding it for Windows 8

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 years agoQEMU_TAG update
Ian Jackson [Thu, 6 Oct 2011 17:43:03 +0000 (18:43 +0100)]
QEMU_TAG update

13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>