xen.git
15 years agovtd: Reinstate ACPI DMAR on system shutdown or S3/S4/S5.
Keir Fraser [Fri, 17 Dec 2010 10:46:43 +0000 (10:46 +0000)]
vtd: Reinstate ACPI DMAR on system shutdown or S3/S4/S5.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agox86 hvm: Move CPUID.0xd (XSAVE) configuration into libxc.
Keir Fraser [Fri, 17 Dec 2010 09:54:22 +0000 (09:54 +0000)]
x86 hvm: Move CPUID.0xd (XSAVE) configuration into libxc.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agox86:xsaveopt: Enable xsaveopt feature in Xen and guest
Keir Fraser [Fri, 17 Dec 2010 09:25:00 +0000 (09:25 +0000)]
x86:xsaveopt: Enable xsaveopt feature in Xen and guest

This patch uses "xsaveopt" instead of "xsave" if the feature is
supported in hardware to optimize task switch performance in Xen. It
also exposes the feature to guest VMs.

Signed-off-by: Zhang Fengzhe <fengzhe.zhang@intel.com>
15 years agoxentrace: Clean up initialisation.
Keir Fraser [Thu, 16 Dec 2010 20:07:03 +0000 (20:07 +0000)]
xentrace: Clean up initialisation.

Allocate no memory and print no debug messages when disabled.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agovtd: Clean up a recent printk message.
Keir Fraser [Thu, 16 Dec 2010 20:06:36 +0000 (20:06 +0000)]
vtd: Clean up a recent printk message.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agox86: Define pte_{read,write}[_atomic] in terms of atomic_readN
Keir Fraser [Thu, 16 Dec 2010 19:36:35 +0000 (19:36 +0000)]
x86: Define pte_{read,write}[_atomic] in terms of atomic_readN

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agox86: Define atomic_{read,write}{8,16,32,64} accessor functions.
Keir Fraser [Thu, 16 Dec 2010 19:29:08 +0000 (19:29 +0000)]
x86: Define atomic_{read,write}{8,16,32,64} accessor functions.

These absolutely guarantee to read/write a uint*_t with a single atomic
processor instruction.

Also re-define atomic_read/atomic_write (act on atomic_t) similarly.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agox86/bitops.h: Remove unused smp_mb__* macros
Keir Fraser [Thu, 16 Dec 2010 19:04:11 +0000 (19:04 +0000)]
x86/bitops.h: Remove unused smp_mb__* macros

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agox86/atomic.h: Clean up for Xen code style; remove unused smp_mb__*
Keir Fraser [Thu, 16 Dec 2010 19:01:35 +0000 (19:01 +0000)]
x86/atomic.h: Clean up for Xen code style; remove unused smp_mb__*

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agox86: Remove unnecessary LOCK/LOCK_PREFIX macros.
Keir Fraser [Thu, 16 Dec 2010 18:46:55 +0000 (18:46 +0000)]
x86: Remove unnecessary LOCK/LOCK_PREFIX macros.

We don't support !CONFIG_SMP.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agox86: move early page fault code into .init.text
Keir Fraser [Thu, 16 Dec 2010 18:37:30 +0000 (18:37 +0000)]
x86: move early page fault code into .init.text

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86/asm: allow some unlikely taken branches to be statically predicted this way
Keir Fraser [Thu, 16 Dec 2010 18:37:20 +0000 (18:37 +0000)]
x86/asm: allow some unlikely taken branches to be statically predicted this way

... by moving the respective code out of line (into sub-section 1 of
the particular section). A few other branches could be eliminated
altogether.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agotools/xcutils: xc_save: add missing whitespace
Olaf Hering [Thu, 16 Dec 2010 18:25:33 +0000 (18:25 +0000)]
tools/xcutils: xc_save: add missing whitespace

Add missing whitespace between the two error strings.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
15 years agotools/libxc: fix comment typo in xc_domain_save
Olaf Hering [Thu, 16 Dec 2010 18:24:57 +0000 (18:24 +0000)]
tools/libxc: fix comment typo in xc_domain_save

evey -> every

Signed-off-by: Olaf Hering <olaf@aepfle.de>
15 years agolibxl: constify libxl_create_cpupool()
Christoph Egger [Thu, 16 Dec 2010 18:24:04 +0000 (18:24 +0000)]
libxl: constify libxl_create_cpupool()

Attached patch constifies libxl_create_cpupool().

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools, bsd: complete implementation of discard_file_cache
Christoph Egger [Thu, 16 Dec 2010 18:21:56 +0000 (18:21 +0000)]
tools, bsd: complete implementation of discard_file_cache

