Jan Beulich [Fri, 20 May 2011 12:49:36 +0000 (13:49 +0100)]
x86: clear CPUID output of leaf 0xd for Dom0 when xsave is disabled
Linux starting with 2.6.36 uses the XSAVEOPT instruction and has
certain code paths that look only at the feature bit reported through
CPUID leaf 0xd sub-leaf 1 (i.e. without qualifying the check with one
evaluating leaf 4 output). Consequently the hypervisor ought to mimic
actual hardware in clearing leaf 0xd output when not supporting xsave.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen-unstable changeset: 23353:a768a10d32b4
xen-unstable date: Fri May 20 08:54:45 2011 +0100
Olaf Hering [Fri, 20 May 2011 12:47:08 +0000 (13:47 +0100)]
x86/mm: add HVMOP_get_mem_type hvmop
The balloon driver in the guest frees guest pages and marks them as
mmio. When the kernel crashes and the crash kernel attempts to read
the
oldmem via /proc/vmcore a read from ballooned pages will generate 100%
load in dom0 because Xen asks qemu-dm for the page content. Since the
reads come in as 8byte requests each ballooned page is tried 512
times.
Add a new hvmop HVMOP_get_mem_type to return the hvmmem_type_t for the
given pfn. Pages which are neither ram or mmio will be HVMMEM_mmio_dm.
This interface enables the crash kernel to skip ballooned pages.
Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Tim Deegan <Tim.Deegan@citrix.com> Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
xen-unstable changeset: 23298:26413986e6e0
xen-unstable date: Wed May 04 13:37:58 2011 +0100
Igor Mammedov [Mon, 16 May 2011 12:38:09 +0000 (13:38 +0100)]
VT-d: Fix resource leaks on error paths
On error exit from functions, maped pages should be unmapped
and acquired locks released.
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Acked-by: Allen Kay <allen.m.kay@intel.com>
xen-unstable changeset: 23343:edcf8fc77b64
xen-unstable date: Mon May 16 13:29:24 2011 +0100
Ian Campbell [Mon, 16 May 2011 12:36:45 +0000 (13:36 +0100)]
x86/ioapic: avoid gcc 4.6 warnings about uninitialised variables
gcc 4.6 complains:
io_apic.c: In function 'restore_IO_APIC_setup':
/build/user-xen_4.1.0-3-amd64-zSon7K/xen-4.1.0/debian/build/build-hypervisor_amd64_amd64/xen/include/asm/io_apic.h:150:26:
error: '*((void *)&entry+4)' may be used uninitialized in this
function [-Werror=uninitialized]
io_apic.c:221:32: note: '*((void *)&entry+4)' was declared
here
/build/user-xen_4.1.0-3-amd64-zSon7K/xen-4.1.0/debian/build/build-hypervisor_amd64_amd64/xen/include/asm/io_apic.h:150:26:
error: 'entry' may be used uninitialized in this function
[-Werror=uninitialized]
io_apic.c:221:32: note: 'entry' was declared here
cc1: all warnings being treated as errors
Add functions to read/write an entire IO APIC entry using an explicit
union to allow gcc to spot the initialisation.
Reported as Debian bug #625438, thanks to Matthias Klose.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Jan Beulich <jbeulich@novell.com>
xen-unstable changeset: 23341:87084ca76c9c
xen-unstable date: Mon May 16 13:13:41 2011 +0100
Keir Fraser [Thu, 12 May 2011 17:03:47 +0000 (18:03 +0100)]
x86, vtd: [CVE-2011-1898] Protect against malicious MSIs from untrusted devices.
In the absence of VT-d interrupt remapping support, a device can send
arbitrary APIC messages to host CPUs. One class of attack that results
is to confuse the hypervisor by delivering asynchronous interrupts to
vectors that are expected to handle only synchronous
traps/exceptions.
We block this class of attack by:
(1) setting APIC.TPR=0x10, to block all interrupts below vector
0x20. This blocks delivery to all architectural exception vectors.
(2) checking APIC.ISR[vec] for vectors 0x80 (fast syscall) and 0x82
(hypercall). In these cases we BUG if we detect we are handling a
hardware interrupt -- turning a potentially more severe infiltration
into a straightforward system crash (i.e, DoS).
Thanks to Invisible Things Lab <http://www.invisiblethingslab.com>
for discovery and detailed investigation of this attack.
The checks in assert_irq and deassert_irq to distinguish interrupts
that have been remapped onto event channels from the others that have
to be injected using the emulated lapic are wrong.
Fix the condition checks using the convenient hvm_domain_use_pirq
function.
Tim Deegan [Thu, 12 May 2011 08:19:29 +0000 (09:19 +0100)]
x86: use compat hypercall handlers for calls from 32-bit HVM guests
On 64-bit Xen, hypercalls from 32-bit HVM guests are handled as
a special case, but not all the hypercalls are corrently redirected
to their compat-mode wrappers. Use compat_* for xen_version,
sched_op and set_timer_op for consistency.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
xen-unstable changeset: 23333:fabdd682420c
xen-unstable date: Thu May 12 09:13:18 2011 +0100
Ian Jackson [Mon, 9 May 2011 14:04:01 +0000 (15:04 +0100)]
libxc: [CVE-2011-1583] pv kernel image validation
The functions which interpret the kernel image supplied for a
paravirtualised guest, and decompress it into memory when booting the
domain, are incautious. Specifically:
(i) Integer overflow in the decompression loop memory allocator might
result in overrunning the buffer used for the decompressed image;
(ii) Integer overflows and lack of checking of certain length fields
can result in the loader reading its own address space beyond the
size of the supplied kernel image file.
(iii) Lack of error checking in the decompression loop can lead to an
infinite loop.
This patch fixes these problems.
CVE-2011-1583.
Signed-off-by: Ian Campbell <Ian.Campbell@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Mon, 9 May 2011 11:17:17 +0000 (12:17 +0100)]
Clean up licensing in the public header directory.
The COPYING file at xen/include/public/COPYING clearly states that all
public header files are distributed under a permissive MIT
license. Therefore make sure the same permissive license is included
at the top of every header file (i.e., not GPL).
Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 23286:6f48f5f843f0
xen-unstable date: Sun May 01 10:08:40 2011 +0100
public/arch-ia64/debug_op.h: Reinsert copyright that I accidentally
deleted.
Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 23294:c0a8f889ca9e
xen-unstable date: Sun May 01 13:03:37 2011 +0100
In credit2, there needs to be a strong correlation between
v->processor and the runqueue to which a vcpu is assigned;
much of the code relies on this invariant. Allow credit2
to manage the actual migration itself.
This fixes the most recent credit2 bug reported on the list
(Xen BUG at sched_credit2.c:1606) in Xen 4.1, as well as
the bug at sched_credit2.c:811 in -unstable (which catches the
same condition earlier).
credit2: remove two nested functions, replacing them with static ones
and passing the outer scope's variables in explicitly.
This is needed to compile xen with clang.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 22982:591c459ee00a
xen-unstable date: Mon Mar 07 11:21:11 2011 +0000
Daniel Kiper [Wed, 27 Apr 2011 12:30:41 +0000 (13:30 +0100)]
pv-grub: Fix for incorrect dom->p2m_host[] list initialization
Introduction of Linux Kernel git commit ceefccc93932b920a8ec6f35f596db05202a12fe (x86: default
CONFIG_PHYSICAL_START and CONFIG_PHYSICAL_ALIGN to 16 MB) revealed
deeply hidden bug in pv-grub. During kernel load stage dom->p2m_host[]
list has been incorrectly initialized.
At the beginning of kernel load stage dom->p2m_host[] list is
populated with current PFN->MFN layout. Later during memory allocation
(memory is allocated page by page in kexec_allocate()) page order is
changed to establish linear layout in new domain. It is done by
exchanging subsequent MFNs with newly allocated MFNs. dom->p2m_host[]
list is indexed by currently requested PFN (it is incremented from 0)
and PFN of newly allocated paged. If PFN of newly allocated page is
less than currently requested PFN then earlier allocated MFN is
overwritten which leads to domain crash later. This patch corrects
that issue. If PFN of newly allocated page is less then currently
requested PFN then relevant PFN/MFN pair is properly calculated and
usual exchange occurs later.
Signed-off-by: Daniel Kiper <dkiper@net-space.pl> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
xen-unstable changeset: 23249:83fe79c0225f
xen-unstable date: Wed Apr 27 13:29:14 2011 +0100
Tim Deegan [Mon, 25 Apr 2011 12:38:51 +0000 (13:38 +0100)]
vtd: check and print EPT compatibility once, at boot.
Merge the check for EPT/VT-D pagetable compatibility into the other
VT-D boot-time checks. Previously it was checking and printing many
times on each VM boot.
x86: don't write_tsc() non-zero values on CPUs updating only the lower 32 bits
This means suppressing the uses in time_calibration_tsc_rendezvous(),
cstate_restore_tsc(), and synchronize_tsc_slave(), and fixes a boot
hang of Linux Dom0 when loading processor.ko on such systems that
have support for C states above C1.
remus: fix incorrect error handling for switch_qemu_logdirty in checkpoint code
c/s 22275: "tools: cleanup domain save switch_qemu_logdirty callback"
introduced a whole bunch of error code fixups. In the process, it also
ended up treating the success return code (0) from
switch_qemu_logdirty as an error and vice versa.
Wei Wang [Mon, 25 Apr 2011 12:28:17 +0000 (13:28 +0100)]
AMD IOMMU: Fix an interrupt remapping issue
Some device could generate bogus interrupts if an IO-APIC RTE and an
iommu interrupt remapping entry are not consistent during 2 adjacent
64bits IO-APIC RTE updates. For example, if the 2nd operation updates
destination bits in RTE for SATA device and unmask it, in some case,
SATA device will assert ioapic pin to generate interrupt immediately
using new destination but iommu could still translate it into the old
destination, then dom0 would be confused. To fix that, we sync up
interrupt remapping entry with IO-APIC IRE on every 32 bits operation
and forward IOAPIC RTE updates after interrupt.
Signed-off-by: Wei Wang <wei.wang2@amd.com> Acked-by: Jan Beulich <jbeulich@novell.com>
xen-unstable changeset: 23200:995a0c01a076
xen-unstable date: Tue Apr 12 13:26:19 2011 +0100
While running remus, when an error occurs during checkpointing
(e.g., timeouts on primary, failing to checkpoint network buffer
or disk or even communication failure) the domU is sometimes
left in suspended state on primary. Instead of blindly closing
the checkpoint file handle, attempt to resume the domain before
the close.
Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen-unstable changeset: 23195:13ec53a59a42
xen-unstable date: Fri Apr 08 16:49:04 2011 +0100
libxc: set all VCPU's online by default in HVM info table
This sets a saner default for the cpu-online-map by setting all bits
to 1. The default assumption ought to be that nr-vcpus ==
nr-vcpus-at-start. If that is not true, then the toolstack must modify
the bitmap, but if it is true, the toolstack oughtn't need to do
anything further.
When offline a page, or, when a broken page occur, the page maybe
populated, or, may at pod cache. This patch is to handle the
offline/broken page at pod cache. It scan pod cache, if hit, remove
and replace it, and then put the offline/broken page to
page_offlined_list/page_broken_list
c/s 19913 break mce offline page logic:
For page_state_is(pg, free), it's impossible to trigger the case;
For page_state_is(pg, offlined), it in fact didn't offline related
page;
This patch fix the bug, and remove an ambiguous comment.
George Dunlap [Thu, 7 Apr 2011 14:23:47 +0000 (15:23 +0100)]
x86/hvm: load CPU structures from xen versions <=3.4
Xen 4.0 added "msr_tsc_aux" in the middle of the hvm_hw_cpu structure,
making it incompatible with pre-3.4 savefiles. This patch uses the
recently introduced backwards-compatibility infrastructure to convert
the old to the new.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Tim Deegan <Tim.Deegan@citrix.com> Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
xen-unstable changeset: 23172:dc8b05d22a59
xen-unstable date: Wed Apr 06 11:40:54 2011 +0100
George Dunlap [Thu, 7 Apr 2011 14:23:16 +0000 (15:23 +0100)]
hvm: infrastructure for backwards-compatible loading
The hvm_save code is used to save and restore hypervisor-related hvm
state, either for classic save/restore, or for migration (including
remus). This is meant to be backwards-compatible across some
hypervisor versions; but if it does change, there is no way to handle
the old format as well as the new.
This patch introduces the infrastructure to allow a single older
version ("compat") of any given "save type" to be defined, along with
a function to turn the "old" version into the "new" version. If the
size check fails for the "normal" version, it will check the "compat"
version, and if it matches, will read the old entry and call the
conversion function.
This patch involves some preprocessor hackery, but I'm only extending
the hackery that's already there.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Tim Deegan <Tim.Deegan@citrix.com> Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
xen-unstable changeset: 23171:6a5830de7b54
xen-unstable date: Wed Apr 06 11:40:51 2011 +0100
AMD64 defines two special bits (bit 3 and 4) RdMem and WrMem in fixed
MTRR type. Their values are supposed to be 0 after BIOS hands the
control to OS according to AMD BKDG. Unless OS specificially turn them
on, they are kept 0 all the time. As a result, k8_enable_fixed_iorrs()
is unnecessary and removed from upstream kernel (see
https://patchwork.kernel.org/patch/11425/). This patch does the same
thing.
x86, amd, MTRR: correct DramModEn bit of SYS_CFG MSR
Some buggy BIOS might set SYS_CFG DramModEn bit to 1, which can cause
unexpected behavior on AMD platforms. This patch clears DramModEn bit
if it is 1.
Jan Beulich [Fri, 18 Mar 2011 17:20:57 +0000 (17:20 +0000)]
x86/mce: CPU notifiers must not be registered a second time during resume
While c/s 22964:f71212f712fd and 23051:93c864c16ab1 fixed issues with
CPU onlining, they introduced a problem with resume: mcheck_init() is
also being called on that path, and hence checking whether it's
running on CPU 0, which is generally not a really good thing, is
particularly inappropriate here.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen-unstable changeset: 23060:b59e98bc6ff1
xen-unstable date: Fri Mar 18 17:15:19 2011 +0000
Liu, Jinsong [Fri, 18 Mar 2011 17:19:34 +0000 (17:19 +0000)]
x86: mce cleanup for both Intel and AMD mce logic
c/s 22964 fixed a mce memory leaks bug which may trigger xen crash
when cpu online. However, there are 2 mce memory leaks: 1 at mce
level (arch independent), 1 at mce_intel level (arch dependent). At
c/s 22964, it free both leaks at mce_intel level, which would has
problem under AMD arch.
This patch fix this issue.
It alloc/free poll_bankmask (arch independent) at mce level,=20 and
add a notifier block at mce level to avoid xmalloc risk when irq
disable.
With this patch, both Intel and AMD mce works OK in a clean way.
Allen M Kay [Wed, 16 Mar 2011 17:08:27 +0000 (17:08 +0000)]
libxl: passthrough: avoid passing through devices not owned by pciback
This patch makes sure the passthrough device belongs to pciback before
allow them passthrough to the guest. There are still many other
checks missing.
xm terminates the guest startup process when this type of condition is
found. This patch just allows the guest to continue to boot but with
no device passthrough.
Signed-off-by: Allen Kay <allen.m.kay@intel.com> Acked-by: Gianni Tedesco <gianni.tedesco@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Jan Beulich [Tue, 15 Mar 2011 13:55:40 +0000 (13:55 +0000)]
x86: run-time callers of map_pages_to_xen() must check for errors
Again, (out-of-memory) errors must not cause hypervisor crashes, and
hence ought to be propagated.
This also adjusts the cache attribute changing loop in
get_page_from_l1e() to not go through an unnecessary iteration. While
this could be considered mere cleanup, it is actually a requirement
for the subsequent now necessary error recovery path.
Also make a few functions static, easing the check for potential
callers needing adjustment.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen-unstable changeset: 22997:5f28dcea1355
xen-unstable date: Wed Mar 09 16:15:36 2011 +0000
x86: don't BUG() post-boot in alloc_xen_pagetable()
Instead, propagate the condition to the caller, all of which also get
adjusted to check for that situation.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen-unstable changeset: 22996:1eeccafe9042
xen-unstable date: Wed Mar 09 16:14:59 2011 +0000
Gianni Tedesco [Mon, 14 Mar 2011 17:14:16 +0000 (17:14 +0000)]
Allow tools to map arbitrarily large machphys_mfn_list on 32bit dom0
This permits suspend/resume to work with 32bit dom0/tools when system
memory extends beyond 160GB (and up to 1TB).
AFAICT the limit to MACH2PHYS_COMPAT_NR_ENTRIES is redundant since
that refers to a limit in 32bit guest compat mappings under 64bit
hypervisors, not userspace where there may be gigabytes of useful
virtual space available for this.
Suggested-by: Ian Campbell <Ian.Campbell@eu.citrix.com> Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
xen-unstable changeset: 23038:39f5947b1576
xen-unstable date: Mon Mar 14 17:13:15 2011 +0000
Jan Beulich [Mon, 14 Mar 2011 17:08:00 +0000 (17:08 +0000)]
x86: fix cpu_sibling_map initialization when topology CPUID leaf is present
c/s 21811:12f0618400de broke this by not properly initializing struct
cpuinfo_x86's x86_num_siblings member (other than Linux, where this is
a global variable, it is being maintained per CPU by Xen).
Hyper-threaded CPUs with CPUID leaf 0xb present had therefore all
cpu_sibling_map-s with just a single bit set, thus improperly feeding
the scheduler.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen-unstable changeset: 23037:a29b35408950
xen-unstable date: Mon Mar 14 17:05:21 2011 +0000
Wei Gang [Mon, 14 Mar 2011 17:07:29 +0000 (17:07 +0000)]
x86: add volatile prefix for cpuid asm clauses
cpuid results are possible to be changed now. For example, changing
CR4.OSXSAVE bit or setting MSR XCR_XFEATURE_ENABLED_MASK may change
XSAVE related cpuid leave return values.
The volatile prefix is required to avoid the second cpuid calls
following some possible changing operations being optimized in
incorrect way by compiler.
The sample bug is in xsave_init while debug=3Dn. The second call to
cpuid_count() may be optimized and lead to a BUG_ON case while compare
xsave_cntxt_size with ebx.
Signed-off-by: Wei Gang <gang.wei@intel.com>
xen-unstable changeset: 23036:9a15ff175e00
xen-unstable date: Mon Mar 14 17:04:42 2011 +0000
Jan Beulich [Sat, 12 Mar 2011 13:25:44 +0000 (13:25 +0000)]
x86/HPET: fix initialization order
At least the legacy path can enter its interrupt handler callout while
initialization is still in progress - that handler checks whether
->event_handler is non-NULL, and hence all other initialization must
happen before setting this field.
Do the same to the MSI initialization just in case (and to keep the
code in sync).
Signed-off-by: Jan Beulich <jbeulich@novell.com> Acked-by: Wei Gang <gang.wei@intel.com>
xen-unstable changeset: 23030:87aa1277eae0
xen-unstable date: Sat Mar 12 13:19:02 2011 +0000
Ian Jackson [Fri, 11 Mar 2011 18:35:15 +0000 (18:35 +0000)]
libxl: do not try to use blktap with qdisk
libxl_device_disk_add tries to use blktap when available even for qdisk
devices, this patch fixes it.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
(cherry-picked from xen-unstable
changeset a8fee4ad3ad0650e7a5cc0fb253c6a0ada1ac583)
Liu, Jinsong [Fri, 11 Mar 2011 17:33:30 +0000 (17:33 +0000)]
x86: Fix cpu offline bug: add clflush inside dead loop
At some platform (like Xen 7400), when hyperthreading, an offlined
thread may waked spuriously up by its brother, and returning around
the loop. This patch explicitly clflush the cache line in a light
weight way to workaround potential issue. Unlike wbinvd, clflush is
not serializing instruction, hence memory fence is necessary to make
sure all load/store operation visible before flush cache line.
Current xen cpu offline logic flush cache too early, which potentially
break cache coherency. wbinvd should be the last ops before cpu going
into dead, otherwise cache may be dirty, i.e, something like setting
an A bit on page tables. Pointed out by Arjan van de Ven.
x86: Fix cpu offline bug: cancel SYSIO method when play dead
Play dead is a fragile and tricky point of cpu offline logic. For how
to play cpu dead, linux kernel changed several times: Very old kernel
support 3 ways to play cpu dead: mwait, SYSIO, and halt, just like
what cpuidle did when enter C3; Later, it cancel mwait and SYSIO
support, only use halt to play dead; Latest linux 2.6.38 add mwait
support when cpu dead.
This patch cancel SYSIO method when cpu dead, keep same with latest
kernel.
SYSIO is an obsoleted method to enter deep C, with some tricky
hardware behavior, and seldom supported in new platform. Xen
experiment indicate that when cpu dead, SYSIO method would trigger
unknown issue which would bring strange error. We now cancel SYSIO
method when cpu dead, after all, correctness is more important than
power save, and btw new platform use mwait.
Jim Fehlig [Thu, 10 Mar 2011 18:17:55 +0000 (18:17 +0000)]
libxl: Call setsid(2) before exec'ing device model
While doing development on libvirt libxenlight driver I noticed
that terminating a libxenlight client causes any qemu-dm
processes that were indirectly created by the client to also
terminate. Calling setsid(2) before exec'ing qemu-dm resolves
the issue.
Signed-off-by: Jim Fehlig <jfehlig@novell.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
update README: we are missing few compile time dependencies and a link
to the pvops kernel page on the wiki.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Campbell [Wed, 9 Mar 2011 17:07:17 +0000 (17:07 +0000)]
xl/xm: make pci-list use same BDF format as all other commands
In particular using the same syntax as pci-{attach,detach} uses is
very helpful.
(Backport from xen-unstable as 23015:1df8f9732d1d.)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Introduce flexarray_append_pair: a simple syntactic sugar to add a pair
of pointers to a flexarray, very useful when adding pairs of strings to
xenstore.
Replace flexarray_vappend calls (and one pair of flexarray_append)
with flexarray_append_pair calls when dealing with flexarrays that are
going to be used with libxl__xs_kvs_of_flexarray:
NULL is a valid pointer value in these cases while flexarray_vappend
uses NULL as vargs terminator, so the old code is buggy.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Make the DISK_TYPE_* id numbering in tapdisk-disktypes.h contiguous.
Currently, id 8 is unallocated causing a null disk type entry in
tapdisk_disk_drivers array in tapdisk-disktypes.c. This causes the
function tapdisk_disktype_find() to return an error on encountering
disk types >7 (remus:, log:, etc.).
(Also applied to xen-unstable as 22987:649de04caff5.)
Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca> Acked-by: Daniel Stodden <daniel.stodden@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Sat, 5 Mar 2011 11:37:42 +0000 (11:37 +0000)]
x86: On CPU offline, fix master waiting for slave to be fully dead.
On two back-to-back CPU offline operations, on second offline the
cpu_state var will be CPU_STATE_DEAD from the first offline. Hence
__cpu_die() will incorrectly not wait for the second slave to fully
die and set cpu_state itself.
The fix is to set cpu_state to a new value, CPU_STATE_DYING, earlier
during CPU offline, before __cpu_die() starts to execute.
Original diagnosis and patch by Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 22975:d3d29df8f082
xen-unstable date: Sat Mar 05 11:34:41 2011 +0000
Keir Fraser [Sat, 5 Mar 2011 11:35:29 +0000 (11:35 +0000)]
preempt: Disable preemption support for 4.1.
Preemption support is not needed for 4.1 branch as synchronous yield
(via waitqueues) is not used. Furthermore there are still some
unbalanced rcu_lock/unlock usages on some code paths and the stricter
requirements of the preemption subsystem can cause us to BUG out on
them.
Wei Gang [Thu, 3 Mar 2011 18:51:13 +0000 (18:51 +0000)]
tools: gtracestate: fix several problems
Fixed problems include:
* previously just print out a error instead of help info
while running without cmdline parameters.
* -u & -n lead to Segmentation fault.
* -c and then use default ranges, the default ranges is not
50us... but 50000/tsc2us....
Signed-off-by: Wei Gang <gang.wei@intel.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Thu, 3 Mar 2011 17:11:31 +0000 (17:11 +0000)]
libxl: correctly initialise yylineno
Sometimes xl would read an uninitialised variable when printing error
messages, resulting in things like this:
/etc/xen/thing.cfg:1030057088: config parsing error near `"ws08r2-x64-2': lexical error
This is because yylineno is a variable inside the scanner created by
yylex_init, but it is not initialised by yylex_init.
(Debian bug #616099.)
On the way I discovered a lot of complication to do with the calling
convention between bison and flex in reentrant parsers/scanners which
use locations (Debian bug #616100) but as the above change makes the
current code in xen-unstable work I don't propose to do anything else
about that now in our tree.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Tested-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Campbell [Thu, 3 Mar 2011 17:07:40 +0000 (17:07 +0000)]
xl: add "device_model_args" to pass arbitrary extra arguments to device model
The libxl support was already in place so simply plumb it through.
This allows for passing debug options to the device model and provides
a method to work around missing toolstack functionality.
e.g. xl does not current support floppy disks but adding:
device_model_args = [ "-fda", "/scratch/fdboot.img" ]
allowed me to boot FreeDOS from a floppy image.
I was unable to find any equivalent functionality in xend so this is a
new xl feature.
Moved xmalloc/xrealloc earlier to allow use from parse_config_data.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
libxc: fix incorrect scanning of pfn array in pagebuf during migration
xc_domain_restore.c:apply_batch function makes two passes over the pfn_types
array in pagebuf to allocate the needed MFNs. The curbatch parameter to this
function specifies the array offset in pfn_types, from where the current scan
should begin. But this variable is not taken into account (index always starts
at 0) during the two passes. While this [bug] does not manifest itsef during
save/restore or live migration, under Remus, xc_domain_restore fails due to
corrupt guest page tables.
(This appears to have been broken by 21588:6c3d8aec202d which reverted
two changesets from before Remus support was added and hence
reintroduced some none-Remus compatible bits.)
Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Liu, Jinsong [Wed, 2 Mar 2011 10:31:06 +0000 (10:31 +0000)]
x86: Fix cpu online/offline bug: mce memory leak.
Current Xen mce logic didn't free mcabanks. This would be a memory
leak when cpu offline. When repeatly do cpu online/offline, this
memory leak would make xenpool shrink, and at a time point, will call
alloc_heap_pages --> flush_area_mask, which
ASSERT(local_irq_is_enabled()). However, cpu online is irq disable,
so it finally result in Xen crash.
This patch fix the memory leak bug, and tested OK over 50,000 round
cpu online/offline.