Commit Graph
20879 Commits
Author SHA1 Message Date
Keir Fraser eddd8e3955 xentrace: Trace p2m events
Add more tracing to aid in debugging ballooning / PoD:
* Nested page faults for EPT/NPT systems
* set_p2m_enry
* Decrease reservation (for ballooning)
* PoD populate, zero reclaim, superpage splinter

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2010-02-03 09:35:23 +00:00
Keir Fraser 2ca873ab32 Update QEMU_TAG to 575ed1016f6fba1c6a6cd32a828cb468bdee96bb 2010-02-03 09:33:12 +00:00
Keir Fraser e5dc62c4d4 hvmloader: Fix CPU hotplug notify handler in ACPI DSDT.
By merging PRSC and NTFY methods we simplify the code, improve
efficiency, and fix a bug where PRSC iterated 0-255 but NTDY could
only handle CPU numbers 0-127.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-02-03 09:16:11 +00:00
Keir Fraser c11179ee21 pygrub: support parsing of syslinux configuration files
Allows booting from ISOs which use isolinux as well as guests using
extlinux.

Also add copyright header to GrubConf.py, I think the grub2 support
added last year qualifies as a substantial change.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-02-01 14:03:47 +00:00
Keir Fraser 62e1b8798b hvm, s3: HVM guest RTCs become unsync'ed across host S3.
Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
2010-02-01 14:03:06 +00:00
Keir Fraser 8c3afa67ee tools/gtraceview: fix SIGFPE
If there are 0 or 1 valid record in xentrace file,
SIGFPE will occur. Fix it.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2010-01-29 08:59:46 +00:00
Keir Fraser b7d8981f39 blktap2: Prefer AIO eventfd support on kernels >= 2.6.22
Mainline kernel support for eventfd(2) in linux aio was added between
2.6.21 and 2.6.22. Libaio after 0.3.107 has the header file, but
presently few systems support it. Neither do we rely on an up-to-date
libc6.

Instead, this patch adds a header which defines custom iocb_common
struct, and works around a potentially missing sys/eventfd.h.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
2010-01-29 08:55:27 +00:00
Keir Fraser fedebce364 blktap2: Separate tapdisk raw I/O into different backends.
Hide tapdisk support for different raw I/O interfaces behind a new
struct tio. Libaio remains to dominate the interface, requiring
everyone to dispatch iocb/ioevent structs.

Backends:
 - lio:  Kernel AIO via libaio.
 - rwio: Canonical read/write() mode.

Misc:
 - Fixes a bug in tapdisk-vbd which locks up the sync io mode.
 - Wants a PERROR macro in blktaplib.h
 - Removes dead code in qcow2raw to make it link again.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
Signed-off-by: Jake Wires <jake.wires@citrix.com>
2010-01-29 08:54:51 +00:00
Keir Fraser 1ac52b69d4 blktap2: Sort out tapdisk AIO init.
Move event callbacks registration into tapdisk-queue. This should also
obsoletes the dummy pollfd pipe in the synchronous I/O case.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
2010-01-29 08:54:22 +00:00
Keir Fraser 613ef0ad1d blktap2: Sort out tapdisk IPC init.
Move I/O and event callbacks setup out of tapdisk-server, into
tapdisk-ipc.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
2010-01-29 08:53:52 +00:00
Keir Fraser 3d624ae31b libelf: make elf_phdr_is_loadable load read-only segments.
From: Brad Plant <bplant@iinet.net.au>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-01-29 07:14:32 +00:00
Keir Fraser 6b8e764c0f pv-on-hvm: Correct the order of the argument of out*()
The order of the argument of outl() is wrong.
The correct order is outl(value, port). This causes kernel panic.

And outw() is also similar.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2010-01-29 07:10:28 +00:00
Keir Fraser b5ae6dbc89 x86 mca: Be more careful for printk in MCE context
MCE may happen in printk context, and will cause deadlock if we try to
call printk again in MCE context.

A new level(mce_critical) is added to mce_verbosity for printk in mce
context. This level is only for developer that aware of such issue.
In mce_panic, force console unlock.

Singed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2010-01-29 06:50:23 +00:00
Keir Fraser b1af10565c x86 mca: Add MCE broadcast checkiing.
Some platform will broadcast MCE to all logical processor, while some
platform will not. Distinguish these platforms will be helpful for
unified MCA handler.