attached patch completes discard_file_cache() for NetBSD.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxenstore: set implicit path for socket connections
Ian Campbell [Thu, 16 Dec 2010 18:04:08 +0000 (18:04 +0000)]
xenstore: set implicit path for socket connections

For now assume all such connections come from domain 0.

Failure to do this breaks various scripts which assume that they
operate relative to the domains "home directory".

This matches the behaviour of the ocaml xenstored.

Thanks to report from Olaf Hering.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools/hotplug: Do not recursively invoke xenstore_write on error
Ian Campbell [Thu, 16 Dec 2010 17:58:00 +0000 (17:58 +0000)]
tools/hotplug: Do not recursively invoke xenstore_write on error

This fixes a possible infinite recursion.

From: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools/xl: fix race which can leave an xl monitor processing hanging
Ian Jackson [Thu, 16 Dec 2010 17:39:24 +0000 (17:39 +0000)]
tools/xl: fix race which can leave an xl monitor processing hanging

If the domain is destroyed (eg with xl destroy), it is possible that
the xl which is monitoring the domain for restart/preserve will not be
able to get the domain shutdown reason.

Before this patch, it would then ignore the domain death event and
carry on waiting, forever, for more events.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoQEMU_TAG update
Ian Jackson [Thu, 16 Dec 2010 16:58:39 +0000 (16:58 +0000)]
QEMU_TAG update

15 years agoaudit_p2m: fix syntax errors in disabled debug code
Keir Fraser [Thu, 16 Dec 2010 15:41:52 +0000 (15:41 +0000)]
audit_p2m: fix syntax errors in disabled debug code

If P2M_PRINTK is re-defined as ordinary printk,
some (disabled) debug statements will not compile.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
15 years agovtd: Require unmap_vtd_domain_page() on a couple of early exit paths.
Keir Fraser [Thu, 16 Dec 2010 15:38:57 +0000 (15:38 +0000)]
vtd: Require unmap_vtd_domain_page() on a couple of early exit paths.

From: Jan Beulich <JBeulich@novell.com>
Signed-off-by: Keir Fraser <keir@xen.org>
15 years agoMerge
Ian Jackson [Wed, 15 Dec 2010 16:49:25 +0000 (16:49 +0000)]
Merge

15 years agotools/hotplug/Linux: force release lock if holder process is gone (fix)
Kouya Shimura [Wed, 15 Dec 2010 16:49:06 +0000 (16:49 +0000)]
tools/hotplug/Linux: force release lock if holder process is gone (fix)

22508:57907b28e51a was unsafe for mutual exclusion.  There is a case
that the owner file doesn't exist yet when an atomic mkdir operation
fails.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agosvm: support VMCB cleanbits
Keir Fraser [Wed, 15 Dec 2010 16:34:11 +0000 (16:34 +0000)]
svm: support VMCB cleanbits

Attached patch implements the VMCB cleanbits SVM feature.
Upcoming AMD CPUs introduce them and they are basically hints
for the CPU which vmcb values can be re-used from the previous
VMRUN instruction.

Each bit represents a certain set of fields in the VMCB.
Setting a bit tells the cpu it can re-use the cached value
from the previous VMRUN.
Clearing a bit tells the cpu to reload the values from the given VMCB.

Signed-off-by: Wei Huang <Wei.Huang2@amd.com>
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir@xen.org>
15 years agoEPT/VT-d page table sharing
Keir Fraser [Wed, 15 Dec 2010 14:16:03 +0000 (14:16 +0000)]
EPT/VT-d page table sharing

Basic idea is to leverage 2MB and 1GB page size support in EPT by having
VT-d using the same page tables as EPT.  When EPT page table changes, flush
VT-d IOTLB cache.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
15 years agoblktap2: fix up non-ASCII characters in 21129:bf74d9c31674
Ian Jackson [Wed, 15 Dec 2010 13:34:26 +0000 (13:34 +0000)]
blktap2: fix up non-ASCII characters in 21129:bf74d9c31674

21129:bf74d9c31674 contained UTF-8-encoded nonbreaking spaces.
Sorry for not noticing this.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agox86/mm: make paging_map_log_dirty_bitmap() static
Keir Fraser [Wed, 15 Dec 2010 12:12:30 +0000 (12:12 +0000)]
x86/mm: make paging_map_log_dirty_bitmap() static
now that its only caller outside paging.c has been removed.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
15 years agox86/mm: fix up paging_mfn_is_dirty()
Keir Fraser [Wed, 15 Dec 2010 12:12:15 +0000 (12:12 +0000)]
x86/mm: fix up paging_mfn_is_dirty()

