Keith Coleman [Wed, 4 Jan 2012 07:37:29 +0000 (02:37 -0500)]
fix for changeset 19997:985c41cd52da AMD OSVW for Xen
This path enables AMD OSVW (OS Visible Workaround) feature for
Xen. New AMD errata will have a OSVW id assigned in the future. OS is
supposed to check OSVW status MSR to find out whether CPU has a specific
erratum. Legacy errata are also supported in this patch:
traditional family/model/stepping approach will be used if OSVW feature
isn't applicable. This patch is adapted from Hans Rosenfeld's
patch submitted to Linux kernel.
Signed-off-by: Wei Huang <wei.huang2@amd.com> Signed-off-by: Hans Rosenfeld <hands.rosenfeld@amd.com> Acked-by: Jan Beulich <jbeulich@novell.com>
Keith Coleman [Wed, 4 Jan 2012 06:15:08 +0000 (01:15 -0500)]
xen/libxc: set CPUID topology leaf as unsupported for PV guests
The result of a CPUID Extended Topology Enumeration leaf for PV guests
is invalid as the level in ECX is ignored. This can cause some guests
to loop endlessly when trying to enumerate the topology.
Since the physical topology isn't useful to PV guests set the topology
leaf as unsupported.
Guests affected include Linux kernels prior 2.6.32 where a workaround
was applied ("xen: mask extended topology info in cpu", 82d6469916c6fcfa345636a49004c9d1753905d1).
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
xen-unstable changeset: 23700:867bb675b57b
xen-unstable date: Sat Jul 16 09:05:45 2011 +0100
Keith Coleman [Wed, 4 Jan 2012 06:07:02 +0000 (01:07 -0500)]
x86 cpu: Fix bug: unify cpu_dev attr as __cpuinitdata
Currently different x86 cpu define different attr for cpu_dev.
Some cpu define as __initdata, this would be risk under cpu hotplug.
This patch fix the bug, unify them as __cpuinitdata, as what AMD cpu
define now.
Keith Coleman [Wed, 4 Jan 2012 05:54:37 +0000 (00:54 -0500)]
VT-d: always clean up dpci timers.
If a VM has all its PCI devices deassigned, need_iommu(d) becomes
false but it might still have DPCI EOI timers that were init_timer()d
but not yet kill_timer()d. That causes xen to crash later because the
linked list of inactive timers gets corrupted, e.g.:
Keith Coleman [Wed, 4 Jan 2012 05:32:00 +0000 (00:32 -0500)]
x86/vmx: don't call __vmxoff() blindly
If vmx_vcpu_up() failed, __vmxon() would generally not have got
(successfully) executed, and in that case __vmxoff() will #UD.
Additionally, any panic() during early resume (namely the tboot
related one) would cause vmx_cpu_down() to get executed without
vmx_cpu_up() having run before.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen-unstable changeset: 23848:cf37d2eec2ef
xen-unstable date: Sat Sep 17 16:26:37 2011 +0100
Keith Coleman [Wed, 4 Jan 2012 05:15:47 +0000 (00:15 -0500)]
VT-d: fix off-by-one error in RMRR validation
(base_addr,end_addr) is an inclusive range, and hence there shouldn't
be a subtraction of 1 in the second invocation of page_is_ram_type().
For RMRRs covering a single page that actually resulted in the
immediately preceding page to get checked (which could have resulted
in a false warning).
Keith Coleman [Wed, 21 Dec 2011 01:18:34 +0000 (20:18 -0500)]
tools/blktap, blktap2: include <sys/mount.h> instead of <linux/fs.h>
The former is a userspace sanitised header which contains the
definitions we need. In some distros linux/fs.h defines WRITE which
conflicts with blktaps own use of that name.
Also there is no reason to use <linux/errno.h> over the more normal
<errno.h>.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen-unstable changeset: 22765:0dbad563a659
xen-unstable date: Mon Jan 17 17:14:20 2011 +0000
Keith Coleman [Wed, 21 Dec 2011 01:17:17 +0000 (20:17 -0500)]
tools/python: fix xm list for Python 2.7
This patch fixes
Unexpected error: <type 'exceptions.AttributeError'>
This is due to xmlrpc changes in Python 2.7. This patch should
fixe it for both old and new versions.
Signed-off-by: Michael Young <m.a.young@durham.ac.uk> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen-unstable changeset: 22045:2940165380de
xen-unstable date: Thu Aug 19 17:09:30 2010 +0100
Keith Coleman [Wed, 21 Dec 2011 01:16:18 +0000 (20:16 -0500)]
hvmloader: Switch to absolute addressing for calling hypercall stubs.
This is clearer and less fragile than trying to make relative calls
work. In particular, the old approach failed if _start was not
== HVMLOADER_PHYSICAL_ADDRESS. This was the case for some modern
toolchains which reorder functions.
Keith Coleman [Wed, 21 Dec 2011 00:04:21 +0000 (19:04 -0500)]
x86 svm: Disable intercepting CR3 writes when nested paging is enabled
This patch disables intercepting CR3 writes when nested paging is
enabled. For
applications which cause excessive CR3 accesses, the patch can increase
their
performance.
Keith Coleman [Wed, 21 Dec 2011 00:03:38 +0000 (19:03 -0500)]
AMD OSVW (OS Visible Workaround) for Xen
This path enables AMD OSVW (OS Visible Workaround) feature for Xen. New
AMD errata will have a OSVW id assigned in the future. OS is
supposed to check OSVW status MSR to find out whether CPU has a specific
erratum. Legacy errata are also supported in this patch:
traditional family/model/stepping approach will be used if OSVW feature
isn't applicable. This patch is adapted from Hans Rosenfeld's
patch submitted to Linux kernel.
Signed-off-by: Wei Huang <wei.huang2@amd.com> Signed-off-by: Hans Rosenfeld <hands.rosenfeld@amd.com> Acked-by: Jan Beulich <jbeulich@novell.com>
Keith Coleman [Wed, 21 Dec 2011 00:02:41 +0000 (19:02 -0500)]
svm: Fix for AMD erratum 383 on Family 10h CPUs
This patches implements the workaround of AMD erratum 383 on family 10h
CPUs. It destroys the guest VM when a MC error with a special pattern is
detected. Without this patch, a guest VM failure can potentially crash
Xen hypervisor and the whole system. The erratum will be published in
next version of guide.
Keith Coleman [Fri, 30 Sep 2011 22:37:42 +0000 (18:37 -0400)]
Passthrough: disable bus-mastering on any card that causes an IOMMU
fault.
This stops the card from raising back-to-back faults and live-locking
the CPU that handles them.
Signed-off-by: Tim Deegan <tim@xen.org> Acked-by: Wei Wang2 <wei.wang2@amd.com> Acked-by: Allen M Kay <allen.m.kay@intel.com>
xen-unstable changeset: 23762:537ed3b74b3f
xen-unstable date: Fri Aug 12 11:29:24 2011 +0100 Committed-by: Keith Coleman <keith.coleman@n2servers.com>
Keith Coleman [Fri, 30 Sep 2011 22:37:13 +0000 (18:37 -0400)]
x86/HPET: bug fix
This patch fixes a bug where an unitialized lock lookedlock looked like
a locked lock. Now we always call spin_lock_init on the legacy variable.
Thanks for Andrew Coopers suggestion.
Xen-unstable changeset 23031:5263151fba9b contains the fix along with
many other cleanups.
Signed-off-by: Keith Coleman <keith.coleman@n2servers.com> Signed-off-by: Jeff Bester <jeff.bester@n2servers.com> Committed-by: Keith Coleman <keith.coleman@n2servers.com>
Keith Coleman [Tue, 30 Aug 2011 07:05:09 +0000 (03:05 -0400)]
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> Committed-by: Keith Coleman <keith.coleman@n2servers.com>
Keith Coleman [Tue, 30 Aug 2011 06:35:58 +0000 (02:35 -0400)]
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: Keith Coleman <keith.coleman@n2servers.com>
tools: assume that special Xen devices have been created by the platform
Remove all the magic surrounding the special Xen devices in Linux
specific code whereby we attempt to figure out what the correct
major:minor number is and check the the existing device has these
numbers etc. In 2010 we really should be able to trust that the
platform has created the devices correctly or provide correct
configuration settings such that they are without resorting to tearing
down the platform configured state and rebuilding it.
tools/hotplug/Linux/xen-backend.rules already contains the necessary
udev rules to create /dev/xen/evtchn and friends in the correct place.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
xen-unstable changeset: 21507:a3bdee5a20da
xen-unstable date: Wed Jun 02 10:54:32 2010 +0100
Keir Fraser [Tue, 8 Jun 2010 11:00:22 +0000 (12:00 +0100)]
xenstore: Make sure that libxs reports an error if xenstored drops
the connection, rather than getting stuck forever.
Patch from: Steven Smith <steven.smith@eu.citrix.com> Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
xen-unstable changeset: 21463:5be2d2a7f445
xen-unstable date: Thu May 27 08:20:26 2010 +0100
xenstore: Fix cleanup_pop() definition for some (buggy) pthread.h headers.
xs: avoid pthread_join deadlock in xs_daemon_close
Doing a pthread_cancel and join on the reader thread while holding all
the request/reply/watch mutexes can deadlock if the thread needs to
take any of those mutexes to exit. Kill off the reader thread before
taking any mutexes (which should be redundant if we're
single-threaded at that point).
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
xen-unstable changeset: 21354:9de69d816b11
xen-unstable date: Wed May 12 08:49:13 2010 +0100
xs: make sure mutexes are cleaned up and memory freed if the read
thread is cancelled
If the read thread is terminated with pthread cancel, it must make
sure all memory is freed and mutexes are unlocked.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
xen-unstable changeset: 21353:2dd3141b3e3e
xen-unstable date: Wed May 12 08:48:14 2010 +0100
Keir Fraser [Thu, 13 May 2010 09:40:19 +0000 (10:40 +0100)]
Even 'dummy' domains (e.g., dom_xen a.k.a. DOMID_XEN) must have valid I/O caps.
Ensure the rangesets are always initialised. Certain (privileged)
invocations of hypercalls such as mmu_update can end up interrogating
these special domains for possible I/O capabilities.
Keir Fraser [Thu, 13 May 2010 09:27:58 +0000 (10:27 +0100)]
x86: Relocate boot trampoline to avoid BIOS conflicts.
Fix booting through iSCSI protocol with Broadcom network cards.
These boards use the option ROM feature to implement the TCP/IP stack
protocol, and the iSCSI software initiator. The memory address
normally used by the PMM is 0x87000 which conflicts with the memory
allocation for Xen's trampoline routine, currently 0x88000.
Keir Fraser [Tue, 11 May 2010 07:42:30 +0000 (08:42 +0100)]
VT-d: prevent watchdog timer from kicking in when
initializing on systems with huge amounts of memory
Process pending soft-IRQs every 4G worth of pages initialized for Dom0
to keep timekeeping happy and prevent the NMI watchdog (when enabled)
from kicking in.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen-unstable changeset: 21340:220fa418eaae
xen-unstable date: Tue May 11 08:35:45 2010 +0100
Keir Fraser [Mon, 10 May 2010 08:57:43 +0000 (09:57 +0100)]
svm: Avoid VINTR injection during NMI shadow
It is invalid because we get vmexit via IRET interception in this
case. VINTR is unaware of NMI shadows and may vmexit early, leaving us
in an endless loop of VINTR injections and interceptions.
Signed-off-by: Wei Wang <wei.wang2@amd.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen-unstable changeset: 21331:bbf009817ffb
xen-unstable date: Fri May 07 19:22:28 2010 +0100
Keir Fraser [Thu, 6 May 2010 11:03:22 +0000 (12:03 +0100)]
blktap/fs-back: Build fixes for Fedora 13
1. Some files use stat, mkfifo, mkdir etc. without including
sys/stat.h
2. Some programs link against libpthread without a -lpthread compile
option. The compile used to work if this library happened to be used
by one of the other libraries that was being linked against, but
Fedora 13 has stopped allowing this.
From: M A Young <m.a.young@durham.ac.uk> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen-unstable changeset: 21036:c1f272c3a441
xen-unstable date: Mon Mar 15 17:08:29 2010 +0000
This patch fixes the following error on ia64:
iommu.c: In function 'init_vtd_hw':
iommu.c:1831: error: 'nr_ioapics' undeclared (first use in this
function)
x86, shadow: propagate pat caching on the shadow l1
PAT caching was only propagated if has_arch_pdevs(),
causing the hvm_get_mem_pinned_cacheattr() to be ignored
in the non passthrough case.
l1_disallow_mask() needs to be relaxed.
We recently found that FreeBSD 8.0 guest failed to install and boot on
Xen. The reason was that FreeBSD detected clflush feature and invoked
this instruction to flush MMIO space. This caused a page fault; but
x86_emulate.c failed to emulate this instruction (not supported). As a
result, a page fault was detected inside FreeBSD. A similar issue was
reported earlier.
Due to changes in grub2, menu entry titles now have single quote
around them rather than double quotes, but the memtest entries still
are using double quotes, so we need to catch both.
If OOS mode is enabled, after last possible resync, read the guest l1e
one last time. If it's different than the original read, start over
again.
This fixes a race which can result in inconsistent in-sync shadow
tables, leading to corruption:
v1: take page fault, read gl1e from an out-of-sync PT.
v2: modify gl1e, lowering permissions
[v1,v3]: resync l1 which was just read.
v1: propagate change to l1 shadow using stale gl1e
Now we have an in-sync shadow with more permissions than the guest.
The resync can happen either as a result of a 3rd vcpu doing a cr3
update, or under certain conditions by v1 itself.
The final, flushing call to discard_file_cache also discards any
errors from fsync. Call fsync explicitly before leaving, to check if
all VM memory actually made it to the disk.
Keir Fraser [Tue, 30 Mar 2010 12:39:53 +0000 (13:39 +0100)]
mcheck: Small fix for CMCI Threshold set problem.
When generating new threshold value, we must firstly clean old value
before or the new set value since the new value might be different
with the old (BIOS might pre-set some threshold).
Signed-off-by: Liping Ke <liping.ke@intel.com> Signed-off-by: Ying Huang <ying.huang@intel.com>
xen-unstable changeset: 21081:af86222ddaeb
xen-unstable date: Tue Mar 30 08:32:34 2010 +0100
Keir Fraser [Tue, 30 Mar 2010 12:38:16 +0000 (13:38 +0100)]
cpufreq: fix statistic lock problem
cpufreq_statistic_lock should not only protect the statistic memory
pointed by cpufreq_statistic_data[cpu], but also have to protect the
pointer in cpufreq_statistic_data[cpu] itself. So move the read
operation of cpufreq_statistic_data[cpu] after
spin_lock(cpufreq_statistic_lock).
Signed-off-by: Wei Gang <gang.wei@intel.com>
xen-unstable changeset: 21071:415c0bf4ac7a
xen-unstable date: Fri Mar 26 08:49:13 2010 +0000
Keir Fraser [Tue, 30 Mar 2010 12:37:15 +0000 (13:37 +0100)]
x86: s3: write_msi_msg: entry->msg should be in the compatibility format
When Interrupt Remapping is used, after Dom0 S3, Dom0's filesystem
might become inaccessible as the SATA disk's MSI interrupt becomes
buggy. The cause is: After set_msi_affinity() or setup_msi_irq()
invokes write_msi_msg(), entry->msg records the remappable format
message; during S3 resume, Dom0 invokes the PHYSDEVOP_restore_msi
hypercall to restore the MSI registers of devices, and in
pci_restore_msi_state() -> write_msi_msg(), the 'entry->msg' of
remappable format is passed, but in write_msi_msg() -> ... ->
msi_msg_to_remap_entry(), the 'msg' is assumed to be in compatibility
format. As a result, after s3, the IRTE is corrupted.
Actually the only users of 'entry->msg' are pci_restore_msi_state()
and dump_msi(). That's why we don't have issue except Dom0 S3.
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
xen-unstable changeset: 21065:e362fab06d42
xen-unstable date: Thu Mar 25 09:19:33 2010 +0000
Keir Fraser [Tue, 30 Mar 2010 12:36:32 +0000 (13:36 +0100)]
Fix gdbserver-xen support on older kernels.
The xc_ptrace API relies on errno for passing success/failure
indication back to callers. However, mapping operations that fall
back on legacy APIs may leave errno set to a non-zero result even
thought the operation is successful. This patch resets errno after
successful map operations so that xc_ptrace doesn't inadvertently
return a failure.
Keir Fraser [Tue, 30 Mar 2010 12:36:04 +0000 (13:36 +0100)]
x86: fix improper return value from relinquish_memory()
While apparently only a theoretical possibility (domain_kill() has a
BUG_ON() that wasn't reported to trigger so far), I still think it is
better to have the code cleaned up.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen-unstable changeset: 21061:12aebcebff2a
xen-unstable date: Thu Mar 25 07:40:09 2010 +0000
Fix 21051:bcc09eb7379f "x86_32: Relocate multiboot modules to below 1GB."
Copy the modules in ascending order in memory, rather than decsending
order. This reduces the likelihood of the second relocation (in
setup.c) corrupting modules through accidental overwriting.
Keir Fraser [Wed, 24 Mar 2010 11:16:58 +0000 (11:16 +0000)]
Fix a race condition for cpufreq dbs timer while S3 resuming
The cpufreq_dbs_timer_suspend/resume may race with dbs_timer_init
while s3 resuming before this patch.
This patch along with cset 21030 fix the bug 1586
http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1586.
Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Wei Gang <gang.wei@intel.com>
xen-unstable changeset: 21041:066c3eead6ec
xen-unstable date: Wed Mar 17 09:18:34 2010 +0000
Keir Fraser [Wed, 24 Mar 2010 11:15:48 +0000 (11:15 +0000)]
pygrub: further improve grub2 support
* Improve syntax error messages to say what actually went wrong
instead of giving an arbitrary and basically useless
integer.
* Improve handling of quoted values used with the "set" command,
previously only the default variable was special cased to
handle quoting.
* Allow for extra options to the menuentry command, syntax now
appears to be
menuentry "TITLE" --option1 --option2 {...}
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
xen-unstable changeset: 21033:25446394d21f
xen-unstable date: Mon Mar 15 13:23:07 2010 +0000