Keir Fraser [Tue, 10 Jun 2008 08:27:01 +0000 (09:27 +0100)]
libxenstat: Fix statistics for blktap disks on linux
Overview: update xenstat vbd statistics parsing from
/sys/devices/xen-backend to process blktap disks
Reason:
-blktap devices (now referenced as tap rather than vbd in
/sys) have statistics counters
(e.g., rd_req, wr_req, oo_req) prepended by tap_
-xenstat behavior did not previously account for this
behavior, which resulted in 0 disks
visible and similarly impacted disk statistics
To reproduce these conditions, make a domain with tap:aio backed disks
on 3.2.x, run xentop, and press B to view VBD stats (nothing will
appear for the domain using tap:aio)
Keir Fraser [Mon, 9 Jun 2008 16:18:27 +0000 (17:18 +0100)]
Allow older PAE Linux guests to access entire compat m2p.
Older PAE guests (prior to xen-unstable.hg 8924:229c602a075a, Feb
2006, this includes some vendor's kernel in the field) use a limit of
0xf6800000 on their code and data segments (i.e. up to the end of the
read-only m2p table).
Newer kernels use a limit of 4G and rely on the hypervisor to clamp to
the actual maximum allowed. 32on64 mode takes advantage of this to
allow a larger m2p than would fit in the PAEonPAE sized hole.
This means that PAE guests with the hardcoded low limit cannot run on
top of a 64 bit hypervisor on a host machine which has more than 16G
of RAM. Fix this by extending any code or data segment which ends
above the start of the hypervisor hole for that guest.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Keir Fraser [Mon, 9 Jun 2008 08:51:14 +0000 (09:51 +0100)]
x86: Fix S3 resume after creating an HVM guest.
If we don't use PIT, we should disable it at boot time and at S3
resuming. In Xen this is done by disable_pit_irq(), but this function
is used by __initcall(). After bootstrap it will be discarded and may be
overwritten. This usually results in S3 resuming failure.
Signed-off-by: Huacai Chen <huacai.chen@intel.com> Signed-off-by: Li Zhang <li.zhang@intel.com>
Keir Fraser [Mon, 9 Jun 2008 08:45:38 +0000 (09:45 +0100)]
xentrace: fix tracing for 64bit guests
Xen tracing some times ago used to put values of type 'long' into the
trace buffer. This has changed to uint32_t. Some trace points log
virtual addresses, which get cropped to 32bit in this case. There were
some inline functions to handle at least PF_XEN and VMEXIT, which
caused a lot of code duplication. The attached patch fixes several
issues:
1. fix and extend tools/xentrace/formats
2. Fix xentrace_format to handle up to 7 parameters
3. create convenience macros to properly log long values
4. remove the inline functions in hvm/trace.h and replace them by macros
5. Change the CPUID trace to work correctly
6. group HVM trace points enable mechanism
I used a similar approach as in PV tracing with bit 8 indicating 64bit
pointers.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Keir Fraser [Mon, 9 Jun 2008 08:44:21 +0000 (09:44 +0100)]
AMD IOMMU: add support for PV guest
Assuming iommu_populate_page_table() is only used for PV guest, a new
check is added into assign_device() to avoid duplicating the work done
by amd_iommu_sync_p2m() for hvm guest.
Bring the DisplayState dpy_resize interface back to how it is in qemu
mainstream, thus making the code easier to merge.
In order to support sharing the framebuffer, I am adding a new resize
interface called dpy_resize_shared that also has a depth and a pixels
parameters. As a consequence I could remove the dpy_colourdepth
callback and make the code cleaner and easier to read.
Keir Fraser [Mon, 9 Jun 2008 08:36:27 +0000 (09:36 +0100)]
xm: Set device_model option value default to None.
If device_model is set to '', xend will fail to execute the device
model. If None, xend will detect it and set a sensible qemu-dm path
instead.
Keir Fraser [Thu, 5 Jun 2008 09:36:19 +0000 (10:36 +0100)]
x86 hvm: Improve paging performance for 64b solaris guests
The following patch provides a 'fast-path' for sh_remove_write_access()
for 64 bit Solaris HVM guests. This provides a significant performance
boost for such guests; our testing shows a 200-400% improvement in
microbenchmarks such as fork(), exit(), etc...
From: Gary Pennington <Gary.Pennington@sun.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Tue, 3 Jun 2008 08:41:19 +0000 (09:41 +0100)]
Improve HPET comparator reprog to prevent intr-near-missing case
HPET intr-near-missing means if the current counter value is too close
to the comparator value to be reprogrammed the expected HPET intr may
be missing. Linux kernel uses a mininal 48-hpet-ticks(~3.5us) distance
to workaround this, but personal observation showed there is still
failure case while delta=3D0xba (~13.5us). So choosing 20us as the
MIN_DELTA_NS should be helpful to prevent near-missing from happening.
local_irq_save/restore were used to avoid disturbance. (+ 2) was used
as a final guard to avoid wrong judgement due to the real happened
near-missing case.
Signed-off-by: Wei Gang <gang.wei@intel.com> Signed-off-by: Tian Kevin <kevin.tian@intel.com>
Keir Fraser [Tue, 3 Jun 2008 08:35:02 +0000 (09:35 +0100)]
x86: Enhance Cx stability by adding softirq check before entry cstate
Without checking softirq_pending before entry Cx state, softirq such
as SCHEDULE_SOFTIRQ and TIMER_SOFTIRQ can't be handled timely. It may
cause severe failures such as disk I/O failure.
This patch addresses the issue above, meanwhile move timing points
closer to cstate entry/exit point to make C3 residency more accurate,
and enable irq a little earlier.
Signed-off-by: Wei Gang <gang.wei@intel.com> Signed-off-by: Tian Kevin <kevin.tian@intel.com>
Keir Fraser [Mon, 2 Jun 2008 15:05:07 +0000 (16:05 +0100)]
rombios: S3 resume fixes.
On AMD cpus, HVM S3 resume was hanging in the bios when trying
to load the x_firmware_waking_vector from absolute
address 0xEA01C (that is, a segment offset greater than 64kB).
This change also now uses 20-bits (instead of 16) from the FACS
standard firmware_waking_vector.
Keir Fraser [Mon, 2 Jun 2008 09:55:55 +0000 (10:55 +0100)]
vmx: Better diagnostic messages when VMXON might have failed due to
bad setting of the IA32_FEATURE_CONTROL MSR. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Fri, 30 May 2008 18:31:18 +0000 (19:31 +0100)]
x86: i8254 device model is shared between PV and HVM guests, so must
take care not to run hvm_get_guest_time() on a PV VCPU. The spinlock
is not initialised and spin_lock() can thus spin forever. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Fri, 30 May 2008 15:04:20 +0000 (16:04 +0100)]
Add xen_phys_start value in the crash info note
This patch makes the vmcore utilities (ex. crash, makedumpfile) be
able to get the relocation address of the xen hypervisor from a
vmcore. It is necessary for the utilities to find the data of the
hypervisor structures.
Note that this patch does not raise any comptibility issue for the
utilities (which I know) nor the other components of xen.
Keir Fraser [Fri, 30 May 2008 14:09:40 +0000 (15:09 +0100)]
[IA64] compilation fix of iommu.h
Trivial compilation fix of iommu.h.
It includes asm/msi.h for struct msi_desc and struct msi_msg
definition.
msi.h doesn't exist yet on ia64 so declare struct msi_desc and
struct msi_msg in iommu.h and don't include asm/msi.h.
Keir Fraser [Fri, 30 May 2008 14:06:08 +0000 (15:06 +0100)]
vtd: Various cleanups and fixes:
* Handle DRHDs with different supported AGAWs. To support this we
create page tables which always have 4 levels, and skip top levels
for units which support only 2 or 3 levels.
* Handle systems with mixed DRHD support for cache snooping. We must
pessimistically CLFLUSH if any DRHD does not support snooping.
Keir Fraser [Thu, 29 May 2008 08:42:59 +0000 (09:42 +0100)]
x86: Fix reboot failure after S3
"warm reset vector" is used to start APs. At booting time, it is set
by BP, and cleared after all APs have started. When do S3, similar work
need to do. However, when enable non-boot CPUs after S3, Xen just sets
this vector, but forgets to clear it after APs startup.
Keir Fraser [Wed, 28 May 2008 15:14:10 +0000 (16:14 +0100)]
vtd: More TLB flush fixes.
- Made the non-present flush testing a bit simpler.
- Removed dma_addr_level_page_maddr(). Use a modified
addr_to_dma_page_maddr() instead.
- Upon mapping new context entry: flush old entry using domid 0 and
always flush iotlb.
Keir Fraser [Wed, 28 May 2008 13:41:23 +0000 (14:41 +0100)]
iommu: Handle sibling device assignment correctly
Domctl interface is extended to allow libxc retrieve device group
information from hypervisor. Vendor-specific iommu_ops is also
extended by adding a new operation "get_device_group_id()", which is
currently a null pointer but could be implemented later for vt-d.
Error will be raised from tools side when user trying to assign PCI
device with a sibling device being driven by dom0. User will keep
being prompted until he has hidden the entire device group (at least,
the sibling devices driven by dom0) in dom0 kernel
parameter. Hopefully this framework could be flexible enough to
support both amd iommu and vt-d.
The following 2 cases are not covered by this patch, but should be
easy to handle.
* Checking for hot-plug devices (maybe we can delay calling
ImageHandler.signalDeviceModel() until all checks are done?)
* Checking for splitted device group between different passthru
domains
Keir Fraser [Wed, 28 May 2008 08:30:48 +0000 (09:30 +0100)]
stubdom: make the build more generic by moving as many stubdom parts
into stubdom/ as possible. That also permits to build all of
ioemu, c and caml stubdoms at the same time.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Tue, 27 May 2008 10:51:33 +0000 (11:51 +0100)]
ioemu: Force floppy disk images to be interpreted as raw.
Fixes specifying fda/fdb image names in domain configs. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Mon, 26 May 2008 07:53:25 +0000 (08:53 +0100)]
xend: take care of dead qemu-dm process
This patch fix xend as when fatal error happened (e.g. qemu-dm process
was killed) log error message then mark that domain as crashed, do
what specified on crashed in the domain config file. Added some code in
xend to check those crashed hvm DM status each 30 seconds.
Keir Fraser [Mon, 26 May 2008 07:37:43 +0000 (08:37 +0100)]
Fix domain names that xentop shows
When I changed the name of a domain by using xm rename command, the
name of the domain that xentop shows did not change. This patch
reflects new domain name to the name of domains that xentop shows.
Keir Fraser [Mon, 26 May 2008 07:24:55 +0000 (08:24 +0100)]
VT-d: remove Xen and tboot range from dom0's VT-d table
This a step forward to fix the security hole introduced by dom0's 1:1
mapping VT-d table: remove the critical code and data from it. The
more flexible solution is to update dom0's VT-d table on demand as what
will be done for other PV domains. However, there could bring a
performance issue even with software optimization. Iotlb flush of some
hardware is time-consuming.
Keir Fraser [Sat, 24 May 2008 08:45:37 +0000 (09:45 +0100)]
Handle IOMMU device assignment for PV guests
Added more informative error codes for device assignment domctls.
Introduced python bindings for device assignment and enable xend to
also perform IOMMU device assignment when assigning PCI devices.
Keir Fraser [Sat, 24 May 2008 08:42:02 +0000 (09:42 +0100)]
Handle dynamic IOMMU map/unmap for guests
Perform IOMMU map/unmap when (a) frame type changes, (b) memory
reservation changes, and (c) a grant reference is newly mapped or
completely unmapped from a domain.
Keir Fraser [Sat, 24 May 2008 08:37:35 +0000 (09:37 +0100)]
Enable IOMMU for PV guests
Introduce 'iommu_pv' boot parameter (default off). Added a need_iommu
flag which is set if guest has PCI devices assigned. IOMMU page
tables are populated with current guest memory when IOMMU is first
enabled for the guest.
Keir Fraser [Sat, 24 May 2008 08:27:03 +0000 (09:27 +0100)]
hvm: Build guest timers on monotonic system time.
Move hvm platform timers from underlying physical CPU TSC to Xen
system time and ensure domain-wide monotonicity. TSC on many systems
may skew between processors leading to 'time going backwards' messages
from some guests.
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>