Add locking, and don't allocate the top-level page if it's not there.
Also gets rid of the default-to-1 case if there have been failed
allocations because the safer thing is actually to return 0 and avoid
modifying an un-dirtied page.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
15 years agox86/mm: move mfn_is_dirty along with the rest of the log-dirty code
Keir Fraser [Wed, 15 Dec 2010 12:11:57 +0000 (12:11 +0000)]
x86/mm: move mfn_is_dirty along with the rest of the log-dirty code

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
15 years agox86/32on64: zero-extend hypercall index before use in memory access (debug mode only)
Keir Fraser [Wed, 15 Dec 2010 12:10:31 +0000 (12:10 +0000)]
x86/32on64: zero-extend hypercall index before use in memory access (debug mode only)

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86-64: fix restoring of hypercall arguments after trace callout
Keir Fraser [Wed, 15 Dec 2010 12:09:41 +0000 (12:09 +0000)]
x86-64: fix restoring of hypercall arguments after trace callout

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoReduce side effects of handling '*' debug key
Keir Fraser [Wed, 15 Dec 2010 12:04:34 +0000 (12:04 +0000)]
Reduce side effects of handling '*' debug key

NMI watchdog should be suppressed when dumping IRQ handlers. Softirqs
should be handled periodically while processing non-IRQ handlers.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86: adjust other interrupt related section placement
Keir Fraser [Wed, 15 Dec 2010 11:59:00 +0000 (11:59 +0000)]
x86: adjust other interrupt related section placement

... and remove some variables the value of which is never used
altogether.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86: adjust x2apic section placement
Keir Fraser [Wed, 15 Dec 2010 11:57:54 +0000 (11:57 +0000)]
x86: adjust x2apic section placement

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86: x2apic pre-enabled but intr-remapping is not enabled
Keir Fraser [Wed, 15 Dec 2010 11:56:25 +0000 (11:56 +0000)]
x86: x2apic pre-enabled but intr-remapping is not enabled

Make it aligned with Linux kernel.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Removed unnecessary bits from the original patch, and removed
intremap_enabled() with its only caller gone.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86: increase MAX_LOCAL_APIC
Keir Fraser [Wed, 15 Dec 2010 11:55:48 +0000 (11:55 +0000)]
x86: increase MAX_LOCAL_APIC

otherwise apicid_to_node[MAX_LOCAL_APIC] will be overrun if apicid >
255. After patch, the mapping get right.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Make this and also MAX_MADT_ENTRIES loosely depend on NR_CPUS. Tie
MAX_APICS to MAX_LOCAL_APIC. Fix initializer of x86_acpiid_to_apicid[]
to match the array member type of u32, as well as all checks in
readers of this array and x86_cpu_to_apicid[].

While the adjustment to xen_vcpu_physid_to_x86_{acpi,apic}id() is not
backward compatible, I think it should still be done this way as the
former reserving of values beyond 0xff should never have been part of
the interface. If considered impossible, a second best solution would
appear to be to make the macros depend on __XEN_INTERFACE_VERSION__.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86: mpparse and cstate need to use 32bit apic id
Keir Fraser [Wed, 15 Dec 2010 11:52:14 +0000 (11:52 +0000)]
x86: mpparse and cstate need to use 32bit apic id

Instead of going with mpc_config_processor struct.
that field ony have 8 bits.

We should not change that struct, because it is shared with mptable.

Also need to increase MAX_APICS.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Rather than using a fixed value of 512, make this scale with NR_CPUS
(which obviously still doesn't cover all theoretically possible
systems, but at least allows some build time control).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86: Fix multicall handling for 6-arg hypercalls.
Keir Fraser [Wed, 15 Dec 2010 11:21:28 +0000 (11:21 +0000)]
x86: Fix multicall handling for 6-arg hypercalls.

None exist at the moment, but this makes multicall handling consistent
with direct PV and HVM hypercall handling.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agox86 hvm: Enable 6-argument hypercalls
Keir Fraser [Wed, 15 Dec 2010 11:17:41 +0000 (11:17 +0000)]
x86 hvm: Enable 6-argument hypercalls

Enable 6 argument hypercalls for HVMs. The hypercall code handles a
sixth argument in EBP or R9 but the HVM code is not passing the value.

Signed-off-by: Ross Philipson <ross.philipson@citrix.com>
15 years agox86 hvm: Expose TSC_DEADLINE CPU feature to guests via CPUID.
Keir Fraser [Wed, 15 Dec 2010 11:09:02 +0000 (11:09 +0000)]
x86 hvm: Expose TSC_DEADLINE CPU feature to guests via CPUID.

Signed-off-by: Wei Gang <gang.wei@intel.com>
15 years agox86 hvm: Emulate MSR_IA32_TSC_DEADLINE
Keir Fraser [Wed, 15 Dec 2010 11:01:59 +0000 (11:01 +0000)]
x86 hvm: Emulate MSR_IA32_TSC_DEADLINE