the "mce_fb" is a option to emulate the broadcast MCA in non-broadcast
platform. This is mainly for MCA software trigger.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2010-01-29 06:49:42 +00:00
Keir Fraser 8e06ad325f x86 mca: Fix the vMCE address translation for HVM guest.
Fix address translation when we inject a virtual MCE to HVM guest.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2010-01-29 06:49:13 +00:00
Keir Fraser fc26b6b807 x86 mca: Add the mised put_domain in UCR handler function.
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2010-01-29 06:48:37 +00:00
Keir Fraser d99fd7abcf x86 mca: Not GP fault when guest write non 0s or 1s to MCA CTL MSRs.
a) For Mci_CTL MSR, Guest can write any value to it. When read back,
it will be ANDed with the physical value. Some bit in physical value
can be 0, either because read-only in hardware (like masked by AMD's
Mci_CTL_MASK), or because Xen didn't enable it.
    If guest write some bit as 0, while that bit is 1 in host, we will
    not inject MCE corresponding that bank to guest, as we can't
    distinguish if the MCE is caused by the guest-cleared bit.

b) For MCG_CTL MSR, guest can write any value to it. When read back,
it will be ANDed with the physical value.
    If guest does not write all 1s. In mca_ctl_conflict(), we simply
    not inject any vMCE to guest if some bit is set in physical MSR
    while is cleared in guest 's vMCG_CTL MSR.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2010-01-29 06:48:00 +00:00
Keir Fraser 66cb09646d x86 mca: Handle the vMCA bank correctly
Currently the virtual MCE MSR assume all MSRs range from 0 to
MAX_NR_BANKS are always MCE MSR, this is not always correct. With this
patch, the mce_rdmsr/mce_wrmsr will only handle vMCE MSR range from 0
to the MCA banks in the host platform.
Please notice that some MSR beyond current MCA banks in the host
platform are really MCA MSRs, that should be handled by general MSR
handler.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2010-01-29 06:47:24 +00:00
Keir Fraser 729c84c4bf x86: Clean up c/s 20844:ca0759a08057
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-01-29 06:45:45 +00:00
Keir Fraser 4dc7c3daba xend: destroy restored domain when its device doesn't exist
A migrated domain keeps on running even though its disk doesn't
exist. This situation must be undesirable.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2010-01-27 08:59:47 +00:00
Keir Fraser fd607bf000 pygrub: improve grub 2 support
* The "default" value can be a quoted string (containing an integer)
  so strip the quotes before interpreting.
* The "set" command takes a variable with an arbitrary name so instead
  of whitelisting the ones to ignore simply silently accept any set
  command with an unknown variable.
* Ignore the echo command.
* Handle the function { ... } syntax. Previously pygrub would error
  out with a syntax error on the closing "}" because it thought it was
  the closing bracket of a menuentry.

This makes pygrub2 work with the configuration files generated by
Debian Squeeze today.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-01-26 15:54:40 +00:00
Keir Fraser 83f510f16b x86: Polarity-switch method only effective in non-directed EOI case.
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2010-01-26 15:54:09 +00:00
Keir Fraser e0bebeef94 x86: reduce EOI stack's size in per-cpu area.
Only dynamic vectors uses EOI stack, so the size
can be safely reducd to NR_DYNAMIC_VECTORS.

Signed-off-by : Xiantao Zhang <xiantao.zhang@intel.com>
2010-01-26 15:53:52 +00:00
Keir Fraser 8594809ef2 x86: Directly clear all pending EOIs once MSI info changed
As to unmaskable MSI, its deferred EOI policy only targets
for avoiding IRQ storm. It should be safe to clear pending
EOIs in advance when guest irq migration occurs, because next
interrupt's EOI write is still deferred, and also can avoid
storm.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2010-01-26 15:53:01 +00:00
Keir Fraser 47e24ad78c x86: Revert Cset 20334:dcc5d5d954e9
Recording old MSI info doesn't solve all the corner cases
when guest's irq migration occurs.

Signed-off-by : Xiantao Zhang <xiantao.zhang@intel.com>
2010-01-26 15:52:30 +00:00
Keir Fraser bfd2af9ebd Update Xen version to 4.0.0-rc3-pre 2010-01-26 15:51:53 +00:00
Keir Fraser 89743a0581 Added tag 4.0.0-rc2 for changeset e5e4573bcaba 2010-01-26 14:15:05 +00:00
Keir Fraser 5f5fb2fe3b Update Xen version to 4.0.0-rc2 4.0.0-rc2 2010-01-26 14:15:01 +00:00
Keir Fraser f30a5d2ece VT-d: add "iommu=workaround_bios_bug" option
Add this option to workaround BIOS bugs. Currently it ignores DRHD
if "all" devices under its scope are not pci discoverable. This
workarounds a BIOS bug in some platforms to make VT-d work. But note
that this option doesn't guarantee security, because it might ignore
DRHD.

