]> xenbits.xensource.com Git - people/vhanquez/xen-unstable.git/log
people/vhanquez/xen-unstable.git
12 years agoarm: avoid memory write in switch to Hyp mode
Tim Deegan [Fri, 1 Jun 2012 09:20:38 +0000 (10:20 +0100)]
arm: avoid memory write in switch to Hyp mode

Assemble the new CPSR in registers instead.  It's slightly cleaner,
And makes it possible to have a read-only text section.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: Move hyp-mode entry code out of line.
Tim Deegan [Fri, 1 Jun 2012 09:20:37 +0000 (10:20 +0100)]
arm: Move hyp-mode entry code out of line.

This code is grottier than the rest of the start-of-day code and
very specific to the software model we're developing on.
Segregate it accordingly, by putting it in its own file.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: More interrupt setup at start-of-day for secondary CPUs
Tim Deegan [Fri, 1 Jun 2012 09:20:36 +0000 (10:20 +0100)]
arm: More interrupt setup at start-of-day for secondary CPUs

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: implement event injection
Stefano Stabellini [Fri, 1 Jun 2012 09:20:35 +0000 (10:20 +0100)]
arm: implement event injection

Implement vcpu_mark_events_pending using the vgic to inject PPI 31, that
we reserve for Xen usage.
In the future the interrupt used for event injection might be dynamic
and could be written into the device tree.
Otherwise it could be an SGI choosen by the guest and passed to Xen
through an hypercall.

Considering that:

- it is easy to determine if an event notification
interrupt has already been EOI'd by the guest just looking at the
evtchn_upcall_pending bit in the shared_info page;

- we can safely assume that there is at most one event notification
interrupt pending at any time in any set of LR registers because we
never inject more than a single event notification interrupt in one vcpu
(see vcpu_mark_events_pending);

we can avoid requesting maintenance interrupts for
VGIC_IRQ_EVTCHN_CALLBACK, provided that we check for event notification
interrupts that need to be cleared in the following places:

- maintenance interrupt entry;

- gic_set_guest_irq;

that is every time we are about to write to an LR.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: remove VGIC_SOFTIRQ
Stefano Stabellini [Fri, 1 Jun 2012 09:20:35 +0000 (10:20 +0100)]
arm: remove VGIC_SOFTIRQ

Instead of using a softirq to check whether we need to set the VI bit in
the HCR (IRQ injection in the guest), always check the lr_mask on
leave_hypervisor_tail.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: implement flush_tlb_all_local and flush_tlb_local
Stefano Stabellini [Fri, 1 Jun 2012 09:20:34 +0000 (10:20 +0100)]
arm: implement flush_tlb_all_local and flush_tlb_local

Call flush_tlb_all_local from create_p2m_entries after removing a page
from the p2m.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: shared_info page allocation and mapping
Stefano Stabellini [Fri, 1 Jun 2012 09:20:33 +0000 (10:20 +0100)]
arm: shared_info page allocation and mapping

Allocate the shared_info page at domain creation.

Implement arch_memory_op, only for XENMEM_add_to_physmap with space ==
XENMAPSPACE_shared_info, so that the guest can map the shared_info page.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: replace list_del and INIT_LIST_HEAD with list_del_init
Stefano Stabellini [Fri, 1 Jun 2012 09:20:32 +0000 (10:20 +0100)]
arm: replace list_del and INIT_LIST_HEAD with list_del_init

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: support fewer LR registers than virtual irqs
Stefano Stabellini [Fri, 1 Jun 2012 09:20:31 +0000 (10:20 +0100)]
arm: support fewer LR registers than virtual irqs

If the vgic needs to inject a virtual irq into the guest, but no free
LR registers are available, add the irq to a list and return.
Whenever an LR register becomes available we add the queued irq to it
and remove it from the list.
We use the gic lock to protect the list and the bitmask.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agopassthrough: fix xsm-related oversight
Jan Beulich [Thu, 31 May 2012 08:18:52 +0000 (10:18 +0200)]
passthrough: fix xsm-related oversight

Presumably a copy-and-paste mistake, which I also didn't notice while
unifying x86's and ia64's respective domctl implementations.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86/EDD: check MBR for BIOS magic before considering signature valid
Jan Beulich [Thu, 31 May 2012 08:18:13 +0000 (10:18 +0200)]
x86/EDD: check MBR for BIOS magic before considering signature valid

Signed-off-by: Jan Beulich <JBeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86/amd: re-enable CPU topology extensions in case BIOS has disabled it
Andreas Herrmann [Thu, 31 May 2012 08:15:42 +0000 (10:15 +0200)]
x86/amd: re-enable CPU topology extensions in case BIOS has disabled it

BIOS will switch off the corresponding feature flag on family
15h models 10h-1fh non-desktop CPUs.

The topology extension CPUID leafs are required to detect which
cores belong to the same compute unit. (thread siblings mask is
set accordingly and also correct information about L1i and L2
cache sharing depends on this).