Accesses to MSR_IA32_TSC_DEADLINE are trapped, with value stored in a
new field vlapic->hw.tdt_msr. vlapic->pt is reused in one shot mode
for vtdt to trigger expire events.

For details, please refer to the Intel Architectures Software
Developer's Manual 3A, 10.5.4.1 TSC-Deadline Mode.

Signed-off-by: Wei Gang <gang.wei@intel.com>
15 years agox86: Define APIC_TIMER_MODE_xxx in apicdef.h
Keir Fraser [Wed, 15 Dec 2010 10:55:34 +0000 (10:55 +0000)]
x86: Define APIC_TIMER_MODE_xxx in apicdef.h

Signed-off-by: Wei Gang <gang.wei@intel.com>
15 years agox86: Define a new function gtsc_to_gtime()
Keir Fraser [Wed, 15 Dec 2010 10:49:57 +0000 (10:49 +0000)]
x86: Define a new function gtsc_to_gtime()

Define it to do the transform from guest tsc to guest time.

Fix the typo in gtime_to_gtsc() definition.

Signed-off-by: Wei Gang <gang.wei@intel.com>
15 years agoept: Remove lock in ept_get_entry, replace with access-once semantics.
Keir Fraser [Wed, 15 Dec 2010 10:47:05 +0000 (10:47 +0000)]
ept: Remove lock in ept_get_entry, replace with access-once semantics.

This mirrors the RVI/shadow situation, where p2m read access is
lockless because it's done in the hardware (linear map of the p2m
table).

This fixes the original bug (call it bug A) without introducing bug B
(a deadlock).

Bug A was caused by a race when updating p2m entries: between testing
if it's valid, and testing if it's populate-on-demand, it may have
been changed from populate-on-demand to valid.

My original patch simply introduced a lock into ept_get_entry, but
that caused bug B, caused by circular locking order: p2m_change_type
[grabs p2m lock] -> set_p2m_entry -> ept_set_entry ->
ept_set_middle_level -> p2m_alloc [grabs hap lock] write cr4 ->
hap_update_paging_modes [grabes hap lock] -> hap_update_cr3 ->
gfn_to_mfn -> ept_get_entry -> [grabs p2m lock]

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agotmem: two wrongs (or three lefts and a wrong) make a right
Keir Fraser [Wed, 15 Dec 2010 10:27:18 +0000 (10:27 +0000)]
tmem: two wrongs (or three lefts and a wrong) make a right

These two bugs apparently complement each other enough that
they escaped problems in my testing, but eventually gum
up the works and are obviously horribly wrong.

Found while developing tmem for native Linux.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
15 years agohvm save: Introduce hvm_load_entry_zeroextend().
Keir Fraser [Wed, 15 Dec 2010 10:21:05 +0000 (10:21 +0000)]
hvm save: Introduce hvm_load_entry_zeroextend().

In certain cases this will allow us to load old HVM save images where
an HVM saved chunk has subsequently been extended with new
fields. Rather than fail to load the chunk, we can pad the extended
structure with zeroes, if the caller knows how to handle that.

Signed-off-by: Keir Fraser <keir@xen.org>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
15 years agohvm save: Move some inline functions into common/hvm/save.c
Keir Fraser [Wed, 15 Dec 2010 10:15:45 +0000 (10:15 +0000)]
hvm save: Move some inline functions into common/hvm/save.c

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agolibxl: return "tap" as backend type for PHYSTYPE_QCOW2
Stefano Stabellini [Tue, 14 Dec 2010 19:28:25 +0000 (19:28 +0000)]
libxl: return "tap" as backend type for PHYSTYPE_QCOW2

Return "tap" as backend type for PHYSTYPE_QCOW2.  This arranges that
qcow2 disks should work in xl.

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 assume target and freemem-slack are written at the same time
Stefano Stabellini [Tue, 14 Dec 2010 19:04:03 +0000 (19:04 +0000)]
libxl: do not assume target and freemem-slack are written at the same time

This improves robustness in some pathological configurations.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: remove comment obsoleted by addition of hypercall bounce buffer.
Ian Campbell [Tue, 14 Dec 2010 18:59:44 +0000 (18:59 +0000)]
libxc: remove comment obsoleted by addition of hypercall bounce buffer.

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 [Tue, 14 Dec 2010 18:56:35 +0000 (18:56 +0000)]
QEMU_TAG update

15 years agolibxl: introduce libxl_need_xenpv_qemu
Stefano Stabellini [Tue, 14 Dec 2010 18:55:53 +0000 (18:55 +0000)]
libxl: introduce libxl_need_xenpv_qemu

