Commit Graph
19648 Commits
Author SHA1 Message Date
Keir Fraser bd5573a630 blktap2: a completely rewritten blktap implementation
Benefits to blktap2 over the old version of blktap:

* Isolation from xenstore - Blktap devices are now created directly on
   the linux dom0 command line, rather than being spawned in response
   to XenStore events.  This is handy for debugging, makes blktap
   generally easier to work with, and is a step toward a generic
   user-level block device implementation that is not Xen-specific.

* Improved tapdisk infrastructure: simpler request forwarding, new
   request scheduler, request merging, more efficient use of AIO.

* Improved tapdisk error handling and memory management.  No
   allocations on the block data path, IO retry logic to protect
   guests
   transient block device failures.  This has been tested and is known
   to work on weird environments such as NFS soft mounts.

* Pause and snapshot of live virtual disks (see xmsnap script).

* VHD support.  The VHD code in this release has been rigorously
   tested, and represents a very mature implementation of the VHD
   image
   format.

* No more duplication of mechanism with blkback.  The blktap kernel
   module has changed dramatically from the original blktap.  Blkback
   is now always used to talk to Xen guests, blktap just presents a
   Linux gendisk that blkback can export.  This is done while
   preserving the zero-copy data path from domU to physical device.

These patches deprecate the old blktap code, which can hopefully be
removed from the tree completely at some point in the future.

Signed-off-by: Jake Wires <jake.wires@citrix.com>
Signed-off-by: Dutch Meyer <dmeyer@cs.ubc.ca>
2009-05-26 11:52:31 +01:00
Keir Fraser 6009f4ddb2 Transcendent memory ("tmem") for Xen.
Tmem, when called from a tmem-capable (paravirtualized) guest, makes
use of otherwise unutilized ("fallow") memory to create and manage
pools of pages that can be accessed from the guest either as
"ephemeral" pages or as "persistent" pages.  In either case, the pages
are not directly addressible by the guest, only copied to and fro via
the tmem interface.  Ephemeral pages are a nice place for a guest to
put recently evicted clean pages that it might need again; these pages
can be reclaimed synchronously by Xen for other guests or other uses.
Persistent pages are a nice place for a guest to put "swap" pages to
avoid sending them to disk.  These pages retain data as long as the
guest lives, but count against the guest memory allocation.

Tmem pages may optionally be compressed and, in certain cases, can be
shared between guests.  Tmem also handles concurrency nicely and
provides limited QoS settings to combat malicious DoS attempts.
Save/restore and live migration support is not yet provided.

Tmem is primarily targeted for an x86 64-bit hypervisor.  On a 32-bit
x86 hypervisor, it has limited functionality and testing due to
limitations of the xen heap.  Nearly all of tmem is
architecture-independent; three routines remain to be ported to ia64
and it should work on that architecture too.  It is also structured to
be portable to non-Xen environments.

Tmem defaults off (for now) and must be enabled with a "tmem" xen boot
option (and does nothing unless a tmem-capable guest is running).  The
"tmem_compress" boot option enables compression which takes about 10x
more CPU but approximately doubles the number of pages that can be
stored.

Tmem can be controlled via several "xm" commands and many interesting
tmem statistics can be obtained.  A README and internal specification
will follow, but lots of useful prose about tmem, as well as Linux
patches, can be found at http://oss.oracle.com/projects/tmem .

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-05-26 11:05:04 +01:00
Keir Fraser ff811c2bc4 uninstall: get rid of hardcoded pathes
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-05-26 10:14:34 +01:00
Keir Fraser 93dc12efb4 x86 hvm viridian: Provide dummy support for APIC assist page to satisfy Win7.
From: Tim Deegan <tim.deegan@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-05-26 10:13:43 +01:00
Keir Fraser faeb2db71c pvgrub: few lines in shutdown_blkfront were removed by mistake.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-05-26 10:05:27 +01:00
Keir Fraser e25dc9429b xm, xend: passthrough: Add assigned_or_requested_vslot()
Add an accessor to simplify accessing vslot if available,
otherwise requested_vslot.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-05-26 10:04:10 +01:00
Keir Fraser b562a316db xend: Fix xm pci-detach for inactive devices
In the case where a device is attached to an inactive domain
and then removed before the domain is activated it won't have
a vslot assigned, but it should still be valid to remove it.

