Keir Fraser [Tue, 23 Jun 2009 10:20:10 +0000 (11:20 +0100)]
xend: Fix tapdisk creation for managed domains
The first start of a managed domain succeeds. But the second
start of the managed domain fails as follows. The problem occurs
when tapdisks are given to the managed domain. I think that the
problem occurs because the uname of tapdisks is overwritten with
"phy:/dev/xen/tadisk-2/tapdev*".
Keir Fraser [Tue, 23 Jun 2009 10:14:24 +0000 (11:14 +0100)]
vtd: IO NUMA support
This patch adds VT-d RHSA processing for IO NUMA support. The basic
idea is to parse ACPI RHSA structure to obtain VT-d HW to proximity
domain mapping. This mapping is then used when allocating pages for
Vt-d HW data structures.
Keir Fraser [Fri, 19 Jun 2009 07:45:55 +0000 (08:45 +0100)]
VT-d: fix MSI source-id of interrupt remapping
This patch fixes an issue of MSI source-id. Currently MSI source-ids
are all set device bdf. It's incorrect for PCI (not PCIe) devices. The
patch set correct requester-ids of MSI to source-id. And also, wrap
functions to clean ioapic source-id.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Fri, 19 Jun 2009 07:45:20 +0000 (08:45 +0100)]
VT-d: pci code cleanup
This patch moves the pci code from iommu.c to pci.c. Instead of setup
pci hierarchy in array bus2bridge in iommu_context_mapping, use
scan_pci_devices once to add all existed PCI devices in system to
alldevs_list and setup pci hierarchy in array bus2bridge. In addition,
implement find_upstream_bridge to find the upstream PCIe-to-PCI/PCIX
bridge or PCI legacy bridge for a PCI device, therefore it's cleanly
to handle context map/unmap for PCI device, even for source-id
setting.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Fri, 19 Jun 2009 07:44:33 +0000 (08:44 +0100)]
xend: fix a regression in c/s 19791.
Using changeset 19791:c0d2838fc10f, I can't create an HVM.
xend.log shows:
File "usr/lib64/python2.4/site-packages/xen/xend/image.py", line
759, in configure
store_dmargs.remove('-sdl')
ValueError: list.remove(x): x not in list
Keir Fraser [Fri, 19 Jun 2009 07:42:58 +0000 (08:42 +0100)]
P2M: check whether hap mode is enabled before using 2mb pages
This small patch checks whether hap mode is enabled when guest is
trying to allocate 2MB pages inside P2M. This prevents potential
errors when hap is disabled.
Keir Fraser [Fri, 19 Jun 2009 07:41:50 +0000 (08:41 +0100)]
IOMMU: Add two generic functions to vendor neutral interface
Add 2 generic functions into the vendor neutral iommu interface, The
reason is that from changeset 19732, there is only one global flag
"iommu_enabled" that controls iommu enablement for both vtd and amd
systems, so we need different code paths for vtd and amd iommu systems
if this flag has been turned on. Also, the early checking of
"iommu_enabled" in iommu_setup() is removed to prevent iommu
functionalities from been disabled on amd systems.
Keir Fraser [Thu, 18 Jun 2009 14:32:48 +0000 (15:32 +0100)]
buildconfigs/src.git-clone: use git clone, avoid git remote
git 1.4.x (which is on even some moderately recent systems) doesn't
have the `git remote' command. This is what caused the most recent
patchman build failure.
The machinery in buildconfigs/src.git-clone was rather more
complicated than needed, too. In this patch I replace this with a
similar set of runes to those used for ioemu-remote (almost identical
except that the QEMU_TAG feature is not supported in this instance).
I have done a successful test build with this change.
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Thu, 18 Jun 2009 09:31:17 +0000 (10:31 +0100)]
x86-64: do not pass unmanageable amounts of memory to Dom0
Due to address space restrictions it is not possible to successfully
pass more than about 500Gb to a Linux Dom0 unless its kernel specifies
a non-default phys-to-machine map location via XEN_ELFNOTE_INIT_P2M.
For non-Linux Dom0 kernels I can't say whether the limit could be set
to close to 1Tb, but since passing such huge amounts of memory isn't
very useful anyway (and can be enforced via dom0_mem=3D), the patch
doesn't attempt to guess the kernel type and restricts the memory
amount in all cases.
Keir Fraser [Thu, 18 Jun 2009 09:30:28 +0000 (10:30 +0100)]
Introduce page_list_move()
This not only allows to remove ia64's special implementation of
page_list_splice_init(), but also fixes the latent issue with the
direct list head assignment in the x86 code if that would ever get
switched back to using normal list entries for linking together pages
(i.e. whenever x86-64 is to support more tha 16Tb of memory).
Keir Fraser [Thu, 18 Jun 2009 09:29:58 +0000 (10:29 +0100)]
blktap: re-enable blktap1 if blktap2 is disabled
This patch re-enables a useful blktap1 for users who disable blktap2.
Itremoves tapdisk and blktapctrl from blktap2, both of which cause
problems with blktap operation. In addition, this patch modifies xend
to check for blktap2 installation. If the blktap2 driver isn't
running (hopefully because the dom0 kernel option wasn't selected) we
fall back to blktap.
Keir Fraser [Thu, 18 Jun 2009 09:20:17 +0000 (10:20 +0100)]
stubdoms: qemu monitor support
Add support for the qemu monitor in a stubdom, the same way the
emulated serial support was added few days ago. The stubdom exports
the monitor as a pty and minios opens a console frontend; qemu in dom0
provides the correspondent backend for this additional pv console that
happens to be the qemu monitor.
Keir Fraser [Thu, 18 Jun 2009 09:18:10 +0000 (10:18 +0100)]
xend: pci: find_parent: should return string rather than int
Using changeset 19783: 61ec78692b13, device assignment can't work:
e.g., in find_the_uppermost_pci_bridge(),
parent = dev_parent.find_parent()
...
dev_parent = PciDevice(parent),
we can see parent['domain'] is int and in PciDevice's __init__,
int(dev['domain'], 16) would fail:
TypeError: int() can't convert non-string with explicit base
Keir Fraser [Thu, 18 Jun 2009 09:14:16 +0000 (10:14 +0100)]
x86_64: allow more vCPU-s per guest
Since the shared info layout is fixed, guests are required to use
VCPUOP_register_vcpu_info prior to booting any vCPU beyond the
traditional limit of 32.
MAX_VIRT_CPUS, being an implemetation detail of the hypervisor, is no
longer being exposed in the public headers.
The tools changes are clearly incomplete (and done only so things
would
build again), and the current state of the tools (using scalar
variables all over the place to represent vCPU bitmaps) very likely
doesn't permit booting DomU-s with more than the traditional number of
vCPU-s. Testing of the extended functionality was done with Dom0 (96
vCPU-s, as well as 128 vCPU-s out of which the kernel elected - by way
of a simple kernel side patch - to use only some, resulting in a
sparse
bitmap).
ia64 changes only to make things build, and build-tested only (and the
tools part only as far as the build would go without encountering
unrelated problems in the blktap code).
Keir Fraser [Wed, 17 Jun 2009 06:39:27 +0000 (07:39 +0100)]
xend: pass-through: Clean up hvm_destroyPCIDevice()
There seems to be little need to use the domain, bus, slot and
function to look up the virtual slot to pass as the argument to
hvm_destroyPCIDevice(), only to have hvm_destroyPCIDevice() use the
virtual slot for the sole purpose of looking up the domain, bus, slot
and function.
Keir Fraser [Wed, 17 Jun 2009 06:36:47 +0000 (07:36 +0100)]
xend: pass-through: Move pci conversion functions to pci.py
Move dev_dict_to_sxp() into XendSXPDev.py. Move
pci_convert_dict_to_sxp() and pci_convert_sxp_to_dict() to pci.py,
where other similar functions live. This makes these functions
accessible outside of the XendConfig class.
Keir Fraser [Wed, 17 Jun 2009 06:34:59 +0000 (07:34 +0100)]
xend: pass-through: Common parse_pci_name()
Share some parsing code between different parts of xm.
This has the side-effect that the device specification for
hot-plug may now include the VSLOT and OPTS as per device
specifictions in the domain configuration file.
Keir Fraser [Wed, 17 Jun 2009 06:21:03 +0000 (07:21 +0100)]
Introduce mechanism to check standard conformance of headers
While pretty simplistic, it appears to serve the purpose at the moment
(i.e. it spotted two places where a GNU extension was used withou
proper preprocessor conditionals). The "simplistic" here includes that
the checking gets only done for native builds, and ia64 gets excluded
due to its arch-specific header intentionally (for whatever reason)
checking that anonymous struct/unions can be used.
Keir Fraser [Wed, 17 Jun 2009 06:14:02 +0000 (07:14 +0100)]
tmem: fix 32-on-64 support
This implicitly required coverting the tmem_op structure from
anonymous to standard struct/union sub-fields, and extending the
get-fields.sh helper script to deal with typedef-ed guest handles used
as types of translated compound type fields.
Keir Fraser [Tue, 16 Jun 2009 12:57:18 +0000 (13:57 +0100)]
x86: improve output resulting from sending '0' over serial
While the original logic already implied that the kernel part of the
guest's address space is identical on all vCPU-s (i.e. for all guest
processes), it didn't fully leverage the potential here: As long as
the top page table currently active is owned by the subject domain
(currently only Dom0), the stack dump can be done without extra
effort.
For x86-64, additionally add page table traversal so that the stack
can be dumped in all cases (unless it's invalid or user space).
I left the 32-bit variant of do_page_walk() unimplemented for the
moment as I couldn't convince myself using map_domain_page() there is
a good idea, and didn't want to introduce new fixmap entries either.
Keir Fraser [Tue, 16 Jun 2009 12:52:13 +0000 (13:52 +0100)]
x86/hvm: don't pass through port 0x80 in a few special cases
In a recent commit (99f85a28a78e96d28907fe036e1671a218fee597), KVM
disabled the passthrough of this port due to known problems on certain
HP laptops (see
http://lkml.indiana.edu/hypermail/linux/kernel/0712.3/0872.html
and http://lkml.indiana.edu/hypermail/linux/kernel/0801.0/2388.html).
For Xen, don't do this globally, but rather based on a DMI black list.
Keir Fraser [Tue, 16 Jun 2009 12:41:17 +0000 (13:41 +0100)]
vtd: ats and queued invalidation cleanup
Use iommu_qinval in place of qinval_enabled flag. Use
ecap_queued_inval() for determining whether queued invalidation is
available on this vt-d engine or not.
Keir Fraser [Tue, 16 Jun 2009 10:47:09 +0000 (11:47 +0100)]
tmem: cleanups
- don't mis-use guest handle for passing an MFN value
- eliminate unnecessary (and misplaced) use of XEN_GUEST_HANDLE_64
- use copy_from_guest() instead of __copy_from_guest() for loading the
argument structure
Keir Fraser [Tue, 16 Jun 2009 10:31:20 +0000 (11:31 +0100)]
vtd: Clean up lock for VT-d register writes
It should get lock to write VT-d registers. Currently there are some
register writes without lock. This patch complements register_lock for
those writes.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Tue, 16 Jun 2009 10:30:45 +0000 (11:30 +0100)]
vtd: Fix flush for SRTP and SIRTP set
SRTP (Set Root Table Pointer) operation must be set before enable or
re-enable DMA remapping. And after set it, software must globally
invalidate the context-cache and then globally invalidate the
IOTLB. This is required to ensure hardware uses only the remapping
structures referenced by the new root-table pointer, and not stale
cached entries. Similarly, SIRTP (Set Interrupt Remap Table Pointer)
operation must be set before enable or re-enable Interrupt
remapping, and after set it, software must globally invalidate the
interrupt entry cache. This patch adds global context and iotlb
flush after set root entry, and globally flushs interrupt entry
cache before enabling Interrupt remapping. And remove the
iommu_flush_all in iommu_resume becuase it becomes redundant after
adds flush for SRTP in init_vtd_hw.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Tue, 16 Jun 2009 10:18:32 +0000 (11:18 +0100)]
tmem: fix minor accounting error
Reset a counter when all tmem pages are released. This
only affects status reporting (as displayed by xm tmem-list
or the just patched xenballoon-monitor) but the incorrectly
reported result is misleading.
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Keir Fraser [Tue, 16 Jun 2009 10:17:28 +0000 (11:17 +0100)]
tools/xenballoond: add tmem capability to directed/self-ballooning
and monitor tool
This patch adds tmem support to the largely unknown/unused
xenballoond scripts that implement both self-ballooning and
a foundation for directed-ballooning. Tmem and automated
ballooning are highly complementary in that, when ballooning
is over-aggressive, paging and swapping can increase noticably.
Precache preserves evicted pages that may be needed again soon
(thus eliminating disk reads) and preswap provides memory-based
swapping that occurs if ballooning is insufficiently responsive
to a sudden increase in activity and memory demand (thus
eliminating disk writes and reads).
There are two changes in this patch:
1) The xenballoond service is a convenient place to implement
userland "preswap shrinking".**
2) The xenballoon-monitor script is a convenient place to
report (and view with "watch -d") the frequent memory
rebalancing that results from tmem usage on a busy system.
Note that for best results (and for the monitor script to
work), the xenstore-* tools should be installed on each guest.
(** In a disk-based swap device, stale pages are often left
on-disk even after they are no longer needed or valid; they
are simply overwritten if/when the disk blocks are needed
again, which may be a very long time. Preswap behaves
much like a disk, but uses precious pages of memory that
count against a guest's memory allocation; thus stale
pages are very undesirable. Preswap shrinking periodically
attempts to remove stale pages from preswap by using a
sysfs interface created by the linux-side tmem patch.)
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Keir Fraser [Tue, 16 Jun 2009 10:00:29 +0000 (11:00 +0100)]
xend: allow config file compatibility with new tap syntax
Recently the format of the tap syntax in the config file changed to
using a 4 part specifier (tap:tapdisk:<format>:<filename>) instead
of the old 3-part one (tap:<qcow>:<filename>).
This breaks compatibility with existing config files: a guest start
will throw a Python exception and will be aborted.
AFAICS currently tap:tapdisk is redundant, so the attached patch
simply catches the above mentioned exception and tries to parse the
old format in this case.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Keir Fraser [Tue, 16 Jun 2009 09:58:56 +0000 (10:58 +0100)]
x86 mca: Support MCA recovery actions for latest Intel platforms
When an UC = 1 PCC = 0 MCE happens, there're more types of software
recoverable error defined on on latest Intel Platform. For identifying
those new errors, some new bit (S/AR bit) is defined in MCi_STATUS
register. Also we need MCACOD help's to judge the detailed
error. Combined with the OVER bit, different recovery policies are
required for containing those new errors.
SRAO error is an software recoverable MCA error, no recovery action
required. while SRAR is an software recoverable MCA error, recovery
action is required.
Signed-off-by: Liping Ke <liping.ke@intel.com> Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Keir Fraser [Fri, 5 Jun 2009 08:31:23 +0000 (09:31 +0100)]
blktap2: README updates
As promised, this brings the long out-of-sync documentation up to
date, and adds some getting started information about tapdisk driver
development - I get the occasional email on this latter subject.
Keir Fraser [Fri, 5 Jun 2009 08:29:42 +0000 (09:29 +0100)]
VT-d: correct way to submit command to GCMD register
Per VT-d spec, software should submit only one "incremental" command
at a time to Global Command reigster. Current implementation uses a
variable (gcmd) to record the state of Global Status register. It's
error prone.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Fri, 5 Jun 2009 08:27:18 +0000 (09:27 +0100)]
VT-d: define a macro for waiting hardare completion
When set some registers of VT-d, it must wait for hardware
completion. There are lots of duplicated code to do that. This patch
defines a macro for it, thus it is much cleaner.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Fri, 5 Jun 2009 08:26:39 +0000 (09:26 +0100)]
VT-d: remove useless variables
This patch removes global variable "vtd_enabled", which is
redundant. "iommu_enabled" is enough. And also removes useless global
variables qi_ctrl and ir_ctrl, which are not used at all.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Thu, 4 Jun 2009 21:25:10 +0000 (22:25 +0100)]
x86: hap dirty vram tracking
Currently HAP systems suffer a significant performance loss when a vnc
client is connect or the sdl interface is used, because HAP is lacking
an implementation of track_dirty_vram.
As a consequence qemu always tries to update the whole screen because
it does not know which areas of the screen have been updated by the
guest.
This patch implements track_dirty_vram for HAP enabling the logdirty
mechanism only in a specific gfn range and adding a
paging_log_dirty_range function that returns the log dirty bitmap in a
requested range.
Paging_log_dirty_range is different from paging_log_dirty_op because
operates on a range and also because it does not pause the domain. In
order not to lose any update I moved clean_dirty_bitmap at the
beginning of the function before evaluating the logdirty bitmap.
The bitmap is still safe because it is protected by the logdirty lock.
Keir Fraser [Thu, 4 Jun 2009 09:47:56 +0000 (10:47 +0100)]
xend: pci: only extract the exact pci BDFs
On some hosts:
[root@localhost ~]# ls /sys/bus/pci/devices/0000:00:05.0/
0000:00:05.0:pcie00 0000:05:00.0 class driver local_cpus
resource subsystem_vendor
0000:00:05.0:pcie01 broken_parity_status config enable modalias
subsystem uevent
0000:00:05.0:pcie02 bus device irq power
subsystem_device vendor
Here we should only get 0000:05:00.0, but we also get 0000:00:05.0
unexpectedly. With this patch, xend only extracts the exact BDF(s).
Keir Fraser [Thu, 4 Jun 2009 09:46:13 +0000 (10:46 +0100)]
xm: Don't die when trying to conect the console to short-lived domains
As observed by Mick Joran, if short-lived domain exits cleanly
then os.waitpid() will throw the following exception. This appears
to be because the child process that is used to start the domain
has detached from its parent.
OSError: [Errno 10] No child processes
Cc: Mick Jordan <Mick.Jordan@sun.com> Signed-off-by: Simon Horman <horms@verge.ent.au>
Keir Fraser [Thu, 4 Jun 2009 09:45:24 +0000 (10:45 +0100)]
blktap2: fix parallel Make.
sub make in tools/blktap2/daemon/lib and tools/lvd/lib
can be triggered many times at the same time which results in
weired link error because one target is linking a library while
another target is trying to recreate the library.
Keir Fraser [Thu, 4 Jun 2009 09:41:50 +0000 (10:41 +0100)]
xm: xen-api, pass-through: create: Use vslot for hotplug_slot
Using func for hotplug_slot is not correct, although func is often
zero, previously zero meant please pick a vslot and asking xend to
pick a vslot was the only method available.
This resolves the following error when using Xen API:
$ xm create hvm.conf
...
Internal error: Timed out waiting for device model action.
As the domain, bus, slot and func values are returned as string
representations of decimal, it makes sense for get_hotplug_slot() to
also return string representations of decimal.
As it is, the int() conversion will break cause xm to fail with
an error if the vslot is in the range 0xa-0xf or 0x1a-0x1f.
$ xm pci-list debian
Error: Invalid argument.
And the int() conversion will return the wrong value if
the vslot is in the range 0x10-0x19.
This patch also alters XendDPCI to store hotplug_vslot as an integer
rather than a string. This is consitent with the way other
values are stored inside XendDPCI.
get_hotplug_slot() returning a string is not consistent
with other calls inside XendDPCI, which return integers.
Keir Fraser [Thu, 4 Jun 2009 09:39:32 +0000 (10:39 +0100)]
xend: pass-through: prefix vslot with 0x in device configration
I don't know of the historical reasons for this, but by convention
hex values are stored without a leading '0x' in the backend and
with a leading '0x' in the device configuration.
This patch also removes handling of the case where vslot is missing
from the backend, should never occur.
Keir Fraser [Thu, 4 Jun 2009 09:36:36 +0000 (10:36 +0100)]
libxc: fix link error on ia64
On ia64, xen-unstable 19698:f72d26c00002 cannot be built:
../../tools/libxc/libxenguest.so: undefined reference to
`xc_core_arch_map_p2m_writable'
../../tools/libxc/libxenguest.so: undefined reference to `xc_map_m2p'
Because xc_offline_page.c requires xc_map_m2p() in xc_domain_save.c,
xc_offline_page.c must be compiled only if CONFIG_MIGRATE=3Dy.