Introduce libxl_need_xenpv_qemu to detect if the caller needs to create
a pv qemu instance (using libxl_create_xenpv_qemu).
A positive reply depends on the number of pv console and vfbs, and the
type of disk backends.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxenpaging: (sparse) documenation
Olaf Hering [Tue, 14 Dec 2010 18:51:55 +0000 (18:51 +0000)]
xenpaging: (sparse) documenation

Write up some sparse documentation about xenpaging usage.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxenpaging: update xch usage
Olaf Hering [Tue, 14 Dec 2010 18:51:26 +0000 (18:51 +0000)]
xenpaging: update xch usage

Instead of passing xch around, use the handle from xenpaging_t.
In the updated functions, use a local xch variable.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxenpaging: do not use DPRINTF/ERROR if xch handle is unavailable
Olaf Hering [Tue, 14 Dec 2010 18:50:49 +0000 (18:50 +0000)]
xenpaging: do not use DPRINTF/ERROR if xch handle is unavailable

Fix DPRINTF/ERROR usage. Both macros reference a xch variable in local scope.
If xc_interface_open fails and after xc_interface_close, both can not be used
anymore. Use standard fprintf for this case.

Remove the code to print the exit value, its not really useful.
Its a left-over for debugging from an earlier patch.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxenpaging: remove duplicate xc_interface_close call
Olaf Hering [Tue, 14 Dec 2010 18:50:16 +0000 (18:50 +0000)]
xenpaging: remove duplicate xc_interface_close call

Fix double-free in xc_interface_close() because xenpaging_teardown()
releases the *xch already. Remove second xc_interface_close() call.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxenpaging: print number of evicted pages
Olaf Hering [Tue, 14 Dec 2010 18:49:40 +0000 (18:49 +0000)]
xenpaging: print number of evicted pages

Print number of evicted pages after evict loop.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxenpaging: print DPRINTF ouput if XENPAGING_DEBUG is in environment
Olaf Hering [Tue, 14 Dec 2010 18:48:44 +0000 (18:48 +0000)]
xenpaging: print DPRINTF ouput if XENPAGING_DEBUG is in environment

No DPRINTF output is logged because the default loglevel is to low in
libxc. Recognize the XENPAGING_DEBUG environment variable to change the
default loglevel at runtime.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxenpaging: remove perror usage in xenpaging_init error path
Olaf Hering [Tue, 14 Dec 2010 18:47:52 +0000 (18:47 +0000)]
xenpaging: remove perror usage in xenpaging_init error path

Use the libxc error macro to report errors if initialising xenpaging
fails. Also report the actual errno string.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxenpaging: close xch handle in xenpaging_init error path
Olaf Hering [Tue, 14 Dec 2010 18:47:10 +0000 (18:47 +0000)]
xenpaging: close xch handle in xenpaging_init error path

Just for correctness, close the xch handle in the error path.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools/hotplug: Do not mind if "ip link set" fails on vif backends
Ian Jackson [Tue, 14 Dec 2010 17:38:18 +0000 (17:38 +0000)]
tools/hotplug: Do not mind if "ip link set" fails on vif backends

Most versions of netback do not support setting the MAC address.  This
means that c/s 937488219719 causes the hotplug script to break for
vifs, even as it fixes the bridge-wrong-MAC-address problem for tap
devices (used for emulated nics).

The mac-setting operation is not necessary for vifs since they are
hardcoded to fe:ff* anyway.

As a band-aid, add "|| true" to the call to ip link, so that this
error does not cause the hotplug operation to fail.  There will still
be an error message printed until we can fix this better.

Suggested-by: Ian Campbell <Ian.Campbell@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools/hotplug/Linux: forced to release lock if holder process is gone
Kouya Shimura [Tue, 14 Dec 2010 17:15:48 +0000 (17:15 +0000)]
tools/hotplug/Linux: forced to release lock if holder process is gone

When a script using locking.sh is stopped by ctrl-C, the lock file remains.
We have to wait 100 seconds for releasing the lock at the next time.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxenstore: new XS_OPEN_SOCKETONLY flag; honour "-s" on tools' cmdline
Ian Jackson [Tue, 14 Dec 2010 16:56:54 +0000 (16:56 +0000)]
xenstore: new XS_OPEN_SOCKETONLY flag; honour "-s" on tools' cmdline

The "-s" option to xenstore-ls is used by the xencommons startup
script to check whether xenstored is already running, before starting
it.

Since 22498:a40455ae9ad3, "-s" has been a no-op, and libxenstore will
always fall back to using xenbus.  The combined effect is that the
xencommons script deadlocks: xenstore-ls hangs waiting for xenstored,
which isn't started by xencommons because xencommons is waiting for
xenstore-ls.