W/o this patch we wouldn't see which cores belong to the same
compute unit and also cache sharing information for L1i and L2
would be incorrect on such systems.

Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
12 years agoRename: inslen -> insn_len
Keir Fraser [Wed, 30 May 2012 12:25:51 +0000 (13:25 +0100)]
Rename: inslen -> insn_len

Signed-off-by: Keir Fraser <keir@xen.org>
12 years agotools/tests/xen-access: INT3 trap type is s/w exception.
Keir Fraser [Wed, 30 May 2012 12:23:31 +0000 (13:23 +0100)]
tools/tests/xen-access: INT3 trap type is s/w exception.

Signed-off-by: Keir Fraser <keir@xen.org>
12 years agoAdd instruction length and trap type in HVMOP_inject_trap.
Xudong Hao [Wed, 30 May 2012 10:38:41 +0000 (11:38 +0100)]
Add instruction length and trap type in HVMOP_inject_trap.

Signed-off-by: Xudong Hao <xudong.hao@intel.com>
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
12 years agoxl: xl.h depends on geenrated file _paths.h
Ian Campbell [Wed, 30 May 2012 09:57:10 +0000 (10:57 +0100)]
xl: xl.h depends on geenrated file _paths.h

Fixes build error.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agohvm: Add instruction length to hvm_trap info.
Keir Fraser [Wed, 30 May 2012 08:40:44 +0000 (09:40 +0100)]
hvm: Add instruction length to hvm_trap info.

Add documentation notes to vmx_inject_trap() and respect instruiction
length parameter for software-generated exceptions/interrupts.

Signed-off-by: Xudong Hao <xudong.hao@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
12 years agoxen: Define new struct hvm_trap and cleanup vmx exception
Keir Fraser [Wed, 30 May 2012 08:27:51 +0000 (09:27 +0100)]
xen: Define new struct hvm_trap and cleanup vmx exception

Define new struct hvm_trap to represent information of trap, and
renames hvm_inject_exception to hvm_inject_trap, then define a couple
of wrappers around that function for existing callers.

Signed-off-by: Keir Fraser <keir@xen.org>
Signed-off-by: Xudong Hao <xudong.hao@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agoxenpm: Fix reporting of C0 residence times
Boris Ostrovsky [Wed, 30 May 2012 08:26:02 +0000 (09:26 +0100)]
xenpm: Fix reporting of C0 residence times

Idle state residence times as provided by pmstat_get_cx_stat() are not
reported precisely since remote core may be in idle state and
therefore has not updated its statistics at the time local core
collected them.  This causes C0 residencies as calculated by xenpm to
sometimes become negative.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agox86: document register for 6th hypercall argument
David Vrabel [Wed, 30 May 2012 08:25:11 +0000 (09:25 +0100)]
x86: document register for 6th hypercall argument

From: David Vrabel <david.vrabel@citrix.com>

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agognttab: cleanup
Jan Beulich [Wed, 30 May 2012 08:23:33 +0000 (09:23 +0100)]
gnttab: cleanup

- introduce local variables (shortcuts for frequently used
  <dom>->grant_table)
- adjust first parameter of mapcount()
- drop lock acquisition from gnttab_get_version()
- remove hard tabs and adjust formatting

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Andrew Thomas <andrew.thomas@oracle.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agognttab: mark maptrack free list tail with an explicit terminator
Jan Beulich [Wed, 30 May 2012 08:22:51 +0000 (09:22 +0100)]
gnttab: mark maptrack free list tail with an explicit terminator

... instead of using the mutable current limit.

This also addresses an apparent off-by-one mistake when checking for
exhaustion of the maptrack table.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Andrew Thomas <andrew.thomas@oracle.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agognttab: don't use domain lock for serialization
Jan Beulich [Wed, 30 May 2012 08:22:17 +0000 (09:22 +0100)]
gnttab: don't use domain lock for serialization

Instead use the affected domain's grant table lock, at once reducing
the scopes during which locks are being held and hence allowing
significantly better parallelism.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Andrew Thomas <andrew.thomas@oracle.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agox86: fix nested HVM initialization
Jan Beulich [Wed, 30 May 2012 08:21:04 +0000 (09:21 +0100)]
x86: fix nested HVM initialization

- no need for calling nestedhvm_setup() explicitly (can be a normal
  init-call, and can be __init)
- calling _xmalloc() for multi-page, page-aligned memory regions is
  inefficient - use alloc_xenheap_pages() instead
- albeit an allocation error is unlikely here, add error handling
  nevertheless (and have nestedhvm_vcpu_initialise() bail if an error
  occurred during setup)
- nestedhvm_enabled() must no access d->arch.hvm_domain without first
  checking that 'd' actually represents a HVM domain

Signed-off-by: Jan Beulich <JBeulich@suse.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agolibxl: make libxl__e820_alloc a static function
Stefano Stabellini [Wed, 30 May 2012 07:57:52 +0000 (08:57 +0100)]
libxl: make libxl__e820_alloc a static function

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: move e820_names, e820_sanitize, libxl__e820_alloc to libxl_x86.c
Stefano Stabellini [Wed, 30 May 2012 07:57:52 +0000 (08:57 +0100)]
libxl: move e820_names, e820_sanitize, libxl__e820_alloc to libxl_x86.c

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Introduce libxl__arch_domain_create (x86 version)
Stefano Stabellini [Wed, 30 May 2012 07:57:51 +0000 (08:57 +0100)]
libxl: Introduce libxl__arch_domain_create (x86 version)

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Introduce libxl__arch_domain_create
Stefano Stabellini [Wed, 30 May 2012 07:57:50 +0000 (08:57 +0100)]
libxl: Introduce libxl__arch_domain_create

