Commit Graph
1160 Commits
Author SHA1 Message Date
Keir Fraser 87cb99a6dd Add nomigrate config option to disable migration/restore
The new nomigrate option can be set to non-zero in vm.cfg
(for both hvm and pvm) to disallow a guest from being
migrated or restored.  (Save is still allowed for the purpose
of checkpointing.)  The option persists into a save file
and is also communicated into the hypervisor, the latter
for the purposes of a to-be-added hypercall for communicating
to guests that migration is disallowed (which will be
used initially for userland TSC-related sensing, but may
find other uses).

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-10-20 08:45:12 +01:00
Keir Fraser 0482af4d96 Spinlock profiling (enable in build with lock_profile=y)
Adds new tool xenlockprof to run from dom0.

From: Juergen Gross <juergen.gross@ts.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-14 09:07:51 +01:00
Keir Fraser 14f5810ab7 libxenctrl: Fix non-Linux definitions of xc_gnttab_map_table*().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-07 16:10:19 +01:00
Keir Fraser 0faacacb2f libxenctrl: Build fix after gnttab_v2 changes.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-07 10:26:39 +01:00
Keir Fraser a98dc13703 Introduce a grant_entry_v2 structure.
Signed-off-by: Steven Smith <steven.smith@citrix.com>
2009-10-07 07:46:36 +01:00
Keir Fraser 1766cdc32b Rename the struct grant_entry to struct grant_entry_v1, so that it
isn't in the way when we introduce struct grant_entry_v2.

Signed-off-by: Steven Smith <steven.smith@citrix.com>
2009-10-07 07:46:14 +01:00
Keir Fraser 643898034e stubdom/minios: re-structure headers
As part of making stubdom usable on NetBSD, it is necessary to
restructure the minios headers to avoid conflicts with NetBSD's
crossbuild toolchain.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2009-10-01 12:28:54 +01:00
Keir Fraser fb7925518f vmx: add the support of XSAVE/XRSTOR to VMX guest
XSAVE/XRSTOR manages the existing and future processor extended states
on x86 architecture.

The XSAVE/XRSTOR infrastructure is defined in Intel SDMs:
http://www.intel.com/products/processor/manuals/

The patch uses the classical CR0.TS based algorithm to manage the
states on context switch.  At present, we know 3 bits in the
XFEATURE_ENABLED_MASK: FPU, SSE and YMM.  YMM is defined in Intel AVX
Programming Reference: http://software.intel.com/sites/avx/

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-09-29 11:27:53 +01:00
Keir Fraser bf2c44f8b4 x86: Allow TSC mode (emulate vs native) to be configured per domain.
The default is to emulate. Old saved images will be restored with
legacy behaviour however (native TSC, no emulation).

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-28 10:01:10 +01:00
Keir Fraser 0c98ffd10a Fix some issues for HVM log dirty:
* Add necessary logging dirty in qemu to avoid guest error with
intensive disk access when live migration
* Take place of shared memory between qemu and migration tools by new
added hypercall, which is clean and simple

Signed-Off-By: Zhai, Edwin <edwin.zhai@intel.com>
2009-09-07 08:37:58 +01:00
Keir Fraser e997adf2ce libxenguest: Remove unused static inline function is_loadable_phdr()
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-09-02 16:15:05 +01:00
Keir Fraser bc05036624 libxc: Avoid a constant-zero-sized memset().
Some environments warn about this, which fails the build.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-31 10:14:26 +01:00
Keir Fraser 4062d9c27b [HVM] add super page support for HVM migration
This patch try to allocate 2M pages on target side based on analysis
of pfn sequence sent from source side for HVM migration.

The algorithm is: If pseudo-phys page is not yet populated in target
domain, AND it is first page of a 2MB extent, AND no other pages in
that extent are yet populated, AND the next pages in the save-image
stream populate that extent in order, THEN allocate a super page. If
the next 511 pages (to make the 2MB extent) are split across a batch
boundary, we have to optimistically allocate a super page in this
batch, and then break it into several 4K pages in the next batch,
which is speculative.

This patch is also friendly to PV guest migration.

Signed-Off-By: Zhai Edwin <edwin.zhai@intel.com>
2009-08-27 10:12:41 +01:00
Keir Fraser 552cd79c66 libxc: More LZMA/BZIP fixes.
- Fix an error message in xc_try_bzip2_decode()
 - Check library installation on demand using a Makefile function,
   rather than generating a dependency file. Cleaner and avoids a race
   on generating the dep file.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-24 08:27:30 +01:00