In this patch, we:
 * Introduce a new XS_OPEN_SOCKETONLY flag which disables the
   fallback behaviour;
 * Make the xenstore command line tools use the new xs_open call
   rather than the old, deprecated xs_open_* calls (which are
   now identical).
 * Plumb the xenstore command line tools "-s" option to set the
   XS_OPEN_SOCKETONLY flag.
 * Change the type of the XS_OPEN_* flags so that they naturally have
   type unsigned long.

The "-s" option to xenstore-ls et al, and the XS_OPEN_SOCKETONLY flag,
are intended for use by toolstack infrastructure and should not
normally be used by higher-level code.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agox86/iommu: account for necessary allocations when calculating Dom0's initial allocati...
Keir Fraser [Tue, 14 Dec 2010 09:54:10 +0000 (09:54 +0000)]
x86/iommu: account for necessary allocations when calculating Dom0's initial allocation size

As of c/s 21812:e382656e4dcc, IOMMU related allocations for Dom0
happen only after it got all of its memory allocated, and hence the
reserve (mainly for setting up its swiotlb) may get exhausted without
accounting for the necessary allocations up front.

While not precise, the estimate has been found to be within a couple
of pages for the systems it got tested on.

For the calculation to be reasonably correct, this depends on the
patch titled "x86/iommu: don't map RAM holes above 4G" sent out
yesterday.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoamd-iov: eliminate open-coded PCI bus scan
Keir Fraser [Tue, 14 Dec 2010 09:53:41 +0000 (09:53 +0000)]
amd-iov: eliminate open-coded PCI bus scan

Instead, use scan_pci_devices() just like VT-d does. This at once
allows making {alloc,free}_pdev() static.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86/iommu: don't map RAM holes above 4G
Keir Fraser [Tue, 14 Dec 2010 09:52:57 +0000 (09:52 +0000)]
x86/iommu: don't map RAM holes above 4G

Matching the comment in iommu_set_dom0_mapping(), map only actual RAM
from the address range starting at 4G. It's not clear though whether
that comment is actually correct (which is why I'm sending this as
RFC), but it is certain that on systems with sparse physical memory
map we're currently wasting a potentially significant amount of memory
for setting up IOMMU page tables that will never be used.

The main question is what happens for MMIO ranges living above 4G. Of
course, the same issue would currently exist for any such ranges
sitting beyon the end of RAM.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoadd missing libxl__free_all() calls
Juergen Gross [Thu, 9 Dec 2010 13:50:56 +0000 (14:50 +0100)]
add missing libxl__free_all() calls

In various libxl functions libxl__free_all() was missing before return

Signed-off-by: juergen.gross@ts.fujitsu.com
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agolibxl: Makes libxl be able to call Qemu upstream for XenPV guest.
Anthony PERARD [Mon, 13 Dec 2010 17:59:45 +0000 (17:59 +0000)]
libxl: Makes libxl be able to call Qemu upstream for XenPV guest.

In libxl_build_device_model_args_new:
  - Adds -xen-attach options to the list of arguments to Qemu.
  - Adds -vga xenfb options when vnc and sdl are not set.
  - Remove disk list from the command line for XenPV as they will be
    read from xenstore by Qemu.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 tools/libxl/libxl.c |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

15 years agolibxl: strdup disk path before put it in qemu args array.
Anthony PERARD [Mon, 13 Dec 2010 17:59:02 +0000 (17:59 +0000)]
libxl: strdup disk path before put it in qemu args array.

In libxl_build_device_model_args_new, the path to the disk image are
freeed before there was actually use to make the arguments list of Qemu.
The patch strdups it.

This patch also changes argv[0] of the device model.
Now, it is the conventional argv[0], so is value come from
info->device_model.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 tools/libxl/libxl.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

15 years agolibxl: fix double free of ifname, when makes args for qemu.
Anthony PERARD [Mon, 13 Dec 2010 17:58:20 +0000 (17:58 +0000)]
libxl: fix double free of ifname, when makes args for qemu.

In libxl_build_device_model_args_new, vifs[i].ifname can be free two
times, by the gc, and by freeing the vifs structures. This patch avoids
this.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 tools/libxl/libxl.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

15 years agoFix /vm/uuid xenstore leak on tapdisk2 device cleanup
Chunyan Liu [Mon, 13 Dec 2010 17:39:27 +0000 (17:39 +0000)]
Fix /vm/uuid xenstore leak on tapdisk2 device cleanup

While doing block-detach blktap2 disk, tap2 device info is not cleared from
xenstore /vm/uuid/xxx. The reason is in xen-hotplug-cleanup script: when $vm_dev
does not exist, $(xenstore-read "$vm_dev" 2>/dev/null) is also "", won't enter
the block. So, change to use cmd return value to check existence.

Signed-off-by Chunyan Liu <cyliu@novell.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

