xen.git
15 years agocpupools: Make interface more consistent
Keir Fraser [Sun, 24 Oct 2010 12:09:50 +0000 (13:09 +0100)]
cpupools: Make interface more consistent

The current cpupools code interface is a bit inconsistent.  This
patch addresses this by making the interaction for each
vcpu in a pool look like this:

alloc_vdata() -- allocates and sets up vcpu data
insert_vcpu() -- the vcpu is ready to run in this pool
remove_vcpu() -- take the vcpu out of the pool
free_vdata()  -- delete allocated vcpu data

(Previously, remove_vcpu and free_vdata were combined into a "destroy
vcpu", and insert_vcpu was only called for idle vcpus.)

This also addresses a bug in credit2 which was caused by a
misunderstanding of the cpupools interface.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
15 years agoQEMU_TAG update
Ian Jackson [Thu, 21 Oct 2010 17:51:36 +0000 (18:51 +0100)]
QEMU_TAG update

15 years agolibxl: add a detailed explanation of the libxl domain memory model
Ian Jackson [Thu, 21 Oct 2010 17:51:26 +0000 (18:51 +0100)]
libxl: add a detailed explanation of the libxl domain memory model

Originally-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Converted to US-ASCII by iwj.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools: cleanup domain save switch_qemu_logdirty callback
Ian Campbell [Thu, 21 Oct 2010 17:46:32 +0000 (18:46 +0100)]
tools: cleanup domain save switch_qemu_logdirty callback

Move the function into struct save_callbacks with the others and add
the void *closure to the callback arguments.

Add and propagate an error return code from the callback.

Use this in libxl to pass the save context to
libxl__domain_suspend_common_switch_qemu_logdirty allowing us to reuse
the parent's xenstore handle, gc context etc.

Also add an apparently missing libxl__free_all to
libxl__domain_suspend_common.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools: cpupools: add example cpupool config file
Juergen Gross [Thu, 21 Oct 2010 17:36:57 +0000 (18:36 +0100)]
tools: cpupools: add example cpupool config file

Adds an example configuration file for xm/xl pool-create

Signed-off-by: juergen.gross@ts.fujitsu.com
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools: cpupools: xl: commands and library changes
Juergen Gross [Thu, 21 Oct 2010 17:36:22 +0000 (18:36 +0100)]
tools: cpupools: xl: commands and library changes

Support of cpu pools in libxl and xl:
  library functions
  xl cpupool-create
  xl cpupool-list
  xl cpupool-destroy
  xl cpupool-cpu-add
  xl cpupool-cpu-remove
  xl cpupool-migrate
Renamed all cpu pool related names to *cpupool*

Signed-off-by: juergen.gross@ts.fujitsu.com
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools: cpupools: Rename cpu-pool commands in xm to cpupool-*
Juergen Gross [Thu, 21 Oct 2010 17:35:18 +0000 (18:35 +0100)]
tools: cpupools: Rename cpu-pool commands in xm to cpupool-*

The xm commands pool-* are renamed to cpupool-*
The old pool-* commands are defined as aliases.

Signed-off-by: juergen.gross@ts.fujitsu.com
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
--HG--
rename : tools/python/xen/xm/pool-create.py => tools/python/xen/xm/cpupool-create.py
rename : tools/python/xen/xm/pool-new.py => tools/python/xen/xm/cpupool-new.py
rename : tools/python/xen/xm/pool.py => tools/python/xen/xm/cpupool.py

15 years agotools: cpupools: Support arbitrary numbers of physical cpus
Juergen Gross [Thu, 21 Oct 2010 17:32:56 +0000 (18:32 +0100)]
tools: cpupools: Support arbitrary numbers of physical cpus

To be able to support arbitrary numbers of physical cpus it was necessary to
include the size of cpumaps in the xc-interfaces for cpu pools.
These were:
  definition of xc_cpupoolinfo_t
  xc_cpupool_getinfo()
  xc_cpupool_freeinfo()
xc_cpupool_getinfo() and xc_cpupool_freeinfo() are changed to allocate the
needed buffer and return it.

Signed-off-by: juergen.gross@ts.fujitsu.com
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxenstore: add xenstore-watch command line client
Ian Campbell [Thu, 21 Oct 2010 17:14:50 +0000 (18:14 +0100)]
xenstore: add xenstore-watch command line client

# xenstore-watch x | while read w ; do
> echo "watch fired on $w"
> echo "value" $(xenstore-read $w)
> echo
> done

# xenstore-write x/y/z 42

output from while loop:
        watch fired on x/t/z
        value 42

[ also add line to .hgignore - iwj ]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: fix spelling mistake in xl.conf
Ian Campbell [Thu, 21 Oct 2010 17:00:39 +0000 (18:00 +0100)]
xl: fix spelling mistake in xl.conf

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxenstored: return EINVAL for attempt to watch invalid path
Ian Campbell [Thu, 21 Oct 2010 16:56:51 +0000 (17:56 +0100)]
xenstored: return EINVAL for attempt to watch invalid path

errno is essentially random at this point.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agox86 hvm: When sending INIT-SIPI IPIs, pause the sending vcpu until the
Keir Fraser [Wed, 20 Oct 2010 16:26:51 +0000 (17:26 +0100)]
x86 hvm: When sending INIT-SIPI IPIs, pause the sending vcpu until the
asynchronous tasklet completes its work.

This is a little bit cleaner than busy-spinning in a retry loop.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agohvmloader: Properly block on xenstore daemon rather than merely yielding.
Keir Fraser [Wed, 20 Oct 2010 15:36:32 +0000 (16:36 +0100)]
hvmloader: Properly block on xenstore daemon rather than merely yielding.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agox86 hvm: Improve test for wait-for-SIPI state of a target VLAPIC.
Keir Fraser [Wed, 20 Oct 2010 08:56:36 +0000 (09:56 +0100)]
x86 hvm: Improve test for wait-for-SIPI state of a target VLAPIC.

This fixes a livelock in hvmloader with credit2 scheduler, whereby an
AP can be brought online, do its work, and shut itself down, before
the BSP re-emulates the VLAPIC write that sent the SIPI. BSP then ends
up in an endless re-emulation work where it sees the target vcpu is
down, therefore schedules a tasklet, which does no work because the
vcpu is already initialised. The fix is to check v->is_initialised
rather than VPF_down, before scheduling the tasklet.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agosvm: Re-enable 2MB super paging
Keir Fraser [Wed, 20 Oct 2010 07:41:58 +0000 (08:41 +0100)]
svm: Re-enable 2MB super paging

Bitwise OR operator has higher precedence than conditional
operator. This patch fixes the incorrect associativity and re-enables
2MB paging for AMD family 10h system.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Acked-by: Wei Huang <wei.huang2@amd.com>
15 years agomsi: Mask out multi-function flag from PCI_HEADER_TYPE in read_pci_mem_bar()
Keir Fraser [Wed, 20 Oct 2010 07:40:44 +0000 (08:40 +0100)]
msi: Mask out multi-function flag from PCI_HEADER_TYPE in read_pci_mem_bar()

This leads to an erroneous WARN_ON and possibly other side effects. It
seems to me that even multi-function devices ought to enjoy the
privilege of MSI-X capabilities.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
15 years agolibxc: use generic xc_get_pfn_list on ia64
Ian Campbell [Mon, 18 Oct 2010 16:40:08 +0000 (17:40 +0100)]
libxc: use generic xc_get_pfn_list on ia64

The ia64 specific xc_get_pfn_list doesn't seem any different to the
generic xc_get_pfn_list once the call to xc_ia64_get_pfn_list is
expanded so remove and just use the generic one.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: do not lock VCPU context in xc_ia64_pv_recv_vcpu_context
Ian Campbell [Mon, 18 Oct 2010 16:39:44 +0000 (17:39 +0100)]
libxc: do not lock VCPU context in xc_ia64_pv_recv_vcpu_context

xc_ia64_pv_recv_vcpu_context does not need to lock the ctxt buffer
since it calls xc_ia64_recv_vcpu_context which calls
xc_vcpu_setcontext which takes care of any necessary bouncing.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: drop xc_get_max_pages
Ian Campbell [Mon, 18 Oct 2010 16:38:15 +0000 (17:38 +0100)]
libxc: drop xc_get_max_pages

The function isn't really ia64 specific but since the result isn't
actually used in the only caller and the same info is available via
xc_domain_getinfo simply drop the function.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: simplify lock profiling API
Ian Campbell [Mon, 18 Oct 2010 16:37:50 +0000 (17:37 +0100)]
libxc: simplify lock profiling API

Current function has heavily overloaded semantics for the various
arguments. Separate out into more specific functions.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: simplify performance counters API
Ian Campbell [Mon, 18 Oct 2010 16:37:31 +0000 (17:37 +0100)]
libxc: simplify performance counters API

Current function has heavily overloaded semantics for the various
arguments. Separate out into more specific functions.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: make do_memory_op's callers responsible for locking indirect buffers
Ian Campbell [Mon, 18 Oct 2010 16:36:46 +0000 (17:36 +0100)]
libxc: make do_memory_op's callers responsible for locking indirect buffers

Push responsibility for locking buffers refered to by the memory_op
argument up into the callers (which are now all internal to libxc).

This removes the last of the introspecation from do_memory_op and
generally makes the transistion to hypercall buffers smoother.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: make xc_memory_op library private
Ian Campbell [Mon, 18 Oct 2010 16:35:59 +0000 (17:35 +0100)]
libxc: make xc_memory_op library private

Now that all XENMEM_* callers go via an op specific function make
xc_memory_op private to libxc (and rename to do_memory_op for
consistency with other private functions).

Also change the interface to take a size parameter so that
do_memory_op knows how much memory to lock for the top-level argument,
removing some of the introspection.

[ Compatibility note: this breaks qemu-xen before 706bc8c588cb ]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: remove compatibility macro for xc_domain_memory_populate_physmap
Ian Campbell [Mon, 18 Oct 2010 16:35:35 +0000 (17:35 +0100)]
libxc: remove compatibility macro for xc_domain_memory_populate_physmap

[ Compatibility note: this breaks qemu-xen before d3c5e73eb3ae ]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoQEMU_TAG update
Ian Jackson [Mon, 18 Oct 2010 16:28:02 +0000 (17:28 +0100)]
QEMU_TAG update

15 years agolibxc: add xc_maximum_ram_page to wrap XENMEM_maximum_ram_page
Ian Campbell [Mon, 18 Oct 2010 16:17:25 +0000 (17:17 +0100)]
libxc: add xc_maximum_ram_page to wrap XENMEM_maximum_ram_page

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: add xc_machphys_mfn_list to wrap XENMEM_machphys_mfn_list
Ian Campbell [Mon, 18 Oct 2010 16:16:59 +0000 (17:16 +0100)]
libxc: add xc_machphys_mfn_list to wrap XENMEM_machphys_mfn_list

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: add xc_domain_maximum_gpfn to wrap XENMEM_maximum_gpfn
Ian Campbell [Mon, 18 Oct 2010 16:16:13 +0000 (17:16 +0100)]
libxc: add xc_domain_maximum_gpfn to wrap XENMEM_maximum_gpfn

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: add xc_domain_add_to_physmap to wrap XENMEM_add_to_physmap
Ian Campbell [Mon, 18 Oct 2010 16:15:26 +0000 (17:15 +0100)]
libxc: add xc_domain_add_to_physmap to wrap XENMEM_add_to_physmap

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: add xc_domain_memory_exchange_pages to wrap XENMEM_exchange
Ian Campbell [Mon, 18 Oct 2010 16:14:07 +0000 (17:14 +0100)]
libxc: add xc_domain_memory_exchange_pages to wrap XENMEM_exchange

Generalised from exchange_page in xc_offline_page.c

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: wrappers for XENMEM {increase,decrease}_reservation and populate_physmap
Ian Campbell [Mon, 18 Oct 2010 15:54:42 +0000 (16:54 +0100)]
libxc: wrappers for XENMEM {increase,decrease}_reservation and populate_physmap

Currently the wrappers for these hypercalls swallow partial success
and return failure to the caller.

In order to use these functions more widely instead of open-coding
uses of XENMEM_* and xc_memory_op add variants which return the actual
hypercall result.

Therefore add the following functions:
  xc_domain_increase_reservation
  xc_domain_decrease_reservation
  xc_domain_populate_physmap
and implement the existing semantics using these new functions as
  xc_domain_increase_reservation_exact
  xc_domain_decrease_reservation_exact
  xc_domain_populate_physmap_exact
replacing the existing xc_domain_memory_* functions.

Use these new functions to replace all open coded uses of
XENMEM_increase_reservation, XENMEM_decrease_reservation and
XENMEM_populate_physmap.

Also rename xc_domain_memory_*_pod_target to xc_domain_*_pod_target
for consistency.

Temporarily add a compatibility macro for
xc_domain_memory_populate_physmap to allow time for qemu to catch up.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: use correct size of struct xen_mc
Ian Campbell [Mon, 18 Oct 2010 15:53:04 +0000 (16:53 +0100)]
libxc: use correct size of struct xen_mc

We want the size of the struct not the pointer (although rounding up
to page size in lock_pages probably saves us).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: remove unnecessary double indirection from xc_readconsolering
Ian Campbell [Mon, 18 Oct 2010 15:52:37 +0000 (16:52 +0100)]
libxc: remove unnecessary double indirection from xc_readconsolering

The double indirection has been unnecessary since 9867:ec61a8c25429,
there is no possibility of the buffer being reallocated now.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: pass an xc_interface handle to page locking functions
Ian Campbell [Mon, 18 Oct 2010 15:43:58 +0000 (16:43 +0100)]
libxc: pass an xc_interface handle to page locking functions

Not actually used here but useful to confirm that a handle is passed
down to each location where it will be required once we switch to
hypercall buffers.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: flask: use (un)lock pages rather than open coding m(un)lock.
Ian Campbell [Mon, 18 Oct 2010 15:43:15 +0000 (16:43 +0100)]
libxc: flask: use (un)lock pages rather than open coding m(un)lock.

Allows us to do away with safe_unlock and merge into unlock_pages.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agox86/msi: fix inverted masks in c/s 22182:68cc3c514a0a
Keir Fraser [Mon, 18 Oct 2010 10:31:47 +0000 (11:31 +0100)]
x86/msi: fix inverted masks in c/s 22182:68cc3c514a0a

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86 guest pagetable walker: check for invalid bits in pagetable
Keir Fraser [Mon, 18 Oct 2010 10:30:10 +0000 (11:30 +0100)]
x86 guest pagetable walker: check for invalid bits in pagetable
entries.

Some bits are reserved in x86 pagetable entries and must be zero; the
MMU should raise a pagefault if it sees them, with bit 3 set in the
error code.  Xen's software pagetable walker hasn't been doing this,
which has been OK because no guest OSes actually have invalid bits set
except in error cases where things are already very wrong.

Xen's shadow pagetable code deliberately sets these bits as part of
the not-present-entry fast path, so if we're to support
shadow-on-shadow nested HVM, we need to start checking them.

Signed-off-by: Tim Deeegan <Tim.Deegan@citrix.com>
15 years agopyxl: fix build of python xl binding for python < 2.5
Gianni Tedesco [Thu, 14 Oct 2010 11:46:29 +0000 (12:46 +0100)]
pyxl: fix build of python xl binding for python < 2.5

The python C API introduced Py_ssize_t in version 2.5. Prior to this
int's were used instead. Fix the build by way of a heinous preprocessor
macro.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agoxl: audit allocation of strings within libxl_device_*
Ian Campbell [Wed, 13 Oct 2010 11:01:30 +0000 (12:01 +0100)]
xl: audit allocation of strings within libxl_device_*

* Remove string literals from init_*_info.
* Free any existing string values before overwriting during device
  option parsing.
* Free libxl_device_console after use.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agolibxl: remove xs_writev function
Ian Campbell [Wed, 13 Oct 2010 10:54:04 +0000 (11:54 +0100)]
libxl: remove xs_writev function

It isn't actually being used to write a vector at the only callsite
and can easily be implemented using xs_write.

Furthermore the old implementation used to leak both the key and value
strings.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agopygrub: support grub2 "(hdX,msdosY)" partition syntax
Ian Campbell [Wed, 13 Oct 2010 10:45:26 +0000 (11:45 +0100)]
pygrub: support grub2 "(hdX,msdosY)" partition syntax

This appeared in Debian Squeeze at some point.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agoxl: correct migration_domname_r
Ian Campbell [Wed, 13 Oct 2010 10:37:02 +0000 (11:37 +0100)]
xl: correct migration_domname_r

22154:ed8019e672c6 causes migration_domname_r to be initialised as
d_config.c_info.name + "--incoming" immediately after setting
d_config.c_info.name. The intention appears to have been to set it to
common_domname + "--incoming" so do so.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agoMiniOS: Fix continue; in netfront receive loop
Samuel Thibault [Tue, 12 Oct 2010 09:27:56 +0000 (10:27 +0100)]
MiniOS: Fix continue; in netfront receive loop

To properly ignore some requests through the use of continue;, indexes need to
be updated.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agoReplace pyxml/xmlproc-based XML validator with lxml based one
Stephan Peijnik [Mon, 11 Oct 2010 16:54:53 +0000 (17:54 +0100)]
Replace pyxml/xmlproc-based XML validator with lxml based one

Pyxml/xmlproc is being used in tools/xen/xm/xenapi_create.py but is
unmaintained for several years now. xmlproc is used only for validating
XML documents against a DTD file.

This patch replaces the pyxml/xmlproc based XML validation with code
based on lxml, which is actively maintained.

Signed-off-by: Stephan Peijnik <spe@anexia.at>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agotools/tests: Test 64-bit x86 emulation in test_x86_emulate.
Keir Fraser [Mon, 11 Oct 2010 09:22:24 +0000 (10:22 +0100)]
tools/tests: Test 64-bit x86 emulation in test_x86_emulate.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agovmx: add missing VMCS definition
Keir Fraser [Mon, 11 Oct 2010 08:03:18 +0000 (09:03 +0100)]
vmx: add missing VMCS definition

This patch add back some missing VMCS defintions as preparation for
nested VMX.

Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
15 years agox86-64: workaround for BIOSes wrongly enabling LAHF_LM feature indicator
Keir Fraser [Mon, 11 Oct 2010 08:02:36 +0000 (09:02 +0100)]
x86-64: workaround for BIOSes wrongly enabling LAHF_LM feature indicator

This workaround is taken from Linux, and the main motivation (besides
such workarounds indeed belonging in the hypervisor rather than each
kernel) is to suppress the warnings in the Xen log each Linux guest
would cause due to the disallowed wrmsr.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86: emulate MSR_IA32_UCODE_REV Intel access protocol
Keir Fraser [Mon, 11 Oct 2010 08:01:45 +0000 (09:01 +0100)]
x86: emulate MSR_IA32_UCODE_REV Intel access protocol

Intel requires a write of zeros (hence such writes now get silently
ignored) followed by a cpuid(1) followed by the actual read.

Includes some code redundancy elimination possible after the actual
change.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoxl: Fix build in python binding since API change in 22229:1385b15e168f
Gianni Tedesco [Fri, 8 Oct 2010 10:41:57 +0000 (11:41 +0100)]
xl: Fix build in python binding since API change in 22229:1385b15e168f

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agoxl: Implement PCI passthrough force removal
Gianni Tedesco [Wed, 6 Oct 2010 16:38:15 +0000 (17:38 +0100)]
xl: Implement PCI passthrough force removal

This fixes two errors with removing PCI devices from HVM domains. The
first error is that the handling of "pci-rem" device-model command is
erroneously implemented in qemu and difficult (impossible?) to get
right.

For example, during domain shutdown there can be a race where the guest
OS unloads it's drivers and perhaps even shuts down PCI subsystem before
the pci-rem command has been received by qemu. This means that no OS is
present to write to the port which causes the dm command to be
acknowledged.

We fix this by implementing a 'force removal' option to
libxl_device_pci_remove which is always set to 1 during guest shutdown.
It can be optionally enabled on the xl command line for other occasions.

The second error is that if a guest OS doesn't respond to the SCI
interrupt and therefore the pci-rem dm command, which can happen if the
guest OS has no ACPI PCI hotplug support, then device removal bails with
an error but only AFTER removing the device from xenstore. This means
that xenstore gets in to an inconsistent state where an assigned device
also appears to be assignable.

This is fixed by moving xenstore device removal to occur only after the
device has really been removed.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agox86 hvm: Factor out hvm_map_guest_frame_{rw,ro} from hvm_map_entry
Keir Fraser [Wed, 6 Oct 2010 10:00:19 +0000 (11:00 +0100)]
x86 hvm: Factor out hvm_map_guest_frame_{rw,ro} from hvm_map_entry

This allows us to map pages from guest physical addresses.

This will be used with nested virtualization.

Signed-off-by: Uwe Dannowski <Uwe.Dannowski@amd.com>
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir@xen.org>
15 years agolibxl: remove console 0 backend directory from xenstore on devices destroy
Ian Campbell [Tue, 5 Oct 2010 16:51:28 +0000 (17:51 +0100)]
libxl: remove console 0 backend directory from xenstore on devices destroy

The first PV console device has an unusual frontend path for
historical reasons (/local/domain/<domid>/console rather than
/local/domain/<domid>/device/console/0).

Therefore we need to check this additional frontend path as well as
those under /local/domain/<domid>/device when tearing down all
backends or else we miss the backend for the console.

As part of this we need to ensure that the frontend directory has a
valid link to the backend, currently this link does not exist.

Fix this by adding libxl__device_frontend_path to return the correct
frontend path, accounting for the special case, and use it from
libxl__device_add_generic. Also add libxl__device_backend_path for
consistency.

This also allows console 0 setup to follow essentially the same code
path as other consoles within libxl_device_console_add, reducing the
special casing required there.

This also fixes the link from backend to frontend which until now gave
a dangling link to the normal device path instead of the exceptional
one.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agoFix copy and paste bug in libxl_run_bootloader
Christoph Egger [Tue, 5 Oct 2010 13:22:19 +0000 (14:22 +0100)]
Fix copy and paste bug in libxl_run_bootloader

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agox86_32: sh_clear_up_pointer is only used if CONFIG_PAGING_LEVELS >= 4
Keir Fraser [Mon, 4 Oct 2010 11:52:14 +0000 (12:52 +0100)]
x86_32: sh_clear_up_pointer is only used if CONFIG_PAGING_LEVELS >= 4

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
15 years agox86 shadow: reset up-pointers on all l3s when l3s stop being pinnable.
Keir Fraser [Sat, 2 Oct 2010 14:05:50 +0000 (15:05 +0100)]
x86 shadow: reset up-pointers on all l3s when l3s stop being pinnable.

Walking the pinned-shadows list isn't enough: there could be an
unpinned (but still shadowed) l3 somewhere and if we later try to
unshadow it it'll have an up-pointer of PAGE_LIST_NULL:PAGE_LIST_NULL.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
15 years agoVt-d: fix dom0 graphics problem on Levnovo T410.
Keir Fraser [Sat, 2 Oct 2010 14:04:21 +0000 (15:04 +0100)]
Vt-d: fix dom0 graphics problem on Levnovo T410.

The patch is derived from a similar quirk in Linux kernel by David
Woodhouse and Adam Jackson.  It checks for VT enabling bit in IGD GGC
register.  If VT is not enabled correctly in the IGD, Xen does not
enable VT-d translation for IGD VT-d engine.  In case where iommu boot
parameter is set to force, Xen calls panic().

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
15 years agox86: fix boot failure (regression from pre-4.0 IRQ handling changes)
Keir Fraser [Sat, 2 Oct 2010 14:03:15 +0000 (15:03 +0100)]
x86: fix boot failure (regression from pre-4.0 IRQ handling changes)

With the change to index irq_desc[] by IRQ rather than by vector, the
prior implicit change of the used flow handler when altering the IRQ
routing path to go through the 8259A didn't work anymore, and hence
on boards needing the ExtINT delivery workaround failed to boot.

Make make_8259A_irq() a real function again, thus allowing the flow
handler to be changed there.

Also eliminate the generally superfluous and (at least theoretically)
dangerous hard coded setting of the flow handler for IRQ0: Earlier
code should have set this already based on information coming from
ACPI/MPS, and non-standard systems may e.g. have this IRQ level
triggered.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Tested-by: Markus Schuster <ml@markus.schuster.name>
15 years agoVt-d: fix feature boot messages
Keir Fraser [Sat, 2 Oct 2010 14:00:05 +0000 (15:00 +0100)]
Vt-d: fix feature boot messages

Changed vt-d feature boot messages from "supported" to "enabled" since
they reflect what is currently enabled in this Xen boot - not what is
supported by VT-d hardware.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
15 years agolibxl: fix qemu-dm path
Christoph Egger [Fri, 1 Oct 2010 17:33:19 +0000 (18:33 +0100)]
libxl: fix qemu-dm path

qemu-dm is installed under libxl_libexec_path (not under
libxl_private_bindir_path).

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agoxl: allow parsing of both old and new cpuid syntax
Andre Przywara [Fri, 1 Oct 2010 16:22:40 +0000 (17:22 +0100)]
xl: allow parsing of both old and new cpuid syntax

Allow parsing of both versions of the cpuid syntax, the old xm used one
and the new one for xl. This works automatically, as the parser can tell
a Python list apart from a string before processing the line.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agolibxl: implementing legacy xm cpuid parser
Andre Przywara [Fri, 1 Oct 2010 16:21:01 +0000 (17:21 +0100)]
libxl: implementing legacy xm cpuid parser

To support compatibility with the xm config files, add a parser for the
old style cpuid= syntax. This uses a Python list, so it can be
distinguished from the new syntax easily.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agoxl: implement parsing of cpuid parameter and translate to Xen interface
Andre Przywara [Fri, 1 Oct 2010 16:20:41 +0000 (17:20 +0100)]
xl: implement parsing of cpuid parameter and translate to Xen interface

Parses a string enumerating cpuid flags and their behavior.
The syntax is: cpuid = "host,<flagname>=[01xks],..."
Supports:
0: clear this flag
1: set this flag
x: don't care, use the default handling
k: use the host value
s: as k, but keep stable across migrations

For multiple bit flags there have to be numbers passed (hex or dec),
like: family=0x10,model=4

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agoxl: use libxl_domain_info to get the uuid in printf_info
Andre Przywara [Fri, 1 Oct 2010 14:42:46 +0000 (15:42 +0100)]
xl: use libxl_domain_info to get the uuid in printf_info

If there is no UUID specified in the config file, we generate one during
the _parsing_ process. Since xl list -l parses the config file again,
the UUID will be generated again in this case and the reported
version does probably not match the used one.
Fix this by retrieving the UUID from dominfo (like xl list -v does).

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agox86 mm: free p2m pages to the shadow/hap pool.
Tim Deegan [Fri, 1 Oct 2010 10:57:53 +0000 (11:57 +0100)]
x86 mm: free p2m pages to the shadow/hap pool.

This allows the p2m code to dynamically free and reallocate memory
rather than just freeing everything once at domain teardown.
The previous mechanism (allocating p2m pages from shadow/hap
memory but freeing them directly to the domheap) was a relic
of the original shadow2's rather complex pool code.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
15 years agox86: adjust MSR_IA32_MISC_ENABLE handling
Keir Fraser [Fri, 24 Sep 2010 14:54:39 +0000 (15:54 +0100)]
x86: adjust MSR_IA32_MISC_ENABLE handling

In the warning message issued on writes, the Xen-modified value should
be printed (and used to determine whether anything needs to be printed
at all), as the guest kernel will usually do a read-modify-write
cycle.

A question is whether Dom0 shouldn't be allowed control over some
bits, or whether some bits shouldn't be fully virtualized. I'm
particularly thinking of MSR_IA32_MISC_ENABLE_FAST_STRING, which
recent Linux kernels want to disable for CONFIG_KMEMCHECK.

While putting this together I also noticed that rdmsr_safe() failed to
initialize its output registers in the failure path, thus leading to
printing of uninitialized data in the guest WRMSR warning message.

Further, the default case value-changed check can be simplified.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86: check CPUID level before enabling xsave
Keir Fraser [Fri, 24 Sep 2010 14:53:31 +0000 (15:53 +0100)]
x86: check CPUID level before enabling xsave

While not as relevant after c/s 21894, is still seems safer to check
the CPUID level here, just like Linux does. The is particularly
relevant for the 4.0 tree (which doesn't have said c/s), but also
possibly for nested environments where writing MSR_IA32_MISC_ENABLE
may not actually take effect (Xen itself ignores such writes).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoxl: Fix stack corruption caused by non-terminated call to libxl__xs_writev
Gianni Tedesco [Thu, 23 Sep 2010 18:16:00 +0000 (19:16 +0100)]
xl: Fix stack corruption caused by non-terminated call to libxl__xs_writev

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Tested-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools/python: do not link against blktap except on Linux
Gianni Tedesco [Thu, 23 Sep 2010 18:03:52 +0000 (19:03 +0100)]
tools/python: do not link against blktap except on Linux

Link to libblktapctl in python setup only for platforms which build it.
This fixes a build breakage on NetBSD introduced in 330c4d9010da.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Tested-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: Introduce a maximum limit for free_mem_slack (re (dom0) ballooning)
Stefano Stabellini [Thu, 23 Sep 2010 18:01:37 +0000 (19:01 +0100)]
libxl: Introduce a maximum limit for free_mem_slack (re (dom0) ballooning)

This fixes this message:
 libxl: error: libxl.c:2921:libxl_set_memory_target new target
               for dom0 is below the minimum threshold
which can occur spuriously if dom0_mem is specified and xl
autoballoning is left turned on.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxenpaging: page-in granttable entries
Keir Fraser [Wed, 22 Sep 2010 17:29:24 +0000 (18:29 +0100)]
xenpaging: page-in granttable entries

When converting a gfn to mfn, check if the page is paged-out.
If it is, request a page-in and return GNTST_eagain to the caller
to indicate a retry of the hypercall is required.
This fixes granttable errors when xenpaging is enabled in the guest.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
15 years agoxsm/flask: Code indentation.
Keir Fraser [Wed, 22 Sep 2010 17:28:16 +0000 (18:28 +0100)]
xsm/flask: Code indentation.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoxsm: return unlabeled instead of failing with ENOENT in get_page_sid
Keir Fraser [Wed, 22 Sep 2010 17:26:01 +0000 (18:26 +0100)]
xsm: return unlabeled instead of failing with ENOENT in get_page_sid

It is better to return an unlabeled SID in the case where dsec is NULL
instead of bailing out with an error.

From: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Signed-off-by: Keir Fraser <Keir.Fraser@eu.citrix.com>
15 years agoxl: parse maxmem parameter in VM config files
Stefano Stabellini [Wed, 22 Sep 2010 17:04:11 +0000 (18:04 +0100)]
xl: parse maxmem parameter in VM config files

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: proper accounting for the videoram
Stefano Stabellini [Wed, 22 Sep 2010 17:03:41 +0000 (18:03 +0100)]
libxl: proper accounting for the videoram

Remove the videoram from the memory target of the domains consistently,
leave the total amount of memory in maxmem.

[fixed up for conflicts with libxl__ naming policy changes -iwj]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: free memory before building a domain
Stefano Stabellini [Wed, 22 Sep 2010 17:02:36 +0000 (18:02 +0100)]
xl: free memory before building a domain

Free the needed amount of memory before proceeding with the domain
build.

Use a filelock to prevent other xl instances from conflicting during
this operation.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: Change default global config not to contain uncommented default
Ian Jackson [Wed, 22 Sep 2010 16:55:38 +0000 (17:55 +0100)]
xl: Change default global config not to contain uncommented default

[mistakenly applied v4 of patch 7/12 rather than v4b -iwj]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoConfig.mk et al: introduce XEN_LOCK_DIR
Stefano Stabellini [Wed, 22 Sep 2010 16:52:34 +0000 (17:52 +0100)]
Config.mk et al: introduce XEN_LOCK_DIR

Introduce a OS dependent global variable XEN_LOCK_DIR that points at the
system directory that contains lock files.

[fixed up for conflict in Config.mk -iwj]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: add a global configuration file
Stefano Stabellini [Wed, 22 Sep 2010 16:42:01 +0000 (17:42 +0100)]
xl: add a global configuration file

Add a global configuration file: /etc/xen/xl.conf; the only option
currently parsed is autoballoon that is 1 by default.

[fixed up for conflicts with libxl__ naming policy changes -iwj]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: introduce the concept of dom0 minimum memory
Stefano Stabellini [Wed, 22 Sep 2010 16:40:44 +0000 (17:40 +0100)]
libxl: introduce the concept of dom0 minimum memory

Introduce a minimum value for the memory assigned to dom0.

[fixed up for conflicts with libxl__ naming policy changes -iwj]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: add few more memory operations
Stefano Stabellini [Wed, 22 Sep 2010 16:39:32 +0000 (17:39 +0100)]
libxl: add few more memory operations

libxl_domain_need_memory: calculate how much memory a domain needs in
order to be built and start correctly.

libxl_get_free_memory: calculate the total free memory in the system.

libxl_wait_for_free_memory: wait for a certain amount of memory to
become free in the system.

libxl_wait_for_memory_target: wait for a domain to reach its memory
target.

[fixed up for conflicts with libxl__ naming policy changes -iwj]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: add a "relative" parameter to libxl_set_memory_target
Stefano Stabellini [Wed, 22 Sep 2010 16:37:09 +0000 (17:37 +0100)]
libxl: add a "relative" parameter to libxl_set_memory_target

Introduce a relative parameter to flag that target_memkb is a relative
amount of memory.  The first time we are reading/writing dom0 memory
target, fill the informations in xenstore if they are missing.

Introduce libxl_get_memory_target.

[fixed up for conflicts with libxl__ naming policy changes -iwj]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: use transactions in libxl_set_memory_target
Stefano Stabellini [Wed, 22 Sep 2010 16:31:45 +0000 (17:31 +0100)]
libxl: use transactions in libxl_set_memory_target

[fixed up for conflicts with libxl__ naming policy changes]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: do not modify static-max after domain creation
Stefano Stabellini [Wed, 22 Sep 2010 16:27:21 +0000 (17:27 +0100)]
libxl: do not modify static-max after domain creation

static-max represents the maximum memory the domain can ever have,
therefore it shouldn't be changed after domain creation.

[adjusted to cope with code movement since patch series written -iwj]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: add current_memkb to libxl_dominfo
Stefano Stabellini [Wed, 22 Sep 2010 16:23:22 +0000 (17:23 +0100)]
libxl: add current_memkb to libxl_dominfo

currently xcinfo2xlinfo reads tot_pages and uses that data to calculate
max_memkb, while tot_pages is the memory currently used by the domain
and max_pages is the theoretical maximum.
This patch calculates max_memkb from max_pages and introduces
current_memkb to store the current memory usage.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotmem: disallow bad gmfns from PV domains
Keir Fraser [Wed, 22 Sep 2010 07:54:08 +0000 (08:54 +0100)]
tmem: disallow bad gmfns from PV domains

Mfns for PV domains were not properly checked, potentially
allowing a buggy or malicious PV guest to crash Xen.  Also,
use get_page/put_page to claim a reference to the pages
so they can't disappear out from under tmem's feet.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
15 years agoRevert 22186:7167d6dd5c7c "x86: Retry do_mmu_update() a few times"
Keir Fraser [Wed, 22 Sep 2010 07:49:09 +0000 (08:49 +0100)]
Revert 22186:7167d6dd5c7c "x86: Retry do_mmu_update() a few times"

It does not work reliably for a couple of reasons:
(1) page_lock() fails if a page is !PGT_validated, and a page can
remain in that state for unbounded time.
(2) in the kernel-side race that motivated this patch, pgd_pin() can
lose to vmalloc_sync_all() -- pgd_pin() can try to chaneg a pmd page's
type to l2_pagetable while
vmalloc_sync_all()->set_pmd()->do_mmu_update() has it temporarily
pinned as writable. This is hard to fix on the Xen side.

Hence I give up on this approach, revert the patch, and settle for
kernel-side patching only.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agotools/ocaml: Fix caml-stubdom make line to depend on the ocaml cross compiler
Patrick Colp [Tue, 21 Sep 2010 16:54:43 +0000 (17:54 +0100)]
tools/ocaml: Fix caml-stubdom make line to depend on the ocaml cross compiler

The provided sample caml stubdom needs to use the ocaml cross
compiler, but if it hasn't been downloaded and compiled, then it won't
find it and the build will fail.  This makes caml-stubdom depend on
the cross compiler, so it will automatically get built before the
stubdom.

Signed-off-by: Patrick Colp <pjcolp@cs.ubc.ca>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: fix off-by-one mistake in block-attach handler
Jan Beulich [Tue, 21 Sep 2010 16:39:03 +0000 (17:39 +0100)]
xl: fix off-by-one mistake in block-attach handler

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: change xl_cfg_get_list to take a dont_warn parameter
Andre Przywara [Tue, 21 Sep 2010 15:41:09 +0000 (16:41 +0100)]
libxl: change xl_cfg_get_list to take a dont_warn parameter

xl_cfg_get_list can cope with the option not being a list, but
it always reports a warning in this case. Introduce a parameter
to omit this warning if needed. Future code can then decide what
to do with this information.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl, buildmakevars2file: Do not relink libxl each time
Ian Jackson [Tue, 21 Sep 2010 15:08:38 +0000 (16:08 +0100)]
libxl, buildmakevars2file: Do not relink libxl each time

Make Config.mk's definition of buildmakevars2file and
tools/libxl/Makefile's rule for _libxl_paths.h generate their files to
temporary files and only rename them into place if the intended file
has changed.  This gets rid of unnecessarily compilation and link
steps.

Add *.tmp to .hgignore.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Keir Fraser <keir.fraser@citrix.com>
15 years agotools/hotplug: Linux udev rules adjustment
Jan Beulich [Tue, 21 Sep 2010 14:59:01 +0000 (15:59 +0100)]
tools/hotplug: Linux udev rules adjustment

While earlier this year some work was done to eliminate libxc's
creation of nodes under /dev (as in some cases it actually got
things wrong), I just found that tapdisk2 does exactly the same.
While I'm not currently aiming at removing this code, I want to
at least suggest some adjustments to the provided rules file.

First of all, the present rule

KERNEL=="blktap[0-9]*", NAME="xen/%k"

matches both blktap1's devices and blktap2's ring devices,
resulting in whoever comes last replacing what was there
before (e.g. a tap2:aio: attach will replace bltap1's
/dev/blktap0 [i.e. the main control device] with the ring device
of the new virtual disk). Therefore we should add a subsystem
qualifier there.

Second, at some udev versions default to using 0660 as the
permissions on nodes it creates. The kernel (with devtmpfs)
defaults to 0600, and hence I'd suggest to also make this
explicit in the rules.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Boris Derzhavets <bderzhavets@yahoo.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools, build system: Detect distro-variant directories at build-time
Ian Jackson [Tue, 21 Sep 2010 11:17:04 +0000 (12:17 +0100)]
tools, build system: Detect distro-variant directories at build-time

In b59f87f56b1e, the defaults for some of the directory config
variables implicitly changed.  In this commit we arrange for the
defaults to be auto-detected (with the same logic as the run-time
scripts use).

This will make the build more likely to produce answers which the
builder intends.  (And, in particular, it should un-break the
automated tests, which didn't set these variables explicitly and
therefore got broken by b59f87f56b1e.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agox86: Retry do_mmu_update() a few times when called on a pte whose type is in flux.
Keir Fraser [Mon, 20 Sep 2010 19:11:43 +0000 (20:11 +0100)]
x86: Retry do_mmu_update() a few times when called on a pte whose type is in flux.

This can really happen -- all our PV Linux kernels have a race
between vmalloc_sync_all() and pgdir pinning/unpinning. The former is
protected by pgd_lock while the latter by mm->page_table_lock. Hence
they can happen concurrently, and vmalloc_sync_all() can attempt to
set_pmd() on a page directory which is in the process of being
pinned. This can confuse the hypervisor which may see a type change,
and hence fail do_mmu_update(). Until this patch. :-)

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86/hvm: fix extra size passed to __trace_var()
Keir Fraser [Mon, 20 Sep 2010 17:53:18 +0000 (18:53 +0100)]
x86/hvm: fix extra size passed to __trace_var()

While removing the casts on the last arguments to __trace_var() I
noticed the bogus addition of 1 here.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoEliminate unnecessary casts from __trace_var() invocations
Keir Fraser [Mon, 20 Sep 2010 17:52:48 +0000 (18:52 +0100)]
Eliminate unnecessary casts from __trace_var() invocations

This is possible now that its last parameter's type is 'const void *'.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoia64: fix gcc 4.5 warnings
Keir Fraser [Mon, 20 Sep 2010 17:51:19 +0000 (18:51 +0100)]
ia64: fix gcc 4.5 warnings

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86: protect MSI-X table and pending bit array from guest writes
Keir Fraser [Mon, 20 Sep 2010 17:50:38 +0000 (18:50 +0100)]
x86: protect MSI-X table and pending bit array from guest writes

These structures are used by Xen, and hence guests must not be able
to fiddle with them.

qemu-dm currently plays with the MSI-X table, requiring Dom0 to
still have write access. This is broken (explicitly allowing the guest
write access to the mask bit) and should be fixed in qemu-dm, at which
time Dom0 won't need any special casing anymore.

The changes are made under the assumption that p2m_mmio_direct will
only ever be used for order 0 pages.

An open question is whether dealing with pv guests (including the
IOMMU-less case) is necessary, as handling mappings a domain may
already have in place at the time the first interrupt gets set up
would require scanning all of the guest's L1 page table pages.
Currently a hole still remains allowing PV guests to map these ranges
before actually setting up any MSI-X vector for a device.

An alternative would be to determine and insert the address ranges
earlier into mmio_ro_ranges, but that would require a hook in the
PCI config space writes, which is particularly problematic in case
MMCONFIG accesses are being used.

A second alternative would be to require Dom0 to report all devices
(or at least all MSI-X capable ones) regardless of whether they would
be used by that domain, and do so after resources got determined/
assigned for them (i.e. a second notification later than the one
currently happening from the PCI bus scan would be needed).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Jiang, Yunhong <yunhong.jiang@intel.com>
15 years agorangesets: add function to query for overlaps
Keir Fraser [Mon, 20 Sep 2010 17:50:06 +0000 (18:50 +0100)]
rangesets: add function to query for overlaps

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agosched_credit: Raise bar for inter-socket migrations on mostly-idle systems
Keir Fraser [Mon, 20 Sep 2010 17:49:15 +0000 (18:49 +0100)]
sched_credit: Raise bar for inter-socket migrations on mostly-idle systems

The credit scheduler ties to keep work balanced, even on a mostly idle
system.  Unfortunately, if you have one VM burning cpu and another VM
idle, the effect is that the busy VM will flip back and forth between
sockets.

This patch addresses this, by only migrating to a different socket if
the number of idle processors is twice that of the socket the vcpu is
currently on.

This will only affect mostly-idle systems; as the system becomes more
busy, other load-balancing code will come into effect.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agotools, build system: Make changing distro-specific layout aspects easier
<bruce.edge@gmail.com> [Mon, 20 Sep 2010 16:54:25 +0000 (17:54 +0100)]
tools, build system: Make changing distro-specific layout aspects easier

Introduce CONFIG_LEAF_DIR, SUBSYS_DIR, INITD_DIR variables to cope
better with variation between distributions.

See docs/misc/distro_mapping.txt for details.

Signed-off-by: Bruce Edge <bruce.edge@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>