Commit Graph
1134 Commits
Author SHA1 Message Date
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
Keir Fraser 34097f0d30 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

Signed-off-by: Qing He <qing.he@intel.com>
2009-03-02 10:26:37 +00:00
Keir Fraser d3d0b89247 libxc: xc_ptrace cleanup
There are some bugs in PTRACE_PEEK/POKE.
- can't track 2MB pages in 32bit pae mode.
- leakage of mmap/munmap.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2009-02-20 11:09:46 +00:00
Keir Fraser 20eed172a7 libxenctrl: adds xc_domain_unbind_msi_irq to libxc.
The function is needed to unbind MSI/MSI-X on transition from D3hot
state to D0 state.

Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
2009-02-05 15:28:09 +00:00
Keir Fraser 2c3072a583 libxc support for the new partial-HVM-save domctl.
This includes making the pagetable walker in xc_pagetab.c behave
correctly for 32-bit and 64-bit HVM guests.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2009-02-05 12:17:08 +00:00
Keir Fraser 26181d3763 bump libxenctrl and libxenguest versions
In c/s 19009 an incompatible change was made to the ABI of libelf-*,
which are included in libxenctrl and libxenguest.  To avoid client
programs (such as python/lowlevel/xc/xc.so) picking up a wrong
version and perhaps crashing, the soname should be changed.

I have chosen the version number 3.4 as xen-unstable is currently the
pre-3.4 branch.  I assume we don't care about API/ABI stability within
an unstable branch.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-01-23 11:51:43 +00:00
Keir Fraser ff4f536ebf [IA64] fix compilation error caused by 19046:ecf603780f56
This patch fixes the following compilation error adjusting
function prototypes.

> xc_core_ia64.c:176: error: conflicting types for
  'xc_core_arch_memory_map_get'
> xc_core.h:141: error: previous declaration of
  'xc_core_arch_memory_map_get' was here
> xc_core_ia64.c:241: error: conflicting types for
  'xc_core_arch_map_p2m'
> xc_core.h:144: error: previous declaration of 'xc_core_arch_map_p2m'
  was here

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-01-16 11:47:21 +00:00
Keir Fraser fb9dda3e06 ptrace_core: Handle FV cross-bitness.
Signed-off-by: Bruce Rogers <brogers@novell.com>
2009-01-16 11:46:51 +00:00
Keir Fraser 3967bb3aff libxc: Support cross-bitness guest when core-dumping
This patch allows core-dumping to work on a cross-bit host/guest
configuration, whereas previously that was not supported.  It supports
both PV and FV guests. The core file format generated by the host,
needs to match that of the guest, so an alignment issue is addressed,
along with the p2m frame list handling being done according to the
guest size.

Signed-off-by: Bruce Rogers <brogers@novell.com>
2009-01-15 12:37:42 +00:00
Keir Fraser 78c3097e4f Remove unused XENMEM_remove_from_physmap.
Never present in any stable release of Xen. Introduced for use by
qemu-dm but now not needed.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-01-14 11:24:37 +00:00
Keir Fraser 2d2f7977a0 Remove unused XENMEM_translate_pfn_list.
Never used by a guest OS (except in IA64 hcall translation layer) and
obsoleted in the tools for ages. Recent usage by qemu-dm is now
removed.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-01-14 11:15:01 +00:00
Keir Fraser a390e6128b x86, hvm: stdvga improvements
* enables linear framebuffer and VBE 3.0 extensions.
* add a number of new resolutions, up to 2560x1600, and including
* widescreen modes common to modern displays.
* Introduce configurable video ram size through the "videoram" config
* file option, shrinking default video ram used to 4 Megs (thus
* eliminating 4 wasted megs/VM that have been the case until now), but
* allowing users to specify up to 16 Megs of vram, to support the
* extreme high resolutions such as 2560x1600x32.