15 years agoAdds an open xenstore connection function which tries to use the xenbus
Stefano Stabellini [Mon, 13 Dec 2010 17:15:31 +0000 (17:15 +0000)]
Adds an open xenstore connection function which tries to use the xenbus
interface (xs_domain_open) when the socket interface (xs_daemon_opn)
fails.

Signed-off-by: Mihir Nanavati <mihirn@cs.ubc.ca>
Acked-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 agolibxc: allow caller to specify no re-entrancy protection when opening the interface
Ian Campbell [Thu, 2 Dec 2010 12:49:00 +0000 (12:49 +0000)]
libxc: allow caller to specify no re-entrancy protection when opening the interface

Used by language bindings which provide their own re-entrancy which conflicts
with pthreads.

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 agolibxc: rename safe_strerror to xc_strerror and pass in an XC handle for future use.
Ian Campbell [Thu, 2 Dec 2010 12:49:00 +0000 (12:49 +0000)]
libxc: rename safe_strerror to xc_strerror and pass in an XC handle for future use.

Make the function public since I have future patches which depend on this.

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 agolibxc: NetBSD: implement xc_evtchn_bind_unbound_port.
Ian Campbell [Thu, 2 Dec 2010 12:33:01 +0000 (12:33 +0000)]
libxc: NetBSD: implement xc_evtchn_bind_unbound_port.

Doesn't actually appear to be used anywhere but is defined for other
OSes.

The NetBSD evtchn.h contains comments "Return allocated port" for
several ioctls which currently return the allocated port as a member
of the argument structure and not as the ioctl return value (I think
this is a cut and paste error).

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

15 years agoetherboot: Download ipxe from XEN_EXTFILES_URL
Keir Fraser [Fri, 10 Dec 2010 19:38:30 +0000 (19:38 +0000)]
etherboot: Download ipxe from XEN_EXTFILES_URL

Allows us to build even if the ipxe git server is down. We still fall
back to the git server if we cannot download a suitably named tarball
from our own URL.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agotools/hotplug/Linux: Ensure tap devices receive a dummy MAC address.
Ian Campbell [Fri, 10 Dec 2010 18:44:07 +0000 (18:44 +0000)]
tools/hotplug/Linux: Ensure tap devices receive a dummy MAC address.

If a tap device is not given an explicit MAC address it will generate
one randomly.

The behaviour of the Linux bridge is to pickup the lowest MAC address
of any port for use in for ARP, STP etc. If the tap device's randomly
generated MAC address happens to be the lowest then this can cause all
manner of strange networking glitches in both domain 0 and guests when
the bridge suddenly takes over from the previously used MAC address.

We choose FE:FF:FF:FF:FF:FF as it the numerically largest
non-broadcast address. This ensures that the physical NIC device's
port will have the lowest MAC address and therefore be the one picked
up by the bridge.

vif devices already have a MAC address of FE:FF:FF:FF:FF:FF set by
netback already but there is no harm in forcing it a second time in
the hotplug script.

tap devices are added by the "add" event and therefore we should call
setup_bridge_port then as well as for "online" which is caused by vif
devices.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: "Device model is a stubdom" is not an error
Ian Campbell [Fri, 10 Dec 2010 18:30:45 +0000 (18:30 +0000)]
libxl: "Device model is a stubdom" is not an error

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: return an error if connection to xenstore fails
Ian Campbell [Fri, 10 Dec 2010 18:29:50 +0000 (18:29 +0000)]
libxl: return an error if connection to xenstore fails

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoMerge
Ian Jackson [Fri, 10 Dec 2010 18:27:54 +0000 (18:27 +0000)]
Merge

15 years agolibxc: correct bounce direction for debug-key handling
Jan Beulich [Fri, 10 Dec 2010 18:27:17 +0000 (18:27 +0000)]
libxc: correct bounce direction for debug-key handling

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agomem_event: Remove unused fields and definitions.
Keir Fraser [Fri, 10 Dec 2010 18:20:25 +0000 (18:20 +0000)]
mem_event: Remove unused fields and definitions.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agotools/ocaml: fix a typo in xc_lib.c:xc_domain_set_vpt_align
Wei Gang [Fri, 10 Dec 2010 18:16:07 +0000 (18:16 +0000)]
tools/ocaml: fix a typo in xc_lib.c:xc_domain_set_vpt_align

Fix a typo in xc_lib.c.

Signed-off-by: Wei Gang <gang.wei@intel.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools/python: Rebuild python extensions if depends have changed
Juergen Gross [Fri, 10 Dec 2010 18:13:15 +0000 (18:13 +0000)]
tools/python: Rebuild python extensions if depends have changed

Adds depends information for building python extensions.
The extensions depend on the library binaries they are using.

