Keir Fraser [Thu, 12 Mar 2009 11:07:00 +0000 (11:07 +0000)]
Fix qemu spawn for Solaris
On Solaris, xend runs in a 'process contract' such that all children
are killed when the service is restarted. Spawn qemu processes in a
new contract to avoid this.
The Solaris curses library has a broken timeout() function: after a
first timeout() call with a positive value for an argument, subsequent
calls will fail to reset it. So, getch() always times out, confusing
the pygrub timer in the main loop. Add an extra check to avoid exiting
prematurely.
Signed-off-by: Frank van der Linden <frank.vanderlinden@sun.com>
Keir Fraser [Thu, 12 Mar 2009 10:56:55 +0000 (10:56 +0000)]
xenconsole: Solaris ptys have different semantics.
Make sure that tty semantics are active for Solaris ptys, or if they
aren't (and not needed) to not do tcget/setattr on the filedescriptor
in Python code.
Also work around a bug in the Solaris ptm streams driver, which will
cause a write error on the master side of a pty (because of e.g. a
missing slave) to persist forever.
Signed-off-by: Frank van der Linden <frank.vanderlinden@sun.com>
Keir Fraser [Wed, 11 Mar 2009 10:14:33 +0000 (10:14 +0000)]
xend: Discard error messages of lsscsi
In the case of a host OS without lsscsi command, the following
error message is recorded into xend-debug.log when xend is started.
The error message is recorded once certainly. If SCSI devices are
connected to the host OS, it is recorded to the number of SCSI
devices.
sh: lsscsi: command not found
This patch discards the error message to /dev/null.
Keir Fraser [Wed, 11 Mar 2009 10:10:15 +0000 (10:10 +0000)]
xend: Test tap devices in testDeviceComplete()
XendDomainInfo.testDeviceComplete() should check block devices have
shutdown correctly but it only considers vbd class devices and ignores
tap devices. The attached patch changes testDeviceComplete() to wait
for both vbd and tap devices to be shutdown correctly.
Keir Fraser [Wed, 11 Mar 2009 10:05:00 +0000 (10:05 +0000)]
passthrough: allow pass-through devices to share virtual GSI
Allow multiple pass-through devices to use the same guest_gsi.
The motivation for this is:
* Allow multi-function devices to be passed through as multi-function
devices
* Allow more than two pass-through devices.
- This will place more contention on the GSI-space, and allocation
becomes a lot simpler if GSI sharing is allowed.
Keir Fraser [Mon, 9 Mar 2009 15:01:34 +0000 (15:01 +0000)]
xentrace: trace when we continue with the same task
Trace when the scheduler decides to continue running the same process.
This lets us see that this is happening for one; it also lets us see
domains in a trace which are actively running on pcpu but never
scheduled out.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Keir Fraser [Mon, 9 Mar 2009 13:50:45 +0000 (13:50 +0000)]
hvm/vpt: Check that an irq is not blocked before waking the vcpu
Currently, when a timer fires for a vpt interrupt, the interrupt
handler calls vcpu_kick() without checking to see if the IRQ is
blocked. This causes the vcpu to wake up out of a halt when it
shouldn't.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Keir Fraser [Mon, 9 Mar 2009 09:37:52 +0000 (09:37 +0000)]
Add vcpu_migration_delay=<microsecs> boot option to scheduler
The idea is borrowed from Linux kernel: if the vCPU is just
scheduled out and put to run-queue, it's likely cache-hot on its
current pCPU, and it may be scheduled in in a short period of time;
however, if vCPU is migrated to another pCPU, it need to re-warm the
cache.
The patch introduces an option vcpu_migration_delay to avoid
aggressive vCPU migration (actually we really see migration frequency
is very high most of the time.), while in the meantime keeping load
balancing over slightly longer time scales.
Linux kernel uses 0.5ms by default. Considering the cost may be
higher (e.g. VMCS impact) than in native, vcpu_migration_delay=1000 is
chosen for our tests, which are performed on a 4x 6-core Dunnington
platform. In 24-VM case, there is ~2% stable performance gain for
enterprise workloads like SPECjbb and sysbench. If HVM is with
stubdom, the gain is more: 4% for the same workloads.
Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Mon, 9 Mar 2009 09:19:10 +0000 (09:19 +0000)]
pygrub: Enable domU boot without xen specific arg
This patch makes domUs bring up without xen specific args to guest
kernels. A domU should be bootable without args parameter because
tools/examples/xmexample1 doesn't have one.
Keir Fraser [Mon, 9 Mar 2009 09:18:08 +0000 (09:18 +0000)]
[IA64] fix issue of can not find the qemu-dm in ia64
IA64 uses the /usr/lib/ for xen. We do not=20
need to check the arch_libdir in ia64. It will
return the wrong value to arch_libdir. And guest
can not boot.
Keir Fraser [Fri, 6 Mar 2009 19:18:39 +0000 (19:18 +0000)]
Page offline support in Xen side
This patch add support to offline a page. The basical idea is, when a
page is assigned, it will be marked offline pending and be moved out of
buddy when freed, when a page is free, it will be moved out of buddy directly.
One notice after this change is, now the page->count_info is not
always 0, especially for shadow page, since the PGC_offlining bit may be set.
Keir Fraser [Fri, 6 Mar 2009 19:14:50 +0000 (19:14 +0000)]
x86/mm: Do not set page's count_info directly
Page offline patch add several flag to page_info->count_info. However,
currently some code will try to set count_info after alloc_domheap_pages
without using "&" or "|" operation, this may cause the new flags lost, since
there are no protection. This patch try to make sure all write to
count_info will only impact specific field.
Also currently shadow code assume count_info is 0 for shadow page,
however, this is invalid after the new flags. Change some assert in
shadow code.
Keir Fraser [Fri, 6 Mar 2009 19:10:29 +0000 (19:10 +0000)]
tboot: Fix return code for S3 integrity
The original patch left in a debug return value from one of the memory
integrity checks. This patch returns the correct error code in case of a
failure. This was re-tested to ensure that it still passes for the
expected case.
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
Keir Fraser [Fri, 6 Mar 2009 19:06:30 +0000 (19:06 +0000)]
vt-d: Better restrict memory ranges considered to be in Xen
The current implementation of xen_in_range() misses several memory
ranges that are used by the hypervisor and thus shouldn't get mapped
into dom0's VT-d tables. This patch should make the check complete.
This patch is only against x86 because I'm not familiar enough with
IA64 to know how much, if any, of these checks apply there.
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
Keir Fraser [Fri, 6 Mar 2009 18:58:41 +0000 (18:58 +0000)]
tool: make management of PCI D-states by guest optional
D3hot state in some PCI devices causes the failure of domain
creation/destruction.
The default is "pci_power_mgmt=3D0" which disables the guest OS from
managing D-states because it would be better to avoid the trouble than
advantage of low power consumption.
Keir Fraser [Fri, 6 Mar 2009 18:56:28 +0000 (18:56 +0000)]
xm-test: Identifying the network env specified in xend config fails,
if an additional parameter is given for the network-bridge
(e.g. netdev=eth1) The patch splits the network command into the
command name and its parameters to determine the netenv (bridge,
route, nat)
Keir Fraser [Wed, 4 Mar 2009 14:28:50 +0000 (14:28 +0000)]
Be careful with page_get_owner() now that owner field can be clobbered
by some users. Introduce get_page_owner_and_reference() where that can
be more useful.
Keir Fraser [Tue, 3 Mar 2009 12:48:16 +0000 (12:48 +0000)]
txt: perform per-domain (and frametable and xenheap) MAC on entry into
S3 and verification on resume.
The MAC algorithm is called VMAC and was developed by Ted Krovetz and
Wei Dai (more details are in the files). It is based on a universal hash
function. The universal hash is passed through a pseudo-random function,
implemented using AES. More details can be found at
http://fastcrypto.org/vmac/. =
The AES code comes from the OpenBSD implementation (which is derived
from the implementation referenced in VMAC site).
As Xen does not have a good source of entropy to generate its own key
(for the keyed hash), it uses the key that tboot passes in.
Although the code attempts to MAC all of a domain's pages (code/data,
VT-d tables) based on its s3_integrity flag, some of a domain's memory may
always be MAC'ed, e.g. shadow page tables. Only xenheap pages that are in
use are MAC'ed. We believe that the memory MAC'ed by the Xen code and the
ranges passed to tboot to MAC cover all of the memory whose integrity needs
to be protected on S3. Any suggestions or ranges that we missed are
welcome.
Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
Keir Fraser [Tue, 3 Mar 2009 11:41:15 +0000 (11:41 +0000)]
libxen: fix a problem preventing use of xen_event_register().
The conversion of input parameter xen_string_set to XML format creates
a XML "struct" tag instead of "array". The patch sets the XML tag for
SET now to "array".
Keir Fraser [Mon, 2 Mar 2009 11:11:19 +0000 (11:11 +0000)]
x86: Make offlined CPU enter deepest C state
Before cpuidle is introduced, offlined CPU only enter C1 (by HLT
instruction). This is not optimal since C2/C3 can bring more power
saving. Since now cpuidle is introduced, it is time for offlined CPU
to enter more deeper C state.
This patch add the logic to make offlined CPU enter deepest C state,
if cpuidle is enabled.
Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Wei Gang <gang.wei@intel.com> Signed-off-by: Tian Kevin <kevin.tian@intel.com>
Keir Fraser [Mon, 2 Mar 2009 10:34:37 +0000 (10:34 +0000)]
xend: Fix removing /vm/UUID/device paths when device cannot be disconnected
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 [Mon, 2 Mar 2009 10:32:32 +0000 (10:32 +0000)]
x86: Small fix for gpf when writing 1s to MCi_STATUS MSRs.
According to spec, only 0s is allowed to be written. This error is
found when do cpu-offline, cmci happens.
For avoiding missing future cmci after changing cmci owner, we need to
process pending cmci errors to clear MCi_STATUS MSRs.
Signed-off-by: Ke Liping <liping.ke@intel.com> Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com>
Keir Fraser [Mon, 2 Mar 2009 10:31:16 +0000 (10:31 +0000)]
acm: Return a valid buffer
This patch reverts a previous patch trying to fix a memory, even
though I don't think there was any. Now return a valid buffer. All
functions calling this function do free the buffer.
Keir Fraser [Mon, 2 Mar 2009 10:26:37 +0000 (10:26 +0000)]
hvm: passthrough MSI-X mask bit acceleration
Add a new parameter to DOMCTL_bind_pt_irq to allow Xen to know the
guest physical address of MSI-X table. Also add a new MMIO intercept
handler to intercept that gpa in order to handle MSI-X vector mask
bit operation in the hypervisor. This reduces the load of device model
considerably if the guest does mask and unmask frequently
Keir Fraser [Mon, 2 Mar 2009 10:23:50 +0000 (10:23 +0000)]
xend: Fix some mistakes in tools/python/xend/util/pci.py
1) PCI_PM_CTRL_NO_SOFT_RESET: this is bit3 of PMCSR(Power Management
Control/Status). It should be 8. This bit means a device's capability
of not doing an internal reset across D3hot/D0.
If the bit is 1, there shall be no reset across D3hot/D0, so we should
not use it as a method to reset device.
2) When performing reset using standard FLR methods, we should sleep
at least 100ms; in current code, it's incorrect somewhere we sleep
0.2s and somewhere 0.01s.
3) In detect_dev_info(), fix a typo: PCI_EXP_TYPE_PCI_BRIDG ->
PCI_EXP_FLAGS_TYPE.
4) fix a small typo in the comment of transform_list().
Keir Fraser [Sun, 1 Mar 2009 14:58:07 +0000 (14:58 +0000)]
x86, hvm: gcc44 build fix.
Broken constrain in inline asm. Bytewise access works with a, b, c, d
registers only, thus "r" is wrong, it must be "q". gcc 4.4 tries to
use the si register, which doesn't work and thus fails the build.
Keir Fraser [Sun, 1 Mar 2009 14:50:04 +0000 (14:50 +0000)]
xenstored: fix use-after free bug
Problem: Handling requests for one connection can not only zap the
connection itself, due to socket disconnects for example. It can also
zap *other* connections, due to domain release requests. Especially
it can zap the connection we have saved a pointer to in the "next"
variable.
Keir Fraser [Fri, 20 Feb 2009 17:02:36 +0000 (17:02 +0000)]
xenconsole: Fix pty handling
I printed the terminal attributes after openpty() and they were
garbage on the first console, valid on the second etc.
openpty() gets garbage in (uninitialized attributes MODIFIED by
cfmakeraw()). It sets the slave to the attributes requested. Using
uninitialized data for cfmakeraw->openpty results in pty attributes
that may even have the receiver disabled. Closing the slave just hides
the bug as these attributes disappear and hope the slave will be
reopened and initialized.
From: Juergen Hannken-Illjes <hannken@netbsd.org> Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Keir Fraser [Fri, 20 Feb 2009 11:11:40 +0000 (11:11 +0000)]
[VTD] Utilise the snoop control capability in shadow with VT-d code
We compute the shadow PAT index in leaf page entries now as:
1) No VT-d assigned: let shadow PAT index as WB, handled already
in shadow code before.
2) direct assigned MMIO area: let shadow code compute the shadow
PAT with gMTRR=UC and gPAT value.
3) Snoop control enable: let shadow PAT index as WB.
4) Snoop control disable: let shadow code compute the shadow
PAT with gMTRR and gPAT, handled already in shadow code before
Keir Fraser [Thu, 19 Feb 2009 10:59:43 +0000 (10:59 +0000)]
vt-d: workaround for Mobile Series 4 Chipset
Incorporated VT-d workaround for a sighting on Intel Mobile Series 4
chipset found in Linux iommu. The sighting is the chipset is not
reporting write buffer flush capability correctly.