So there are 3 options which handle BIOS bugs differently:
  iommu=1 (default): If detect non-existent device under a DRHD's
scope, or find incorrect RMRR setting (base_address > end_address),
disable VT-d completely in Xen with warning messages. This guarantees
security when VT-d enabled, or just disable VT-d to let Xen work
without VT-d.
  iommu=force: it enforces to enable VT-d in Xen. If VT-d cannot be
enabled, it will crashes Xen. This is mainly for users who must need
VT-d.
  iommu=workaround_bogus_bios: it workarounds some BIOS bugs to make
VT-d still work.  This might be insecure because there might be a
device not protected by any DRHD if the device is re-enabled by
malicious s/w.  This is for users who want to use VT-d regardless of
security.

Signed-off-by: Weidong Han <weidong.han@intel.com>
2010-01-26 07:51:20 +00:00
Keir Fraser 224c24a3df tools/xsm: Expose Flask XSM AVC functions to user-space
This patch exposes the flask_access, flask_avc_cachestats,
flask_avc_hashstats, flask_getavc_threshold, flask_setavc_threshold,
and flask_policyvers functions to user-space. A python wrapper was
created for the flask_access function to facilitate policy based
user-space access control decisions. flask.h was renamed to libflask.h
to remove a naming conflict.

Signed-off-by : Machon Gregory <mbgrego@tycho.ncsc.mil>
2010-01-26 07:50:04 +00:00
Keir Fraser bebd60a04f libxl: Fix libconfig install directory
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Ian Campbell <ian.campbell@citrix.com>
2010-01-23 08:28:01 +00:00
Keir Fraser 97e5bc9649 pv-on-hvm: Only unplug emulated devices if requested via module parameter.
dev_unplug=[all,][ide-disks,][aux-ide-disks,][nics]

ide-disks: Unplug all emulated IDE disks (but not CD-ROMs)
aux-ide-disks: As above, but doesn't touch primary IDE master
nics: Unplug all emulated NICs
all: ide-disks and nics

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-01-23 08:26:23 +00:00
Keir Fraser a8059ffced VT-d: improve RMRR validity checking
In order to make Xen more defensive to VT-d related BIOS issue, this
patch ignores a DRHD if all devices under its scope are not pci
discoverable, and regards a DRHD as invalid and then disable whole
VT-d if some devices under its scope are not pci discoverable. But if
iommu=force is set, it will enable all DRHDs reported by BIOS, to
avoid any security vulnerability with malicious s/s re-enabling
"supposed disabled" devices.  Pls note that we don't know the devices
under the "Include_all" DRHD are existent or not, because the scope of
"Include_all" DRHD won't enumerate common pci device, it only
enumerates I/OxAPIC and HPET devices.

Signed-off-by: Noboru Iwamatsu <n_iwamatsu@jp.fujitsu.com>
Signed-off-by: Weidong Han <weidong.han@intel.com>
2010-01-23 08:23:24 +00:00
Keir Fraser 8bf984160f Get libconfig tarball from xenbits
Download libconfig.tar.gz from xenbits.org extfiles rather than from
upstream.  This insulates us from upstream networking failures and any
upstream changes to the files hosted etc.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-01-22 13:32:26 +00:00
Keir Fraser e591bdb018 x86: check if desc->action is NULL when unbinding guest pirq
Before igb PF driver is unloaded, dom0 doesn't unload igbvf driver
automatically. When igb drver is unloaded, it invokes the
PHYSDEVOP_manage_pci_remove hypercall to remove the VFs and xen frees
the msi irqs by pci_cleanup_msi() -> ... -> dynamic_irq_cleanup() and
sets the desc->action to NULL.  igbvf driver knows the VF is
disappearing via a hook ndo_stop() in dev_close() and tries to unbind
the pirq and xen would crash as the desc->action is NULL now.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2010-01-22 11:01:18 +00:00
Keir Fraser 939629eb5b blktap: fix blktapctrl abort
On rebooting a hvm, the blktapctrl daemon has died.

gdb shows the following call trace:
(gdb) where
#0  0x00000039d1830155 in raise () from /lib64/libc.so.6
#1  0x00000039d1831bf0 in abort () from /lib64/libc.so.6
#2  0x00000039d186a38b in __libc_message () from /lib64/libc.so.6
#3  0x00000039d1871634 in _int_free () from /lib64/libc.so.6
#4  0x00000039d1874c5c in free () from /lib64/libc.so.6
#5  0x0000003320a01bdd in ueblktap_probe (h=3D0x6073b0,=20
    w=<value optimized out>, bepath_im=<value optimized out>) at
    xenbus.c:270