I don't think that there are any other cases where vslot can
be invalid.
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-05-26 10:03:09 +01:00
Keir Fraser d05ae13188 blkif: Clarify units for 'sector'-sized blkif request params.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-05-26 10:01:54 +01:00
Keir Fraser 6a9b5290e9 Add support for superpages (hugepages) in PV domain
This patch adds the option "superpages" to the domain configuration
file. If it is set, the domain is populated using 2M pages.

This code does not support fallback to small pages.  If the domain can
not be created with 2M pages, the  create will fail.

The patch also includes support for saving and restoring domains with
the superpage flag set.  However, if a domain has freed small pages
within its physical page array and then extended the array, the
restore will fill in those freed pages.  It will then attempt to
allocate more than its memory limit and will fail.  This is
significant because apparently Linux does this during boot, thus a
freshly booted Linux image can not be saved and restored successfully.

Signed-off-by: Dave McCracken <dcm@mccr.org>
2009-05-26 09:58:38 +01:00
Keir Fraser 2cda4bd1e1 minios: replace mktime implementation
In the efforts to clarify MiniOS license it came to my attention that
few portions of MiniOS were taken from other GPL projects, one of them
is the mktime implementation. This patch replaces the current GPL
licensed mktime implementation with a different and BSD licensed
version.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-05-26 09:54:53 +01:00
Keir Fraser c7c69094e5 PV-on-HVM: Define atomic_cmpxchg() for old Linux kernels.
Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2009-05-26 09:52:59 +01:00
Keir Fraser 1d89b44561 stubdom: 'file' based disk sharing
Allow 'file' based disks, that are blkback based disks, to be shared
between the guest domain and the stubdom. It does so exploiting the
same exception introduced in the previous patch "stubdoms phy disks
sharing". Now we can remove the hack in stubdom-dm that forces "file"
disks to be opened using blktap instead of blkback.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-05-26 09:50:35 +01:00
Keir Fraser 0f688ae304 minios: Fix blkfront driver when sector_size != 512
The first and last sector as well as the sector number of the request
is expressed in 512 bytes units, independently from the real sector
size.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-05-26 09:49:19 +01:00
Keir Fraser c04c51bbf9 xend: Fix typo in usage of new auxbin.xen_configdir() function
Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
2009-05-21 04:31:47 +01:00
Keir Fraser 45963f3c8c ACPI/NUMA: Improve SRAT parsing
This is to properly handle SRAT rev 2 extended proximity domain
values.

Also a first step to eliminate the redundant definitions of
ACPI provided table structures (Linux eliminated all of the duplicates
from include/linux/acpi.h in 2.6.21).

Portions based on a Linux patch from Kurt Garloff <garloff@suse.de>
and Alexey Starikovskiy <astarikovskiy@suse.de>.

IA64 build tested only.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-05-20 16:02:50 +01:00
Keir Fraser 4ad717e086 x86-64: also handle virtual aliases of Xen image pages
With the unification of the heaps, the pages freed from the Xen boot
image now can also end up being allocated to a domain, and hence the
respective aliases need handling when such pages get their
cacheability attributes changed.

Rather than establishing multiple mappings with non-WB attributes
(which temporarily still can cause aliasing issues), simply unmap
those pages from the Xen virtual space, and re-map them (to allow re-
establishing of eventual large page mappings) when the cachability
attribute for them gets restored to normal (WB).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-05-20 15:38:34 +01:00
Keir Fraser 72d202e34c x86: don't map more than the allocated space for frame_table
This is to avoid undue virtual address aliases in case the over-mapped
pages happen to get allocated to a domain, and then get their
cacheability attributes changed.

At the same time, use 1Gb mappings if possible and reasonable.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-05-20 15:35:32 +01:00
Keir Fraser 66a8421ec6 x86: some assorted irq related cleanups
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-05-20 15:30:36 +01:00
Keir Fraser eaa024d296 Introduce __must_be_array
Cloning the similar construct from Linux, allowing to detect improper
uses of ARRAY_SIZE() at build time.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-05-20 15:29:25 +01:00
Keir Fraser 9f6d07bac9 tools: get rid of hardcoded config dirs
Remove *all* hardcoded "/etc/xen" strings in python code.