Introduce an arch specific internal domain creation function.
The X86 version of libxl__arch_domain_create is going to be introduced
in the next few patches, to make it easier to spot all the code motions.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: compile libxl
Stefano Stabellini [Wed, 30 May 2012 07:57:49 +0000 (08:57 +0100)]
arm: compile libxl

libxl_cpuid_destroy has been renamed to libxl_cpuid_dispose; also cpuid
functions are only available on x86, so move them to libxl_cpuid.c.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: compile xentrace
Stefano Stabellini [Wed, 30 May 2012 07:57:48 +0000 (08:57 +0100)]
arm: compile xentrace

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: compile memshr
Stefano Stabellini [Wed, 30 May 2012 07:57:48 +0000 (08:57 +0100)]
arm: compile memshr

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <Ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoarm: compile libxenguest
Stefano Stabellini [Wed, 30 May 2012 07:57:47 +0000 (08:57 +0100)]
arm: compile libxenguest

Introduce an empty implementation of the arch specific ARM functions in
xc_dom_arm.c.
Provide empty implementations of xc_domain_save and xc_domain_restore
when CONFIG_MIGRATE is not set.
Move xc_hvm_build.c to xc_hvm_build_x86.c because the implementation is
x86 specific, introduce xc_hvm_build_arm.c with empty stubs.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: remove lockdir and config dir from the API
Ian Campbell [Tue, 29 May 2012 15:44:06 +0000 (16:44 +0100)]
libxl: remove lockdir and config dir from the API

These are only used by xl.

Rename _libxl_paths.h -> _paths.h, these are not actually "libxl" paths but
rather are part of the Xen build time configuration. It is fine for xl to also
consume them.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: destroy the disk on successful removal during block-detach
Stefano Stabellini [Tue, 29 May 2012 15:36:53 +0000 (16:36 +0100)]
xl: destroy the disk on successful removal during block-detach

main_blockdetach needs to call libxl_device_disk_destroy so that all the
disk related entries are properly removed from xenstore.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: add qdisk to libxl_string_to_backend
Stefano Stabellini [Tue, 29 May 2012 15:36:53 +0000 (16:36 +0100)]
libxl: add qdisk to libxl_string_to_backend

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: wait for state "connected" in libxl__device_disk_local_attach
Stefano Stabellini [Tue, 29 May 2012 15:36:52 +0000 (16:36 +0100)]
libxl: wait for state "connected" in libxl__device_disk_local_attach