Signed-off-by: Trolle Selander <trolle.selander@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-01-14 10:51:58 +00:00
Keir Fraser 9f8501582f Use -MMD -MF in tools/* rather than -Wp,-M...
If you use -MMD -MF then the correct .o filename is written to the
.*.d file as the compiler driver arranges everything.  This was done
in 19010:275abe1c5d24 for the hypervisor.

In this patch we do the same elsewhere in the xen-unstable tree,
particularly tools/.  Specifically:
 * Change tools/Rules.mk to add -MMD -MF ... to CFLAGS and set DEPS.
 * Remove -Wp,-MD... from every other Makefile
 * Remove setting of DEPS from every other Makefile
 * Ensure that every Makefile says -include $(DEPS)
 * Ensure that every Makefile's clean target removes $(DEPS)

Some Makefiles were already halfway there, but often for a different
variable name eg PROG_DEP.  The variable name is now standardised in
Rules.mk as DEPS.

I have done a test build with this change, on Debian etch.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-01-12 10:16:05 +00:00
Keir Fraser ad8b20cc85 x86, hvm: Move E820 table creation into hvmloader, extend
hvm_info_table to describe memory parameters in a simpler form from
domain builder to hvmloader.

Also move reserved special page mappings immediately below the 4GB
boundary.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-01-08 15:27:20 +00:00
Keir Fraser 8ce65842ad Move libelf headers out of xen public header dir.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-01-08 13:15:49 +00:00
Keir Fraser 11f8ac5ebf passthrough: MSI-INTx translation for HVM
The patch adds a new type of pt_irq: PT_IRQ_TYPE_MSI_TRANSLATE.
With it, guest dpci irq can now use msi as the underlying pirq
while injected as INTx irq.

Signed-off-by: Qing He <qing.he@intel.com>
2009-01-08 11:25:06 +00:00
Isaku Yamahata 7e9a3beb1e [IA64] ia64 counter part of 5b44cfde9666.
This patch defines ia64 xc_hvm_build_target_mem() which
is referenced by xc.c.
Without this patch, xend doesn't boot complaining
that symbol, xc_hvm_build_target_mem, is missing.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-01-07 14:27:03 +09:00
Isaku Yamahata 4d44b2eab3 merge with xen-unstable.hg 2009-01-07 12:20:18 +09:00
Keir Fraser 7e72c30726 libxc: Define xc_ffs{8,16,32,64} functions. Use them.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-01-06 09:14:39 +00:00
Keir Fraser 446b916ca1 Make xc_translate_foreign_address aware of compat-mode guests and
(32-bit) HVM guests.  64-bit HVM guests are still not supported for
now, pending a sensible way of getting at the guest's EFER.LMA.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2009-01-05 11:08:25 +00:00
Keir Fraser f5fec95647 PoD memory 8/9: libxc interface
Implement libxc interface to PoD functionality:
* Add xc_hvm_build_target_mem(), which takes both memsize and target.
Memsize is the total memory, allocated in PoD pages and reported in
the e820; target is the size of the cache.  If these are the same, the
normal funcitonality is called.  (So you can use the same function to
build always, and it will decide whether to use PoD or not.)
* Add xc_domain_memory_[gs]et_pod_target(), which sets and/or returns
information about the PoD cache and p2m entries.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-01-05 10:46:37 +00:00
Isaku Yamahata 658c654a05 [IA64] paravirtualize itc and support save/restore.
ia64 linux 2.6.18 only use ar.itc for local ticks so that
ar.itc didn't need paravirtualization and it can be work arounded
when save/restore.
However recent ia64 linux uses ar.itc for sched_clock() and
CONFIG_VIRT_CPU_ACCOUNTING and other issues. So ar.itc needs
paravirtualization. Although Most part is done in guest OS,
save/restore needs hypervisor support.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-01-05 12:24:58 +09:00
Keir Fraser 74d59a59e2 x86: Enable MTF for HVM guest single step in gdb
Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-16 11:49:20 +00:00
Keir Fraser 0347bade8b xc_pm: Fix off-by-one error in string array access.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2008-12-13 15:04:53 +00:00
Keir Fraser de8ffdf6a4 libxc: Fix xc_pm.c build by avoiding bogus header includes.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-11 11:19:27 +00:00
Keir Fraser 7542c4ff00 Add user PM control interface
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
2008-12-10 13:27:41 +00:00
Keir Fraser ac677794d6 libxc: Fix memory leak in zlib usage
Any call to inflate() must be followed by inflateEnd(), otherwise the
internal zlib state is leaked.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-12-10 13:14:13 +00:00