Additionally, it removes pygrub_path from osdep.py. Its use has been
replaced with auxbin.pathTo("pygrub").

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-05-20 15:27:30 +01:00
Keir Fraser e7da8a7b69 xend: remove spurious pci_len from getDeviceSxprs
Cc: Zhai Edwin <edwin.zhai@intel.com>
Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Cc: Dexuan Cui <dexuan.cui@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-05-20 15:13:36 +01:00
Keir Fraser 812256dc98 gnttab: for sanity's sake, don't access the active grant table
structure when we don't hold the lock.

Signed-off-by: Steven Smith <steven.smith@citrix.com>
2009-05-19 23:44:28 +01:00
Keir Fraser 03cd09e044 gnttab: Remove unused per-domain map_count field
Signed-off-by: Steven Smith <steven.smith@eu.citrix.com>
2009-05-19 23:30:32 +01:00
Keir Fraser 9731212f50 x86: Fix the P2M audit code.
It currently doesn't even compile; with this patch applied, it
compiles and didn't immediately explode as soon as I started a VM.
I've not given it much testing beyond that, though.

Signed-off-by: Steven Smith <steven.smith@citrix.com>
2009-05-19 23:28:25 +01:00
Keir Fraser ff7d47a80a stubdom: Rebuild the ocaml runtime libraries with the options needed
if they are to be linked with object files created by ocamlc and the minios
kernel.

This is needed to build stubdoms written in ocaml.

Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
2009-05-19 14:17:56 +01:00
Keir Fraser 0e57a92cc3 minios: Implement some extra lib functions for ocaml xenstored stubdom
We could stub them out as unsupported, but we may as well implement
them as they are very simple.

Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
2009-05-19 14:15:43 +01:00
Keir Fraser c1861bc6f8 minios: Define extra stub functions to allow build of ocaml xenstored stubdom
These are referenced by the libs that ocamlopt links xenstored to, but
ought not actually get called.

Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
2009-05-19 14:14:41 +01:00
Keir Fraser c7367160e4 ocaml-xenstored: Allow to build ocaml xenstored instead of C version
To use, set CONFIG_OCAML_XENSTORED=y at build time.
Then the build system will automatically download the remote repo
to tools/ocaml-xenstored.

Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
2009-05-19 14:13:20 +01:00
Keir Fraser 1f876c2e6e tools: Fix an obvious xgettext build typo.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-05-19 13:38:05 +01:00
Keir Fraser c3122a4018 xend: Fix xm pci commands for inactive managed domains.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-05-19 02:23:32 +01:00
Keir Fraser 41af6f38d9 xend: Make hotplug script timeouts configurable
In some configurations, when dom0 is busy with I/O, it may take
several minutes to complete all hotplug scripts required when a new
domain is being created. As device create timeout is set to 100
seconds, users get "hotplug scripts not working" error instead of a
new domain.

This patch makes both DEVICE_CREATE_TIMEOUT and DEVICE_DESTROY_TIMEOUT
configurable in xend-config.sxp to allow users to easily adapt hotplug
timeouts to their environment.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2009-05-19 02:18:48 +01:00
Keir Fraser 9125594e4e python: get rid of hardcoded search pathes in python code.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-05-19 02:16:37 +01:00
Keir Fraser cc0c5e1dfc x86 hvm: Correctly emulate task switches into vm86 mode.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-05-19 02:12:04 +01:00
Keir Fraser 2716786b67 x86_emulate: Emulate LLDT and LTR instructions.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-05-19 02:09:36 +01:00
Keir Fraser 2e1b6a8dcc xentrace: Trace IRQs and entry/exit timestamps.
From: Dulloor <dulloor@gmail.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-05-19 02:08:01 +01:00
Keir Fraser f770d340f1 xend: adjust relocation buffer size
This can greatly improve ssl relocation performance (to about 1/3
compared with buffersize 1024).

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
2009-05-19 01:50:00 +01:00
Keir Fraser 94c3a1b680 tools: clean up handling of xen config and scripts directories.
For now hardcode /etc w/o a prefix as there are hardcoded
config paths in the code which would break otherwise.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-05-19 01:48:18 +01:00
Keir Fraser 9528ca9f77 xend: solve issues with xm block-configure command.
In the case of inactive managed domains:
 The following error occurs currently.  We cannot change the
 configuration of the VBD by using xm block-configure.  Of course,
 using xm block-detach and xm block-attach instead of xm
 block-configure, we can change it. However, I'd like to change it by
 using xm block-configure.