#6  0x0000003320a020e0 in xs_fire_next_watch (h=3D0x6073b0) at
xs_api.c:355
#7  0x0000000000401785 in main (argc=3D<value optimized out>,
    argv=<value optimized out>) at blktapctrl.c:907

There is a case that "/local/domain/0/backend/tap/<dom_id>" exists but
"/local/domain/<dom_id>/vm" is not in the xenstore.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2010-01-22 11:00:45 +00:00
Keir Fraser 7848a26a97 libxc: mmapbatch-v2 adjustments
Just like the kernel, the fallback implementation of
xc_map_foreign_bulk() should clear the error indication array upon
success.

Also, a few allocations were needlessly using calloc() instead of
malloc().

Finally, in xc_domain_save() allocate the error indicator array once
(along with the other arrays) instead of using realloc() (without
error checking) in the loop body.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-01-22 10:59:51 +00:00
Keir Fraser d6aaa9ee0f libxc: New hcall_buf_{prep,release} pre-mlock interface
Allow certain performance-critical hypercall wrappers to register data
buffers via a new interface which allows them to be 'bounced' into a
pre-mlock'ed page-sized per-thread data area. This saves the cost of
mlock/munlock on every such hypercall, which can be very expensive on
modern kernels.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-01-22 10:59:03 +00:00
Keir Fraser 379e63ed3d x86: kill msix_flush_writes()
The (only) two callers of it don't need it, as the MSI-X case of
msi_set_mask_bit() already does the necessary readl().

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-01-21 15:13:00 +00:00
Keir Fraser 231123f755 x86: dump full IRQ affinity
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-01-21 15:12:38 +00:00
Keir Fraser ceb3df776e x86: add keyhandler to dump MSI state
Equivalent to dumping IO-APIC state; the question is whether this
ought to live on its own key (as done here), or whether it should be
chanined to from the 'i' handler.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-01-21 15:12:17 +00:00
Keir Fraser ec78952374 xend: Dis-allow device assignment if PoD is enabled.
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
2010-01-21 14:40:05 +00:00
Keir Fraser b304702a73 tools: fix sysfs error path
Attached patch fixes sysfs error path.
NetBSD also has a /proc/mounts file but no sysfs.
On Linux you can test this with sysfs not mounted.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2010-01-21 11:27:11 +00:00
Keir Fraser 92181f1829 VT-d: warn on bogus RMRR entry
Signed-off-by: Weidong Han <weidong.han@intel.com>
2010-01-21 11:26:26 +00:00
Keir Fraser 41a41718c4 xentrace: XC_PAGE_SIZE should be used
20827:fad80160c001 cannot be compiled on ia64:
  xentrace.c:647: error: 'PAGE_SIZE' undeclared (first use in this

This patch fixes it.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2010-01-21 09:13:46 +00:00
Keir Fraser 3a007e1577 VT-d: improve RMRR validity checking
Currently, Xen checks RMRR range and disables VT-d if RMRR range is
set incorrectly in BIOS rigorously. But, actually we can ignore the
RMRR if the device under its scope are not pci discoverable, because
the RMRR won't be used by non-existed or disabled devices.

This patch ignores the RMRR if the device under its scope are not pci
discoverable, and only checks the validity of RMRRs that are actually
used. In order to avoid duplicate pci device detection code, this
patch defines a function pci_device_detect for it.

Signed-off-by: Weidong Han <weidong.han@intel.com>
2010-01-21 09:12:01 +00:00
Keir Fraser 1ac4cf5651 VT-d: handle return value of deassign_device
deassign_device may fail, so need to capture its failure for
appropriate handling. This patch captures return values of
deassign_device, and prints error messages if it fails.

In addition, this patch also fixes some code style issues.

Signed-off-by: Weidong Han <Weidong.han@intel.com>
2010-01-21 09:11:06 +00:00
Keir Fraser d7efbf3bac libxc: Unbreak HVM live migration after 0b138a019292.
0b138a019292 was a little too ambitious replacing xc_map_foreign_batch
with xc_map_foreign_pages in xc_domain_restore. With HVM, some of the
mappings are expected to fail (as "XTAB" pages).

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
2010-01-21 09:03:20 +00:00
Keir Fraser 1e4743291b xend: Unbreak live migration with tapdisk2 after 20691:054042ba73b6
vm.image does not exist at this point in the restore process.
I haven't looked at the memory_sharing code. It's likely something
better is needed to make that work across relocation.

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
2010-01-21 09:03:00 +00:00
Keir Fraser 55274e039f libxl, hvm: Add support to trigger power or sleep button events
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
2010-01-20 20:36:19 +00:00