Keir Fraser a8f634b0a3 Revert 20105:979fd420311b 2009-08-21 17:00:01 +01:00
Keir Fraser ee316d2f8c libxc: Remove minios-specific hack for generating .zlib.deps file
It's not needed if one relative path is replaced.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-21 11:10:49 +01:00
Keir Fraser 4a22a4ce1e libxenguest: Fix libbz2/liblzma dependency computation.
1. Create an empty dep file if neither lib is installed
 2. Forcibly disable support for libs if building minios

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-20 22:26:16 +01:00
Keir Fraser d7c9674faa domain builder: Implement bzip2 and LZMA loaders
Recent upstream kernels can be compressed using either gzip,
bzip2, or LZMA.  However, the PV kernel loader in Xen currently only
understands gzip, and will fail on the other two types.  The attached
patch implements kernel decompression for gzip, bzip2, and LZMA so
that kernels compressed with any of these methods can be launched.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-20 22:12:25 +01:00
Keir Fraser 5ae9d73d93 x86 hvm: Remove vendor-specific feature masking of 0x1:ECX.
Vendors are respecting each others bits.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
2009-08-19 13:16:50 +01:00
Keir Fraser 734a7f6677 tmem: save/restore/migrate/livemigrate and shared pool authentication
Attached patch implements save/restore/migration/livemigration
for transcendent memory ("tmem").  Without this patch, domains
using tmem may in some cases lose data when doing save/restore
or migrate/livemigrate.  Also included in this patch is
support for a new (privileged) hypercall for authorizing
domains to share pools; this provides the foundation to
accomodate upstream linux requests for security for shared
pools.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-08-06 09:19:55 +01:00
Keir Fraser 5301fe9943 libxenguest: Revert domain builder interface changes for 'superpages'
parameter, and place the flag in a pad byte of 'struct xc_dom_image'
instead.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-07-20 15:45:50 +01:00
Keir Fraser 07a34def02 libxc: Use a single mmap interface to Linux
Modify xc_map_foreign_range and xc_map_foreign_ranges to call
mmap_map_foreign_batch. This eliminates the need for multiple privcmd
mmap ioctls. Now only IOCTL_PRIVCMD_MMAPBATCH is required.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-07-20 10:58:06 +01:00
Keir Fraser 14fbdbd3d3 libxc: Fix bugs in xc_exchange_page: pfn_type indexed by gpfn.
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2009-07-02 11:33:43 +01:00
Keir Fraser fb442e2171 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).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-06-18 10:14:16 +01:00
Keir Fraser c93bd0e6ea 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.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-06-17 07:14:02 +01:00
Keir Fraser 310311cd88 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.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2009-06-04 10:36:36 +01:00
Keir Fraser cf57498e90 libxc: Implement stub xc_gnttab_map_table() for non-linux.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-06-01 15:52:19 +01:00
Keir Fraser d06a984487 libxc: Exchange a page for PV guest
This patch support exchange a page for a suspended PV guest from user
space.

The basic idea to offline a page is:
1) mark a page offline pending
2) If the page is owned by a HVM domain, user have to live migrate it.
    In future, with stub-domain support, we can also exchange the page
    without migration.
3) If the page is owned by a PV domain, we will try to exchange the
offline pending page to a new one and free the old page.

This patch achieves item 3.

The method to exchange the offline pending page for PV domain is:

1) Suspend the guest.
2) If the page is being granted out, return with offline pending.
3) Get a copy for the content
4) Scan all page table page to see if any reference to the offending
page, if yes, make the entry to be non-present to reduce the reference
count.
5) After update all page tables, user space tools will try to exchange
the old page. If the new mfn has no reference anymore (i.e.
count_info & count_mask =3D 1), the exchange will allocate a new page,
update the m2p and return success, otherwise it will return fail.
6) If step 5 is success, user space tools will update the content of
the new page  change the p2m table, and change all entries scaned in
step 4 to point to new entry.
if step failed, it will try to undo step 4 to revert page table.
7) Resume the guest.

Please refer to thread in
http://www.mailinglistarchive.com/xen-devel@lists.xensource.com/msg63084.html
for more information.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2009-06-01 14:15:48 +01:00
Keir Fraser 1472f8177f libxc: Export xc_core_arch_map_p2m_writable()
This patch firstly change the xc_core_arch_map_p2m() to map the p2m to
be writable, then it export this function.
One notice for this patch is, caller should make sure change the p2m
in flight will not cause trouble.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2009-06-01 14:13:53 +01:00
Keir Fraser 8b9c6bce94 libxc: Add a function to map a domain's grant table.
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2009-06-01 14:13:20 +01:00
Keir Fraser 602097e84b libxc: export xc_map_m2p() so that it can be called outside.
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2009-06-01 14:12:53 +01:00
Keir Fraser 79cda3bac9 Export page offline hypercalls to user space tools.
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2009-06-01 14:08:58 +01:00
Keir Fraser b0a6b12293 [IA64] adjust ia64 xc_domain_restore() signature
This patch fixes the following error.
ia64/xc_ia64_linux_restore.c:546: error: conflicting types for
xc_domain_restore
./xenguest.h:49: error: previous declaration of xc_domain_restore was
here
make[4]: *** [ia64/xc_ia64_linux_restore.o] Error 1

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-05-27 12:00:51 +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 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 e4eff651ee restore: sign extend p2m when restoring on a host with pfn width <
guest pfn width