Signed-off-by: juergen.gross@ts.fujitsu.com
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxend: fix "xm block-detach 0 ..." for extended-ID devices
Jan Beulich [Fri, 10 Dec 2010 18:08:19 +0000 (18:08 +0000)]
xend: fix "xm block-detach 0 ..." for  extended-ID devices

Simply taking stat()'s st_rdev doesn't work here, as the minor is
split into two parts, the major is present, and the "extended" bit
isn't set.

Rather than fixing this in a way that would likely be OS-dependent,
simply remove the access to the device file, and instead just parse
the provided string (as is done e.g. for block-attach).

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 agohvm vlapic: Fix tmcct read logic when in periodic mode.
Keir Fraser [Fri, 10 Dec 2010 16:49:05 +0000 (16:49 +0000)]
hvm vlapic: Fix tmcct read logic when in periodic mode.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agox86: acpi: Fix reboot attempt sequence.
Keir Fraser [Fri, 10 Dec 2010 16:40:05 +0000 (16:40 +0000)]
x86: acpi: Fix reboot attempt sequence.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agox86 acpi: Follow Windows behaviour more closely during reset.
Keir Fraser [Fri, 10 Dec 2010 11:32:19 +0000 (11:32 +0000)]
x86 acpi: Follow Windows behaviour more closely during reset.

This follows some changes proposed for upstream Linux:
 1. Do not check the FADT reset register size/offset
 2. Try ACPI poking twice during our reset attempt sequence

Hopefully this will help us reset reliably on a wider range of
platforms.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agotmem: Use of 'new' clashes with C++ reserved namespace.
Keir Fraser [Fri, 10 Dec 2010 11:01:19 +0000 (11:01 +0000)]
tmem: Use of 'new' clashes with C++ reserved namespace.

Rename to 'creat', which does not conflict.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agocredit2: Implement cross-L2 migration "resistance"
Keir Fraser [Fri, 10 Dec 2010 10:51:31 +0000 (10:51 +0000)]
credit2: Implement cross-L2 migration "resistance"

Resist moving a vcpu from one L2 to another unless its credit
is past a certain amount.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agocredit2: Don't migrate cpus unnecessarily
Keir Fraser [Fri, 10 Dec 2010 10:51:04 +0000 (10:51 +0000)]
credit2: Don't migrate cpus unnecessarily

Modern processors have one or two L3's per socket, and generally only
one core per L2.  Credit2's design relies on having credit shared
across several.  So as a first step to sharing a queue across L3 while
avoiding excessive cross-L2 migration

Step one: If the vcpu's current cpu is acceptable, just run it there.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agocredit2: Trace rdtsc value with some more records
Keir Fraser [Fri, 10 Dec 2010 10:50:16 +0000 (10:50 +0000)]
credit2: Trace rdtsc value with some more records

Makes the traces slightly larger, but easier to analyze.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agocredit2: Use vcpu processor explicitly
Keir Fraser [Fri, 10 Dec 2010 10:49:48 +0000 (10:49 +0000)]
credit2: Use vcpu processor explicitly

No functional changes.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agocredit2: Putting a vcpu to sleep also removes the delayed_runq_add flag
Keir Fraser [Fri, 10 Dec 2010 10:49:20 +0000 (10:49 +0000)]
credit2: Putting a vcpu to sleep also removes the delayed_runq_add flag

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agox86: x2apic: Large cleanup
Keir Fraser [Thu, 9 Dec 2010 19:19:34 +0000 (19:19 +0000)]
x86: x2apic: Large cleanup

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agoAdd CPU_STARTING notifier during CPU bringup.
Keir Fraser [Thu, 9 Dec 2010 16:17:33 +0000 (16:17 +0000)]
Add CPU_STARTING notifier during CPU bringup.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agox86: time: tsc_set_info() must skip the idle domain.
Keir Fraser [Thu, 9 Dec 2010 16:15:10 +0000 (16:15 +0000)]
x86: time: tsc_set_info() must skip the idle domain.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agoMove IDLE_DOMAIN_ID defn to public header, and change DOMID_INVALID to fix clash.
Keir Fraser [Thu, 9 Dec 2010 10:09:59 +0000 (10:09 +0000)]
Move IDLE_DOMAIN_ID defn to public header, and change DOMID_INVALID to fix clash.

Signed-off-by: Keir Fraser <keir@xen.org>
15 years agox86: Simplify tsc_set_info() slightly -- no domain has id DOMID_INVALID.
Keir Fraser [Thu, 9 Dec 2010 09:57:08 +0000 (09:57 +0000)]
x86: Simplify tsc_set_info() slightly -- no domain has id DOMID_INVALID.

Signed-off-by: Keir Fraser <keir@xen.org>