Keir Fraser [Tue, 31 Mar 2009 10:13:56 +0000 (11:13 +0100)]
xend: fix domain_migrate
When the guest(pv-on-hvm guest that cannot suspend) reboot in
LiveMigration, the disconnecting of src-side is not transmitted to
dist-side. As a result, the error processing on the dist side is not
executed.
Keir Fraser [Tue, 24 Mar 2009 06:55:29 +0000 (06:55 +0000)]
libxc: fix link error of xc_save on ia64
The suspend event channel functions are arch independent code
which xc_save uses.
The changeset of 19382:a5f497f02e34 cause link error on ia64.
This patch moves the functions into arch common file from
x86 specific file xc_domain_save.c
Keir Fraser [Fri, 20 Mar 2009 17:24:29 +0000 (17:24 +0000)]
x86: Core support for Intel MCA support
Those patches based on AMD and SUN's MCA related jobs.
We have latest rebase after SUN's latest improvements.
We will have late following patches for recovery actions. This is a
basic framework for Intel.
Some implementation notes:
1) When error happens, if the error is fatal (pcc = 1) or can't be
recovered (pcc = 0, yet no good recovery methods),
for avoiding losing logs in DOM0, we will reset machine
immediately. Most of MCA MSRs are sticky. After reboot,
MCA polling mechanism will send vIRQ to DOM0 for logging.
2) When MCE# happens, all CPUs enter MCA context. The first CPU who
read&clear the error MSR bank will be this
MCE# owner. Necessary locks/synchronization will help to judge the
owner and select most severe error.
3) For convenience, we will select the most offending CPU to do most
of processing&recovery job.
4) MCE# happens, we will do three jobs:
a. Send vIRQ to DOM0 for logging
b. Send vMCE# to Impacted Guest (Currently Only inject to impacted
DOM0)
c. Guest vMCE MSR virtualization
5) Some further improvement/adds for newer CPUs might be done later
a) Connection with recovery actions (cpu/memory online/offline)
b) More software-recovery identification in severity_scan
c) More refines and tests for HVM might be done when needed.
Keir Fraser [Fri, 20 Mar 2009 12:33:55 +0000 (12:33 +0000)]
CPUIDLE: enable MSI capable HPET for timer broadcast
The HPET broadcast was default not enabled because the old code use
HPET channel 0 in legacy replacing mode which will hide both PIT & RTC
irqs and cause issues if RTC is needed in some cases. The upstream
default broadcast timer is PIT, which is in periodic mode (100HZ) and
would be expensive to be used as oneshot. MSI capable HPET is coming
into being. It is capable to deliver interrupt through FSB directly,
and has no side effect.
This patch extends support for MSI HPET based on original legacy HPET
code. The broadcast timer selection logic becomes: 1. if MSI capable HPET
available, use multiple HPET channels (no more than possible cpu num)
in MSI mode; 2. else if legacy replacing mode available for HPET &
'hpetbroadcast' option is given in cmd line, use HPET channel 0 in
legacy mode; 3 else use PIT.
While entering broadcast, it gets a hpet channel (look for a spare one
first, if failing allocate a shared one), attach to current cpu, setup
the irq affinity & broadcast cpumask. While exiting broadcast, it
detach the used hpet channel and try to change the owner if the
broadcast mask is not empty. Some optimizations(static affinity) were
done for (MSI HPET channels >= possible cpu num) case.
A new hw_interrupt_controller 'HPET_MSI' is created for HPET MSI
interrupt handling.
Keir Fraser [Fri, 20 Mar 2009 12:09:20 +0000 (12:09 +0000)]
xend: specify the slot for pass-through devices
Currently a slot may be specified for a hot-plug device,
but not for a pass-through device that is inserted at boot time.
This patch adds support for the latter.
The syntax is:
BUS:DEV.FUNC[@VSLOT]
e.g: 0000:00:1d:0@7
This may be important as recent changes that allow any free PCI
slot to be used for pass-through (and hotplug) may case pass-through
devices to be assigned in different locations to before. Amongst
other things, specifying the slot will allow users to move them
back, if there is a need.
Keir Fraser [Fri, 20 Mar 2009 09:36:57 +0000 (09:36 +0000)]
vtd: fix Dom0 S3 when VT-d is enabled.
On some platforms that support Queued Invalidation and Interrupt
Remapping, Dom0 S3 doesn't work. The patch fixes the issue.
1) In device_power_down(), we should invoke iommu_suspend() after
ioapic_suspend(); in device_power_up(), we should invoke
iommu_resume() before ioapic_resume().
2) Add 2 functions: disable_qinval() and disable_intremap(); in
iommu_suspend(), we invoke them and iommu_disable_translation().
Rename qinval_setup() to enable_qinval() and rename
intremap_setup() to enable_intremap().
3) In iommu_resume(), remove the unnecessary
iommu_flush_{context, iotlb}_global() -- actually we mustn't do that
if Queued Invalidation was enabled before S3 because at this point of
S3 resume, Queued Invalidation hasn't been re-enabled.
4) Add a static global array ioapic_pin_to_intremap_index[] to
remember what intremap_index an ioapic pin uses -- during S3 resume,
ioapic_resume() re-writes all the ioapic RTEs, so we can use the array
to re-use the previously-allocated IRTE;
5) Some cleanups:
a) Change some failure handlings in enable_intremap() to panic().
b) Remove the unnecessary local variable iec_cap in
__iommu_flush_iec().
c) Add a dmar_writeq(iommu->reg, DMAR_IQT_REG, 0) in
enable_qinval().
Keir Fraser [Fri, 20 Mar 2009 09:10:55 +0000 (09:10 +0000)]
vtd: only enable Interrupt Remapping if Queued Invalidation is also enabled.
If Queued Invalidation is not supported or not enabled, we should not
enable Interrupt Remapping even if HW supports it, because Interrupt
Remapping needs Queued Invalidation to invalidate Interrupt Remapping
Cache.
Keir Fraser [Fri, 20 Mar 2009 08:59:47 +0000 (08:59 +0000)]
xenpm: Add a small scheduler knob "sched_smt_power_savings"
Current scheduler only care performance, thus always picks pCPU from
the most idle package. This knob provides another option to pick pCPU from
least idle package, for user who want performance power balance.
Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Tian Kevin <kevin.tian@intel.com>
Keir Fraser [Fri, 20 Mar 2009 08:48:17 +0000 (08:48 +0000)]
cpufreq: Update cpufreq aperf and mperf read, so that it can be used
by both ondemand gov and user program
Current __get_measured_perf read aperf and mperf MSR and then clear
them for the sake of ondemand governor. This solution block user
program to get aperf and mperf on their purpose. In this patch, it no
longer clear aperf and mperf MSR, so that it can be used by both
ondemand gov and user program.
Keir Fraser [Fri, 20 Mar 2009 08:43:53 +0000 (08:43 +0000)]
fs-back: unmapp all shared ring pages when a domain dies
This bug causes some pages not to be properly freed by xen, hence
after a cycle of 50 save\restore we don't have enough spare memory to
start 2 VMs any more. This patch fixes the issue properly unmapping
all the pages needed by the shared ring.
Keir Fraser [Fri, 20 Mar 2009 08:42:14 +0000 (08:42 +0000)]
hvm: Allow HVM guests direct access to 0xed debug/delay port
Port 0x80 is already passed-through. Writes to port 0x80 are
traditionally used as IO delay. Recent Linux kernel versions can be
configured to use port 0xed instead (CONFIG_IO_DELAY_0XED=3Dy).
Ubuntu 8.04 and later kernels are configured to use port 0xed.
In Linux IO delay is implemented by (in|out)[bwl]_p. From a first
glance at Linux it looks like the only relevant usage of delayed IO is
in drivers/video/console/vgacon.c. Affected is VGA console
initialization and font setup. Output / scrolling is not affected.
Signed-off-by: Thomas Friebel <thomas.friebel@amd.com>
Keir Fraser [Thu, 19 Mar 2009 10:20:11 +0000 (10:20 +0000)]
Xen: use proper device ID to search VT-d unit for ARI and SR-IOV device
PCIe Alternative Routing-ID Interpretation (ARI) ECN defines the Extended
Function -- a function whose function number is greater than 7 within an
ARI Device. Intel VT-d spec 1.2 section 8.3.2 specifies that the Extended
Function is under the scope of the same remapping unit as the traditional
function. The hypervisor needs to know if a function is Extended
Function so it can find proper DMAR for it.
And section 8.3.3 specifies that the SR-IOV Virtual Function is under the
scope of the same remapping unit as the Physical Function. The hypervisor
also needs to know if a function is the Virtual Function and which
Physical Function it's associated with for same reason.
Keir Fraser [Thu, 19 Mar 2009 10:05:01 +0000 (10:05 +0000)]
x86, hvm: Fix double-free of vpmu->context
When `opcontrol --shutdown' is called after xenoprof is used on Dom0,
the vpmu owner becomes PMU_OWNER_NONE. So it is possible to acquire
the owner as PMU_OWNER_HVM and to allocate vpmu->context twice. As a
result, the hypervisor panics because of double-alloc/free of
vpmu->context.
Keir Fraser [Wed, 18 Mar 2009 17:30:13 +0000 (17:30 +0000)]
ioemu-stubdom: Use xen-setup-stubdom rather than configure
xen-setup runs the upstream configure script, and ends up
autodetecting various properties of the host and then trying to use
them in stubdom, which works badly.
Keir Fraser [Wed, 18 Mar 2009 13:25:25 +0000 (13:25 +0000)]
fs-back: build fixes
Remove some unused variables and replaces read and write
to the pipe with read_exact and write_exact (these two functions are
implemented in libxc, that we have to link anyway).
This allows fs-backed to be compiled with -D_FORTIFY_SOURCE=2, hence
should fix the problems reported by Boris.
Keir Fraser [Wed, 18 Mar 2009 11:46:32 +0000 (11:46 +0000)]
vtd: Only enable some VT-d features if all VT-d engines support them.
By default, we enable snoop control, queued invalidation and interrupt
remapping if all VT-d engines support them, and for DMA passthrough we
don't enable it by default.
A user can use 'iommu=passthrough' to enable DMA passthrough (only
for Dom0). A user can use 'iommu=no-snoop,no-qinval,no-intremap' to
disable the 3 features.
Keir Fraser [Wed, 18 Mar 2009 11:32:46 +0000 (11:32 +0000)]
xend: Use vnc-listen setting specified in xend config file
If domU frame buffer configuration has no vnclisten attribute set, use
the global vnc-listen address specified in xend configuration file
when updating vfb location. Currently the hardcoded value 'localhost'
is used.
Keir Fraser [Tue, 17 Mar 2009 14:22:50 +0000 (14:22 +0000)]
x86 mcheck: Replace hypervisor MCA telemetry structures with something
more robust and designed to make terminal error telemetry available to
the dom0 panic flow for diagnosis on reboot.
Use common code for a lot of the AMD and Intel MCE handling code.
Signed-off-by: Gavin Maltby <gavin.maltby@sun.com> Signed-off-by: Frank van der Linden <frank.vanderlinden@sun.com>
Keir Fraser [Tue, 17 Mar 2009 10:49:42 +0000 (10:49 +0000)]
xend: Add s3_integrity attribute for XenAPI
When XenAPI is available, xm new and xm create fail.
# xm new vm1
Using config file "/etc/xen/vm1".
Attribute 's3_integrity' not declared
# xm create vm1
Using config file "/etc/xen/vm1".
Attribute 's3_integrity' not declared
Keir Fraser [Tue, 17 Mar 2009 10:40:47 +0000 (10:40 +0000)]
xend: Accept udev events and update physical resource information
When a udev event is received, udevevent.py parses the udev data and
tells XendNode.py to update the physical resource information.
This patch also add a boolean parameter 'xend-udev-event-server', to
let users indicate whether we should enable this function or not.
Keir Fraser [Tue, 17 Mar 2009 10:36:20 +0000 (10:36 +0000)]
xend: Implement DGRAM (connectionless) type socket listeners
Introduce SocketDgramListener and UnixDgramListener classes.
We already have STREAM (connection) type socket listener classes in
the source tree, but we need DGRAM (connectionless) type listeners to
receive udev events.
Keir Fraser [Fri, 13 Mar 2009 10:09:25 +0000 (10:09 +0000)]
xenpm: Add CPU topology info (thread/core/socket)
CPU topology info is necessary for power management analysis. For
example, to analysis the effect of Px state coordination, Cx
package/core coordination, the thread/core/socket topology
information is needed.
This patch add new command "get-cpu-topology" in xenpm to print the
CPU topology info:
Keir Fraser [Fri, 13 Mar 2009 07:37:24 +0000 (07:37 +0000)]
minios: allow to allocate machine contiguous pages
This is a port of XenLinux xen_alloc_contig_memory() to mini-os. A
sufficiently privileged mini-os guest can exchange a small number of
its pages with machine contiguous pages.
Keir Fraser [Thu, 12 Mar 2009 18:48:09 +0000 (18:48 +0000)]
blktap: Move error signaling to blktapctrl
Until now the udev script for blktap devices needs to decide if to
signal success or failure to xend. As this script runs completely
independent of blktapctrl and tapdisk/ioemu which do the real work,
the udev script can't even theoretically know if tapdisk is happy.
This patch removes the udev script and replaces its checks by new
ones in libblktap.
Keir Fraser [Thu, 12 Mar 2009 18:46:26 +0000 (18:46 +0000)]
blktapctrl: Fix too early close of pipes
Connections to ioemu have single_handler set, so they are closed as
soon as all images of a certain type are closed. This is wrong with
ioemu: All images that belong to the same domain are handled by the
same backend process (usually qemu-dm, but also tapdisk-ioemu for
domains without device model), regardless of the image type.
This patch checks for the same-domain condition for ioemu connections.
Keir Fraser [Thu, 12 Mar 2009 18:42:59 +0000 (18:42 +0000)]
blktap: Export disk type constants for ioemu
Currently all disk types that are supported are defined in a header
file private to blktapctrl and tapdisk. When restoring ioemu as a
backend for blktap these constants are needed by ioemu, so move them
to a more public header file.
Keir Fraser [Thu, 12 Mar 2009 18:42:31 +0000 (18:42 +0000)]
blktapctrl: Select backend by prefix
This patch adds support for specifying the backend (tapdisk or ioemu)
to blktapctrl. Images can be specified e.g. as tap:tapdisk:aio,
tap:ioemu:qcow2 or tap:vmdk. When omitting the backend, a default is
chosen based on the image type (currently always tapdisk because ioemu
as a backend is broken until a follow-up patch series against qemu-xen
is applied)
Keir Fraser [Thu, 12 Mar 2009 15:08:08 +0000 (15:08 +0000)]
xend: Fix removing /vm/UUID/device paths when device cannot be disconnected
This is a corrected version of a patch commited as c/s 19250 and
reverted by c/s 19314. Thanks to "trap sigerr ERR" in
xen-hotplug-common.sh the xen-hotplug-cleanup would exit when reading
/local/domain/ID/vm fails thus skipping all the xenstore-rm lines in
the rest of the script.
Change deviceDestroy behavior to remove /vm/UUID/device/...
path only when force was used (as it already does so for both frontend
and backend) and do the removing from xen-hotplug-cleanup script when
we are sure the device is really not attached to the guest any more.
Keir Fraser [Thu, 12 Mar 2009 11:16:54 +0000 (11:16 +0000)]
x86: Fix APIC 0x40 error when CPU online and Host s3 resume
disable_APIC_timer actually is not useful here. Actually it will
trigger a local APIC error when masking the LVT entry when vector is
zero (before timer is inited) on Intel P6 family. This APIC error(40)
appears when online the offlined CPU and Host S3 resume.
Signed-off-by: Liping Ke <liping.ke@intel.com> Signed-off-by: Gang Wei <gang.wei@intel.com>