(i.e. 32on64 domain 0 and 64 bit guest domain).

Otherwise P2M entries which were INVALID_P2M_ENTRY
(==0xffffffffffffffff) become 0xffffffff after a migrate.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2009-04-08 19:10:33 +01:00
Keir Fraser 9d82166018 xenpm: Set scheduler vcpu_migration_delay by xenpm
Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Yang Xiaowei <xiaowei.yang@intel.com>
2009-04-06 13:49:16 +01:00
Keir Fraser 03affb40e7 libxc: Fix xc_translate_foreign_address in non-paged mode
Returns paddr rather than gfn when in non-paged mode.  Add a shift to
fix it.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-03-31 11:32:56 +01:00
Keir Fraser fd598342a0 cpuidle: export max_cstate access via libxc
Signed-off-by: Wei Gang <gang.wei@intel.com>
2009-03-31 11:19:26 +01:00
Keir Fraser 92f5c346e7 libxc: fix link error of xc_save on ia64
The suspend event channel functions are arch independent code
which xc_save uses.
The changeset of 19382:a5f497f02e34 cause link error on ia64.
This patch moves the functions into arch common file from
x86 specific file xc_domain_save.c

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-03-24 06:55:29 +00:00
Keir Fraser 7b915d3eaf xenpm: Add a small scheduler knob "sched_smt_power_savings"
Current scheduler only care performance, thus always picks pCPU from
the most idle package. This knob provides another option to pick pCPU from
least idle package, for user who want performance power balance.

Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Tian Kevin <kevin.tian@intel.com>
2009-03-20 08:59:47 +00:00
Keir Fraser 037d1b3c89 Deliver cpufreq actual average freq to libxc interface
Calculate cpu actual average freq according to aperf and mperf MSR and
then deliver to libxc interface

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
2009-03-20 08:48:57 +00:00
Keir Fraser d046c2261f x86 dom builder: Allocate domU pages in batches.
Allows a 32-bit dom0 to create very large guests.

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-03-19 10:04:15 +00:00
Keir Fraser ef940f08d5 libxc: Use write_exact() in lock_suspend_event().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-03-18 17:25:54 +00:00
Keir Fraser cce99fb132 Move the suspend event channel function to libxc, it will use the
/var/lib/xen/suspend_evtchn_lock.d to protect the access.

Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com>
2009-03-18 11:49:26 +00:00
Keir Fraser 550686e4fd xenpm: Add CPU topology info (thread/core/socket)
CPU topology info is necessary for power management analysis. For
example, to analysis the effect of Px state coordination, Cx
package/core coordination,  the thread/core/socket topology
information is needed.

This patch add new command "get-cpu-topology" in xenpm to print the
CPU topology info:

Signed-off-by: Yu Ke <ke.yu@intel.com>
2009-03-13 10:09:25 +00:00
Keir Fraser fb0a30b839 Domain core-dumping fixes
The code was attempting to use the domain's current number of pages
(info.nr_pages) as a maximum index.  We then walk the memory map and
can easily over-write past the end of the nr_pages-sized array, if the
domain has more pages mapped in than earlier (live dump).  Restrict
ourselves to the current number of pages.

Also fix the dump core method in xend to actually implement the crash
and live options.  In particular this means that xend clients other
than xm now get non-live dumps by default.

Signed-off-by: John Levon <john.levon@sun.com>
2009-03-12 11:09:57 +00:00
Keir Fraser 08dade96d9 Fix solaris xc_map_foreign_ranges()
Signed-off-by: John Levon <john.levon@sun.com>
2009-03-12 10:56:08 +00:00
Keir Fraser a2de1cf0f8 libxc: Replace bzero() usage with memset().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-03-12 08:34:07 +00:00
Keir Fraser 5269962096 x86: Mask X86_FEATURE_XSAVE in cpuid leaf 1, ecx, as we don't allow
guests to use it (by setting cr4.OSXSAVE).

This prevents crashes in pvops kernels, as new versions of Linux
try to use this feature.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-03-09 08:54:19 +00:00