In order to make sure that the block device is available and ready to be
used, wait for state "connected" in the backend before returning.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
[ ijc -- resolved simple conflict in libxl__device_disk_local_detach ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl/libxl: implement QDISK libxl_device_disk_local_attach
Stefano Stabellini [Tue, 29 May 2012 15:36:51 +0000 (16:36 +0100)]
xl/libxl: implement QDISK libxl_device_disk_local_attach

- Spawn a QEMU instance at boot time to handle disk local attach
requests.

- Implement libxl__device_disk_local_attach for QDISKs in terms of a
regular disk attach with the frontend and backend running in the same
domain.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: introduce libxl__alloc_vdev
Stefano Stabellini [Tue, 29 May 2012 15:36:50 +0000 (16:36 +0100)]
libxl: introduce libxl__alloc_vdev

Introduce libxl__alloc_vdev: find a spare virtual block device in the
domain passed as argument.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl/libxl: add a blkdev_start parameter
Stefano Stabellini [Tue, 29 May 2012 15:36:49 +0000 (16:36 +0100)]
xl/libxl: add a blkdev_start parameter

Introduce a blkdev_start in xl.conf and a corresponding string in
libxl_domain_build_info.

Add a blkdev_start parameter to libxl__device_disk_local_attach: it is
going to be used in a following patch.

blkdev_start specifies the first block device to be used for temporary
block device allocations by the toolstack.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: introduce libxl__device_disk_add
Stefano Stabellini [Tue, 29 May 2012 15:36:48 +0000 (16:36 +0100)]
libxl: introduce libxl__device_disk_add

Introduce libxl__device_disk_add that takes an additional
xs_transaction_t paramter.
Implement libxl_device_disk_add using libxl__device_disk_add.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: export libxl__device_from_disk
Stefano Stabellini [Tue, 29 May 2012 15:36:48 +0000 (16:36 +0100)]
libxl: export libxl__device_from_disk

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: add a transaction parameter to libxl__device_generic_add
Stefano Stabellini [Tue, 29 May 2012 15:36:47 +0000 (16:36 +0100)]
libxl: add a transaction parameter to libxl__device_generic_add

Add a xs_transaction_t parameter to libxl__device_generic_add, if it is
XBT_NULL, allocate a proper one.

Update all the callers.

This patch contains a large number of unchecked xenstore operations, we
might want to fix this in the future.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: libxl__device_disk_local_attach return a new libxl_device_disk
Stefano Stabellini [Tue, 29 May 2012 15:36:46 +0000 (16:36 +0100)]
libxl: libxl__device_disk_local_attach return a new libxl_device_disk

Introduce a new libxl_device_disk* parameter to
libxl__device_disk_local_attach, the parameter is allocated by the
caller. libxl__device_disk_local_attach is going to fill the new disk
with informations about the new locally attached disk.  The new
libxl_device_disk should be passed to libxl__device_disk_local_detach
afterwards.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: make libxl_device_disk_local_attach/detach internal functions
Stefano Stabellini [Tue, 29 May 2012 15:36:45 +0000 (16:36 +0100)]
libxl: make libxl_device_disk_local_attach/detach internal functions

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: introduce libxl_vcpuinfo_list_free
Dario Faggioli [Tue, 29 May 2012 10:36:36 +0000 (11:36 +0100)]
libxl: introduce libxl_vcpuinfo_list_free

And fix a leak due to it being missing.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxenstore: fix crash on platforms with no gntdev driver implementation.
Christoph Egger [Tue, 29 May 2012 10:12:45 +0000 (11:12 +0100)]
xenstore: fix crash on platforms with no gntdev driver implementation.

Fix pointer checks introduced in changeset 24757:aae516b78fce.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: remove all local "ctx" variables
Ian Campbell [Tue, 29 May 2012 09:31:39 +0000 (10:31 +0100)]
xl: remove all local "ctx" variables

xl has a global "ctx" variable, so there should be no need to pass a
ctx to any function.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
[ ijc -- dropped xl_fork hunks on commit, this aspect was already done in
         xl: track child processes for the benefit of libxl ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: do not overwrite user supplied config when running bootloader
Ian Campbell [Tue, 29 May 2012 09:31:38 +0000 (10:31 +0100)]
libxl: do not overwrite user supplied config when running bootloader

Currently when running the bootloader libxl will update b_info->u.pv.kernel,
.ramdisk, .cmdline and .bootloader.  This can expose internal details, such
as temporary paths in /var/run/xen/bootloader.*/ to the user. This is
problematic because it means that the user cannot re-use the struct as is.

This does not effect xl in Xen 4.2+ since it always reparses the guest config
and reinitialises the build info, however it did cause issues with reboot in
4.1 (reported by Dmitry Morozhnikov) and may cause issues for other users of
libxl.

Instead make the libxl bootloader infrastructure provide output to its caller
which is slurped into the internal libxl__domain_build_state datastructure. If
no bootloader is configured then the bootloader instead propagates the user
supplied b_info config.

In order to simplify this push the error handling for the case where there is
no bootdisk down into libxl__bootloader_run. In principal there is no reason
why it shouldn't be possible to do a pure netboot guest with a suitable
bootloader, but I don't fix that here.

This change allow us to make the libxl_file_reference an internal API, and
eventually we might be able to get rid of it.

Also removes the publix libxl_run_bootloader interface, neither xl nor libvirt
use it.

I am proposing this for 4.2 due to the API change.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
[ ijc -- reduced log message in libxl__build_pv from INFO to DEBUG ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: track child processes for the benefit of libxl
Ian Jackson [Tue, 29 May 2012 09:31:37 +0000 (10:31 +0100)]
xl: track child processes for the benefit of libxl

Each time xl forks, it needs to record the pid, so that its exit
status can be preserved if it happens that libxl's event loop reaped
it.  Consequently we also have a new wrapper for waitpid, which in
that case returns the previously-reaped status.

When we get a console ready callback from libxl, check to see if we
have spawned but not reaped a previous console client, and if so reap
it now.  (This is necessary to prevent improper use of the xlchild
struct, but has the happy consequence of checking the exit status of
the first console client in the pygrub case.)

Refactor the two calls to libxl_ctx_alloc into a new function
xl_ctx_alloc which also sets the child reaped handler callback.

All of this has the effect of suppressing a message
   unknown child [nnnn] unexpected exited status zero
which would sometimes (depending on a race) appear with `xl create -c'
and pygrub.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reported-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Roger Pau Monne <roger.pau@citrix.com>
[ ijc -- corrected return codes in xl_reaped_callback to match documented
         convention. ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: Remus - fix docs
Shriram Rajagopalan [Tue, 29 May 2012 09:31:37 +0000 (10:31 +0100)]
xl: Remus - fix docs

Explicitly mention that the current state of Remus support in xl
is experimental, with no disk/network buffering support.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: When checking BDF of existing slots, function should be decimal, not hex
George Dunlap [Tue, 29 May 2012 09:31:36 +0000 (10:31 +0100)]
libxl: When checking BDF of existing slots, function should be decimal, not hex

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Spotted-by: Konrad Wilk <konrad.wilk@oracle.com>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86_64: Record entry vector for double faults.
Andrew Cooper [Fri, 25 May 2012 07:21:25 +0000 (08:21 +0100)]
x86_64: Record entry vector for double faults.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agoxen: domain_pirq_to_emuirq return IRQ_UNBOUND by default
Stefano Stabellini [Fri, 25 May 2012 07:20:14 +0000 (08:20 +0100)]
xen: domain_pirq_to_emuirq return IRQ_UNBOUND by default

domain_pirq_to_emuirq should return IRQ_UNBOUND rather than 0 on
missing entries.  Add a default parameter to pirq_field, so that
callers can set any default return value they want; use IRQ_UNBOUND in
domain_pirq_to_emuirq.

This patch fixes a regression introduced by 23573: save/restore
failing on upstream QEMU with PV on HVM guests.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agoamd iommu: improve parse_event_log_entry()
Jan Beulich [Wed, 23 May 2012 15:20:18 +0000 (17:20 +0200)]
amd iommu: improve parse_event_log_entry()

- message table should be static (no need to set it up each time the
  function gets executed)
- don't bail on out-of-range event code values
- use message table also to print the kind of otherwise unhandled
  event codes

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Wang <wei.wang2@amd.com>
12 years agoamd iommu: Add workaround for erratum 732 & 733
Wei Wang [Wed, 23 May 2012 15:18:06 +0000 (17:18 +0200)]
amd iommu: Add workaround for erratum 732 & 733

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Add missing barriers. Fix early return from parse_ppr_log_entry().
Slightly adjust comments. Strip trailing blanks.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
12 years agolibxl: reorder libxl_device unplug functions
Roger Pau Monne [Wed, 23 May 2012 10:06:49 +0000 (11:06 +0100)]
libxl: reorder libxl_device unplug functions

This is a reorder of functions, no functional change. This is needed
because in future patches much code is added to libxl_device and it
needs to follow the usual ao operation scheme (prototypes, functions
and callbacks in order they should be called)

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: add libxl__xs_path_cleanup
Roger Pau Monne [Wed, 23 May 2012 10:06:48 +0000 (11:06 +0100)]
libxl: add libxl__xs_path_cleanup

Add a function which behaves like "xenstore-rm -t", and which will be
used to clean xenstore after unplug since we will be no longer
executing xen-hotplug-cleanup script, that used to do that for us.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix libxl__xs_directory usage of transaction
Roger Pau Monne [Wed, 23 May 2012 10:06:47 +0000 (11:06 +0100)]
libxl: fix libxl__xs_directory usage of transaction

libxl__xs_directory takes a transaction parameter, but completely
ignores it, passing XBT_NULL unconditionally to xs_directory.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: pass env vars to libxl__exec
Roger Pau Monne [Wed, 23 May 2012 10:06:47 +0000 (11:06 +0100)]
libxl: pass env vars to libxl__exec

Add another parameter to libxl__exec call that contains the
environment variables to use when performing the execvp call.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86: don't hold off NMI delivery when MCE is masked
Jan Beulich [Tue, 22 May 2012 14:30:11 +0000 (16:30 +0200)]
x86: don't hold off NMI delivery when MCE is masked

Likely through copy'n'paste, all three instances of guest MCE
processing jumped to the wrong place (where NMI processing code
correctly jumps to) when MCE-s are temporarily masked (due to one
currently being processed by the guest). A nested, unmasked NMI should
get delivered immediately, however.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86: prevent call to xfree() in dump_irqs() while in an irq context
Andrew Cooper [Tue, 22 May 2012 14:28:45 +0000 (16:28 +0200)]
x86: prevent call to xfree() in dump_irqs() while in an irq context

Because of c/s 24707:96987c324a4f, dump_irqs() can now be called in an
irq context when a bug condition is encountered. If this is the case,
ignore the call to xsm_show_irq_ssid() and the subsequent call to
xfree().

This prevents an assertion failure in xfree(), and should allow all the
debug information to be dumped, before failing with a BUG() because of
the underlying race condition we are attempting to reproduce.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Rather than using the non-obvious conditional around an xfree() that
would be passed NULL only in the inverse case (which could easily get
removed by a future change on the basis that calling xfree(NULL) is
benign), switch the order of checks in xfree() itself and only suppress
the call to XSM that could potentially call xmalloc().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
12 years agolibxl: events: debugging output relating to ao's
Ian Jackson [Tue, 22 May 2012 10:55:02 +0000 (11:55 +0100)]
libxl: events: debugging output relating to ao's

(In libxl__ao_complete_check_progress_reports, introduce libxl_ctx *ctx.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: events: debugging output for fds
Ian Jackson [Tue, 22 May 2012 10:55:01 +0000 (11:55 +0100)]
libxl: events: debugging output for fds

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: events: improve debugging output for xs watches
Ian Jackson [Tue, 22 May 2012 10:55:01 +0000 (11:55 +0100)]
libxl: events: improve debugging output for xs watches

* Add debugging output for register/deregister.
* Make the debugging printfs consistent about the order in which they
  print the information.
* Where we touch the code, change LIBXL__LOG to LOG.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: events: debugging output for timeouts
Ian Jackson [Tue, 22 May 2012 10:55:00 +0000 (11:55 +0100)]
libxl: events: debugging output for timeouts

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86: don't call generic_identify() redundantly
Jan Beulich [Mon, 21 May 2012 10:03:32 +0000 (12:03 +0200)]
x86: don't call generic_identify() redundantly

Right before calling struct cpu_dev's ->c_identify, if non-NULL,
identify_cpu() calls generic_identify(). Hence there's no point for
->c_identify to point to generic_identify, nor for the handler to call
that function. After removing all pointless uses, the function isn't
being used outside the file that's defininig it anymore, and hence can
become static.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agoserial: serial_irq() and descendants can be __init
Jan Beulich [Mon, 21 May 2012 10:00:54 +0000 (12:00 +0200)]
serial: serial_irq() and descendants can be __init

... as being solely called from smp_intr_init(), which itself is
marked such.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86/mem_sharing: Allow paging-in pages to be replaced by shared ones.
Andres Lagar-Cavilla [Fri, 18 May 2012 15:19:21 +0000 (16:19 +0100)]
x86/mem_sharing: Allow paging-in pages to be replaced by shared ones.

Making sure to tidy up any partially paged frames.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
12 years agolibxl: initialise ao when starting pvqemu for stubdomain
Ian Campbell [Fri, 18 May 2012 12:40:00 +0000 (13:40 +0100)]
libxl: initialise ao when starting pvqemu for stubdomain

libxl__spawn_local_dm requires the ao to be initialised.

Without this starting an HVM guest with a stub qemu hits the
    assert(ao->magic == LIBXL__AO_MAGIC);
in the STATE_AO_GC call from libxl__spawn_local_dm.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: avoid double free of b_info->u.pv.bootloader
Ian Campbell [Fri, 18 May 2012 12:39:59 +0000 (13:39 +0100)]
libxl: avoid double free of b_info->u.pv.bootloader

b_info is a user provided struct and therefore the content must come from
malloc and not gc such that libxl_domain_build_info_dispose can free it. This
was broken by 25340:373f24c87dee.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Remus - xl remus command
Shriram Rajagopalan [Fri, 18 May 2012 10:00:45 +0000 (11:00 +0100)]
libxl: Remus - xl remus command

xl remus acts as a frontend to enable remus for a given domain.
 * At the moment, only memory checkpointing and blackhole replication is
   supported. Support for disk checkpointing and network buffering will
   be added in future.
 * Replication is done over ssh connection currently (like live migration
   with xl). Future versions will have an option to use simple tcp socket
   based replication channel (for both Remus & live migration).

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Remus - suspend/postflush/commit callbacks
Shriram Rajagopalan [Fri, 18 May 2012 10:00:44 +0000 (11:00 +0100)]
libxl: Remus - suspend/postflush/commit callbacks

 * Add libxl callback functions for Remus checkpoint suspend, postflush
   (aka resume) and checkpoint commit callbacks.
 * suspend callback is a stub that just bounces off
   libxl__domain_suspend_common_callback - which suspends the domain and
   saves the devices model state to a file.
 * resume callback currently just resumes the domain (and the device model).
 * commit callback just writes out the saved device model state to the
   network and sleeps for the checkpoint interval.
 * Introduce a new public API, libxl_domain_remus_start (currently a stub)
   that sets up the network and disk buffer and initiates continuous
   checkpointing.

 * Future patches will augment these callbacks/functions with more functionalities
   like issuing network buffer plug/unplug commands, disk checkpoint commands, etc.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: resume instead of unpause on xl save -c
Shriram Rajagopalan [Fri, 18 May 2012 10:00:43 +0000 (11:00 +0100)]
libxl: resume instead of unpause on xl save -c

The guest is "suspended" via libxl_domain_suspend when taking a snapshot.
So call libxl_domain_resume instead of libxl_domain_unpause, when taking
a checkpoint of the domain (using xl save -c).

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: refactor migrate_domain and generalize migrate_receive
Shriram Rajagopalan [Fri, 18 May 2012 10:00:42 +0000 (11:00 +0100)]
libxl: refactor migrate_domain and generalize migrate_receive

Refactor some tasks like establishing the migration channel,
initial migration protocol exchange into separate functions,
to facilitate re-use, when remus support is introduced. Also,
make migrate_receive generic (instead of resorting to stdin and
stdout as the file descriptors for communication).

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: support suspend_cancel in domain_resume
Shriram Rajagopalan [Fri, 18 May 2012 10:00:41 +0000 (11:00 +0100)]
libxl: support suspend_cancel in domain_resume

Add an extra parameter to libxl_domain_resume indicating
if the caller wishes to use the SUSPEND_CANCEL style
resume instead of the normal resume.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: QMP stop/resume & refactor QEMU suspend/resume/save
Shriram Rajagopalan [Fri, 18 May 2012 10:00:41 +0000 (11:00 +0100)]
libxl: QMP stop/resume & refactor QEMU suspend/resume/save

Implement QMP stop and resume functionality and split
device model save into 3 parts:
 suspend_dm(domid)
 save_dm(domid, fd)
 resume_dm(domid)

Integrate Device model suspend into suspend_common_callback

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix build on platforms where openpty's parameters are not const.
Christoph Egger [Thu, 17 May 2012 13:45:43 +0000 (14:45 +0100)]
libxl: fix build on platforms where openpty's parameters are not const.

Such as NetBSD. Fixes this build error:

libxl_aoutils.c: In function 'libxl__openptys':
libxl_aoutils.c:281:13: error: passing argument 4 of 'openpty' discards
qualifiers from pointer target type
/usr/include/util.h:92:6: note: expected 'struct termios *' but argument
is of type 'const struct termios *'
libxl_aoutils.c:281:13: error: passing argument 5 of 'openpty' discards
qualifiers from pointer target type
/usr/include/util.h:92:6: note: expected 'struct winsize *' but argument
is of type 'const struct winsize *'

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl, xl: fix bootloader immediate console attach
Ian Jackson [Thu, 17 May 2012 13:45:42 +0000 (14:45 +0100)]
libxl, xl: fix bootloader immediate console attach

Fix bugs related to console handling:

 * In libxl_primary_console_exec, if libxl__domain_type fails, do
   not abort, but instead log and return an error.  This can occur
   if the domid is invalid.

 * In xl's autoconnect_console, rename the ctx formal parameter so
   that when postfork creates a new ctx and puts it in the global ctx,
   we don't end up using the old one (via the formal parameter which
   has shadowed the global).

 * In xl's autoconnect_console, pass the domid from the event
   to libxl_primary_console_exec, rather than using the global domid
   (which has not yet been set, since it is only set at completion
   of the ao).

This causes xl create -c to once more work with pygrub.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Do not use-after-free on ao progress reporting
Ian Jackson [Thu, 17 May 2012 13:45:41 +0000 (14:45 +0100)]
libxl: Do not use-after-free on ao progress reporting

We need to call libxl__free_all after egc_run_callbacks since some of
the callbacks might be ao progress reports allocated from the egc's
gc.

Fixes a segfault in egc_run_callbacks.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: events: STATE_AO_GC checks ao is still valid
Ian Jackson [Thu, 17 May 2012 13:45:40 +0000 (14:45 +0100)]
libxl: events: STATE_AO_GC checks ao is still valid

This will catch earlier the mistake where an ao is completed while it
still has events registered: when the event callback happens for the
long-gone ao, we will crash before attempting to execute any of the
operation-specific code.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86/mem_sharing: Fix test for "empty" physmap entry in sharing_add_to_physmap
Tim Deegan [Thu, 17 May 2012 09:37:09 +0000 (10:37 +0100)]
x86/mem_sharing: Fix test for "empty" physmap entry in sharing_add_to_physmap

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
12 years agox86/p2m, arm/p2m: remove get_gfn_untyped().
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
x86/p2m, arm/p2m: remove get_gfn_untyped().

Adjust its only user to use get_gfn.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86/hvm/svm: used unlocked p2m lookups in trace and error paths.
Andres Lagar-Cavilla [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
x86/hvm/svm: used unlocked p2m lookups in trace and error paths.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
12 years agox86/hvm: use unlocked p2m lookups in hvmemul_rep_movs()
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
x86/hvm: use unlocked p2m lookups in hvmemul_rep_movs()

The eventual hvm_copy or IO emulations will re-check the p2m and DTRT.

Signed-off-by: Tim Deegan <tim@xen.org>
12 years agogrant-tables: Use get_page_from_gfn() instead of get_gfn()/put_gfn.
Andres Lagar-Cavilla [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
grant-tables: Use get_page_from_gfn() instead of get_gfn()/put_gfn.

This requires some careful re-engineering of __get_paged_frame and its callers.
Functions that previously returned gfn's to be put now return pages to be put.

Tested with Win7 + Citrix PV drivers guest, using speedtest for networking
(yes!) plus the loginVSI framework to constantly hit disk.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
12 years agocommon: Use get_page_from_gfn() instead of get_gfn()/put_gfn.
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
common: Use get_page_from_gfn() instead of get_gfn()/put_gfn.

Signed-off-by: Tim Deegan <tim@xen.org>
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
12 years agox86: Use get_page_from_gfn() instead of get_gfn()/put_gfn.
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
x86: Use get_page_from_gfn() instead of get_gfn()/put_gfn.

Signed-off-by: Tim Deegan <tim@xen.org>
12 years agox86/mm: Use get_page_from_gfn() instead of get_gfn()/put_gfn.
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
x86/mm: Use get_page_from_gfn() instead of get_gfn()/put_gfn.

Signed-off-by: Tim Deegan <tim@xen.org>
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
12 years agox86/hvm: Use get_page_from_gfn() instead of get_gfn()/put_gfn.
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
x86/hvm: Use get_page_from_gfn() instead of get_gfn()/put_gfn.

Signed-off-by: Tim Deegan <tim@xen.org>
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
12 years agoarm: Implement get_page_from_gfn()
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
arm: Implement get_page_from_gfn()

We will be calling this from common code, so add a basic
implementation to arch/arm.

After 4.2 we should reshuffle some of the p2m interface out of
arch/x86 into common headers; for now duplicate a little bit of it.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86/mm: Introduce get_page_from_gfn().
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
x86/mm: Introduce get_page_from_gfn().

This new function does a p2m lookup under the read lock, falling back
to the write lock only if it needs to make a change.  If the GFN is
backed by RAM, it takes a refcount on the underlying page.

The following patches will convert many paths that currently use
get_gfn/put_gfn to use the new interface.  That will avoid serializing
p2m accesses in the common case where no updates are needed (i.e. no
page-sharing, VM paging or other p2m trickery).

Signed-off-by: Tim Deegan <tim@xen.org>
12 years agox86/mm: make p2m lock into an rwlock
Tim Deegan [Thu, 17 May 2012 09:24:53 +0000 (10:24 +0100)]
x86/mm: make p2m lock into an rwlock

Because the p2m lock was already recursive, we need to add a new
mm-lock class of recursive rwlocks.

Signed-off-by: Tim Deegan <tim@xen.org>
12 years agoxl: Fixup filename->source after 25344:0f3b1e13d6af
George Dunlap [Tue, 15 May 2012 16:01:54 +0000 (17:01 +0100)]
xl: Fixup filename->source after 25344:0f3b1e13d6af

Because of conflicts with another patch, changeset 25344:0f3b1e13d6af missed
one change.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: Add pci_assignable_add and remove commands
George Dunlap [Tue, 15 May 2012 15:28:16 +0000 (16:28 +0100)]
xl: Add pci_assignable_add and remove commands

pci-assignable-add will always store the driver rebind path, but
pci-assignable-remove will only actually rebind if asked to do so.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Introduce pci_assignable_add and pci_assignable_remove
George Dunlap [Tue, 15 May 2012 15:28:15 +0000 (16:28 +0100)]
libxl: Introduce pci_assignable_add and pci_assignable_remove

Introduce libxl helper functions to prepare devices to be passed
through to guests.  This is meant to replace of all the manual sysfs
commands which are currently required.

pci_assignable_add accepts a BDF for a device and will:
* Unbind a device from its current driver, if any
* If "rebind" is set, it will store the path of the driver from which we
  unplugged it in /libxl/pciback/$BDF/driver_path
* If create a slot for it in pciback if one doesn't yet exist
* Bind the device to pciback

At this point it will show up in pci_assignable_list, and is ready to
be passed through to a guest.

pci_assignable_remove accepts a BDF for a device and will:
* Unbind the device from pciback
* Remove the slot from pciback
* If "rebind" is set, and /libx/pciback/$BDF/driver_path exists, it
  will attempt to rebind the device to its original driver.

Both functions are idempotent: if the desired end state has already
been reached, they return SUCCESS.

NB that "$BDF" in this case uses '-' instead of ':' and '.', because
':' and '.' are illegal characters in xenstore paths.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Rename pci_list_assignable to pci_assignable_list
George Dunlap [Tue, 15 May 2012 15:28:15 +0000 (16:28 +0100)]
libxl: Rename pci_list_assignable to pci_assignable_list

...to prepare for a consistent "pci_assignable_*" naming scheme.

Also move the man page entry into the PCI PASS-THROUGH section, rather
than the XEN HOST section.

No functional changes.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Make a helper function write a BDF to a sysfs path
George Dunlap [Tue, 15 May 2012 15:28:14 +0000 (16:28 +0100)]
libxl: Make a helper function write a BDF to a sysfs path

This functionality will be used several times in subsequent patches.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: Make clear distinction between "filename" and "data source"
George Dunlap [Tue, 15 May 2012 15:28:13 +0000 (16:28 +0100)]
xl: Make clear distinction between "filename" and "data source"

Many places in xl there's a variable or element named "filename" which
does not contain a filename, but the source of the data for reporting
purposes.  Worse, there are variables which are sometimes actually
used or interpreted as a filename depending on what other variables
are set.  This makes it difficult to tell when a string is purely
cosmetic, and when another bit of code may actually attempt to call
"open" with the string.

This patch makes a consistent distinction between "filename" (which
always refers to the name of an actual file, and may be interpreted as
such at some point) and "source" (which may be a filename, or may be
another data source such as a migration stream or saved data).

This does add some variables and reshuffle where assignments happen;
most notably, the "restore_filename" element of struct domain_create
is now only set when restoring from a file.

But at a high level, there should be no funcitonal changes.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxlu: Rename filename to config_source
George Dunlap [Tue, 15 May 2012 15:28:12 +0000 (16:28 +0100)]
libxlu: Rename filename to config_source

The "filename" is a bit of a misnomer, as it's only used during error
messages, and in most instances cases is actually set to "command
line".

Rename it to "config_source" to make it clear that it's not used to
actually open any files.

No functional changes.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Warn that /usr/bin/pygrub is deprecated
George Dunlap [Tue, 15 May 2012 15:28:11 +0000 (16:28 +0100)]
libxl: Warn that /usr/bin/pygrub is deprecated

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>