In the case of active domains:
 Another problem occurs after a domain was rebooted.  Even if we
 change a configuration of a VBD in the domain by using xm
 block-configure, the configuration of the VBD is reverted to previous
 configuration after the domain was rebooted.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-05-19 01:37:19 +01:00
Keir Fraser fdaaa5fe16 xend: Avoid deprecation warnings with Python 2.6.
Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
2009-05-19 01:34:34 +01:00
Keir Fraser f7a4f4101d x86, cpufreq: fix ondemand governor to take aperf/mperf feedback
APERF/MPERF MSRs provides feedback about actual freq in
eplased time, which could be different from requested freq by
governor. However currently ondemand governor only takes that
feedback at freq down path. We should do that for scale up too.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
2009-05-19 01:31:26 +01:00
Keir Fraser 5bc663c759 ioemu: Export PREFIX variable to ioemu build environment.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-05-19 01:27:36 +01:00
Keir Fraser c9e8a6b158 x86 hvm: Provide x2APIC identifier in CPUID leaf 0xb.
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
2009-05-19 01:25:59 +01:00
Keir Fraser afc456654c stubdom: fix issue with phy disks
Add an exception for stubdoms in the same_vm hotplug script function.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-05-19 01:18:35 +01:00
Keir Fraser 26c54bf9fa x86: Use PGC_cacheattr_mask rather than a hardcoded constant.
Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-05-19 01:17:16 +01:00
Keir Fraser 20a0b3ef15 Update README for 3.4 branch.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-05-18 13:53:55 +01:00
Keir Fraser 9e8f7237f1 vt-d: Fix interrupt remapping for multiple IOAPICs
Current IOAPIC interrupt remapping code assumes there is only one
IOAPIC in system. It brings problem when there are more than one
IOAPIC in system. This patch extends ioapic_pin_to_intremap_index[]
array to handle multiple IOAPICs case.

Signed-off-by: Weidong Han <weidong.han@intel.com>
2009-05-15 08:12:39 +01:00
Keir Fraser 520302d743 cpuidle: Fix possible false judge caused by type casting
For timer_deadline == 0 or timer_deadline - now > largest u32
case, the expected_us (in u32 type) may become wrong.

Add a tunable option to ease conditional adjustment.

Signed-off-by: Wei Gang <gang.wei@intel.com>
2009-05-14 15:46:43 +01:00
Keir Fraser cda3e8c2a8 xen public: make mmuext_op's vcpumask field const
Linux started to pass around pointers to 'const cpumask_t' a while ago,
and passing such a pointer to set_xen_guest_handle() requires that the
field be a handle for a constant type in order to avoid compiler
warnings.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-05-14 15:46:04 +01:00
Keir Fraser 76bc713dd7 x86 vmx: Ensure debug-mode intercept for int3 and debug exceptions are
reinstated when resetting EXCEPTION_BIRTMAP entry in VMCS after
exiting real mode.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-05-13 10:39:44 +01:00
Keir Fraser 9f97da694d passthrough: Fix PCI hot-plug option parsing
When a PCI function is passed-through extra options may be passed
through.
In the case of boot-time PCI pass-through the documented format is:
    [dom:]bus:dev.slot[@vslot][[,opt]...]
    e.g.
    00:01.00.1@7,msitranslate=3D1

In the case of PCI hot-plug the xm pci-attach command take the
following arguments:
    [-o opt[,opt]...] [dom:]bus:dev.slot [vslot]
    e.g.
    -o msitranslate=3D1 00:01.00.1 7

    These xm ends up passing these to xem-qemu as:
    [dom:]bus:dev.slot[[,opt]...][@vslot]
    e.g.
    00:01.00.1,msitranslate=3D1@7

    Note that the option and the vslot have are transposed when
    compared to the format used by boot-time PCI pass-through.

The parser inside qemu-xen can only handle the format used by
boot-time PCI pass-through and because of this ignores
any options passed by hot-plug.

This patch alters format used by hot-plug to match the parser.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-05-13 10:28:35 +01:00