Commit Graph
1238 Commits
Author SHA1 Message Date
Keir Fraser 9bb88be542 libxc: NetBSD build fix
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2010-06-07 15:48:12 +01:00
Keir Fraser 78c8506e77 Watchdog timers for domains
Each domain is allowed to set, reset and disable its timers; when any
timer runs out the domain is killed.

Patch from Christian Limpach <Christian.Limpach@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-06-04 11:35:23 +01:00
Keir Fraser 77622d85cf libxc: Remove obsolete xc_find_device_number() declaration.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-06-04 10:46:32 +01:00
Keir Fraser ffd4db9a68 tools: assume that special Xen devices have been created by the platform
Remove all the magic surrounding the special Xen devices in Linux
specific code whereby we attempt to figure out what the correct
major:minor number is and check the the existing device has these
numbers etc. In 2010 we really should be able to trust that the
platform has created the devices correctly or provide correct
configuration settings such that they are without resorting to tearing
down the platform configured state and rebuilding it.

tools/hotplug/Linux/xen-backend.rules already contains the necessary
udev rules to create /dev/xen/evtchn and friends in the correct place.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-06-02 10:54:32 +01:00
Keir Fraser f6a50a21e5 xc: deal with xen/evtchn and xen/gntdev device names
This patch makes xc_linux properly deal with:
 1. discovering and creating device nodes if necessary
 2. the new form of xen/<dev> device names soon to be used by the
 kernel

This changes the logic slightly:
 - If a device node already exists with the proper name, then it uses
 it as-is, assuming it has already been correctly created.
 - If the path doesn't exist, or it exists but isn't a device node,
 and
   it has successfully found the major/minor for the device, then
   (re)create the device node.

Since this logic is identical for gntdev and evtchn, make a common
function to handle both.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
2010-06-01 07:04:35 +01:00
Keir Fraser e693e5f1a7 tools: Build fixes.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-05-28 09:45:50 +01:00
Keir Fraser 455a17fea9 xl/libxtl: Remove glitch in xl migrate log output
* Provide a new XTL_STDIOSTREAM_HIDE_PROGRESS flag in the stdio logger
* Provide a way to adjust the flags after logger setup
* Use these to disable progress output from the migration receiver, as
  the sender is also sending progress information.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-05-28 09:38:56 +01:00
Keir Fraser a2b5973ee0 libxc: remove \n from strings passed to PERROR
Previously, the code was inconsistent: some calls to PERROR passed \n
and some did not.  With the new logging arrangements, passing \n is
definitely incorrect.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-05-28 09:38:18 +01:00
Keir Fraser 861aef6e15 libxc: save/restore error handling fixes
* Make "read_exact" in libxc always set errno.
* Rename "read_exact" macro in xc_domain_restore.c (which shadows
  real function) to RDEXACT and change all callers.
* Make RDEXACT anamorphically use xch for error reporting rather than
* stderr.
* Call PERROR rather than ERROR when appropriate, so that log messages
  include errno.
* Save errno in noncached_write so that its errno value is always
* right.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-05-28 09:37:42 +01:00
Keir Fraser b140baacc3 xl: Allow control of logging level.
The -v option, which must come before the xl command, increases the
logging level each time it is supplied.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-28 09:35:12 +01:00
Keir Fraser 0f02f4e0e8 libxc: Use new DBGPRINTF for a few debugging output messages
oubuf and batch restore write messages should be sent with level
XTL_DEBUG so that they don't disturb progress output even with -v.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-28 09:31:09 +01:00
Keir Fraser 5cc436c1d2 libxc: eliminate static variables, use xentoollog; API change
This patch eliminate the global variables in libxenctrl (used for
logging and error reporting).

Instead the information which was in the global variables is now in a
new xc_interface* opaque structure, which xc_interface open returns
instead of the raw file descriptor; furthermore, logging is done via
xentoollog.

There are three new parameters to xc_interface_open to control the
logging, but existing callers can just pass "0" for all three to get
the old behaviour.

All libxc callers have been adjusted accordingly.

Also update QEMU_TAG for corresponding qemu change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-28 09:30:19 +01:00
Keir Fraser 7f9a888af4 xtl: New xentoollog mini-library.
We provide a new header file "xentoollog.h" which defines an interface
that libraries and applications can use for logging.  This avoids
having to wrap each library's log callbacks up, massage arguments to
log callbacks, and so on.

The library's .o files are within libxc to avoid having to create a
separate lib*.a, but callers do not need to #include xenctrl.h and it
should be regarded as a separate API.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-28 09:29:15 +01:00
Keir Fraser 36cfb6aa84 libelf: Tidy up logging and remove dependency on stdio.
libelf now permits callers to specify logging callback functions,
rather than a FILE*.  libelf's non-Xen callers are all libxc users, so
the stdio dependency and the default logging callback function (which
calls vfprintf) is now in libxc.

Xen's use of libxc is unaffected in this patch.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-05-28 09:27:40 +01:00
Keir Fraser 9683028227 libxc: xc_domain_save.c: rename "write_exact" macro
There is already a "write_exact" function declared in xc_private.h.
So rename this macro to to wrexact.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-05-28 09:26:51 +01:00
Keir Fraser df54af7dd1 hvm: Extend the CPUID whitelist to include Intel's AES-NI intructions
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-05-26 08:02:33 +01:00
Keir Fraser 4cd740cf56 cpupool: Control interface should be a sysctl rather than a domctl.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-05-04 22:20:05 +01:00
Keir Fraser 335c738c44 Change the global suspend event channel lock file to a per-domain lock file
This allows multiple guests to be migrated or protected by Remus
simultaneously.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Brendan Cully <brendan@cs.ubc.ca>
2010-05-04 12:12:28 +01:00
Keir Fraser af277a631b HAP 1GB: Add corner case handling for 1GB super page.
- Without the check, guest memory allocation will never reach the
   boundary of a 1GB super page.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
2010-04-22 09:41:36 +01:00
Keir Fraser a5f70e8d92 cpupools [2/6]: libxc changes
Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
2010-04-21 12:49:00 +01:00
Keir Fraser 3ac51fc221 credit2: Add toolstack options to control credit2 scheduler parameters
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2010-04-14 12:10:19 +01:00
Keir Fraser 645f5ea7cb Topology-info sysctl cleanups.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-13 09:38:54 +01:00
Keir Fraser 560f4dc7f2 libxc: Flush I/O before xc_domain_save completion
The final, flushing call to discard_file_cache also discards any
errors from fsync. Call fsync explicitly before leaving, to check if
all VM memory actually made it to the disk.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
2010-04-12 07:22:16 +01:00
Keir Fraser 002c5bcdbe Refactor Xen Support for Intel Turbo Boost
Refactor the existing code that supports the Intel Turbo feature to
move all the driver specific bits in the cpufreq driver.  Create
a tri-state interface for the Turbo feature that can distinguish
amongst enabled Turbo, disabled Turbo, and processors that don't
support Turbo at all.

Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
2010-04-09 08:52:43 +01:00
Keir Fraser 4d6e834ba9 Host Numa information in dom0
'xm info' command now also gives the cpu topology & host numa
information. This will be later used to build guest numa support.  The
patch basically changes physinfo sysctl, and adds topology_info &
numa_info sysctls, and also changes the python & libxc code
accordingly.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
2010-04-07 16:22:05 +01:00
Keir Fraser ff61ed41ee 1GB Page Table Support for HVM Guest 1/3
This patch changes Xen tools to allocate 1GB first. If such requests
fail, it will fall back to 2MB and then 4KB. We skip 1GB allocation
for the MMIO space between 3GB and 4GB.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Acked-by: Tim Deegan <tim.deegan@citrix.com>
2010-04-06 07:02:17 +01:00
Keir Fraser 8c2f103b22 Fix gdbserver-xen support on older kernels.
The xc_ptrace API relies on errno for passing success/failure
indication back to callers.  However, mapping operations that fall
back on legacy APIs may leave errno set to a non-zero result even
thought the operation is successful.  This patch resets errno after
successful map operations so that xc_ptrace doesn't inadvertently
return a failure.

Signed-off-by: Justin Gibbs <gibbs@scsiguy.com>
2010-03-25 07:41:55 +00:00
Keir Fraser caf500204f Fixes for 21040:b64a8d2a80ad "support affinity for >64 CPUs"
Signed-off-by: James (Song Wei) <jsong@novell.com>
2010-03-18 07:44:21 +00:00
Keir Fraser 5a4d4554c3 libxc: Support set affinity for more than 64 CPUs.
There are more than 64 cpus on new intel platform especially on NUMA
system, so that we need break the pcpu limit (that is 64)  when set
affinity of a VCPU.

Signed-off-by: James (song wei) <jsong@novell.com>
2010-03-17 09:17:27 +00:00
Keir Fraser 039950d904 libxc: Pre-zero argument structures for map/unmap_pirq operations.
From: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-02-25 11:52:23 +00:00
Keir Fraser 80b4a3ebc3 libxc: Fix cpuid() inline asm.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-02-24 18:48:54 +00:00
Keir Fraser 70d0560287 Remus: increase failover timeout from 500ms to 1s
500ms is aggressive enough to trigger split-brain under fairly
ordinary workloads, particularly for HVM. The long-term fix is to
integrate with a real HA monitor like linux HA.

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
2010-02-12 09:23:10 +00:00
Keir Fraser 931df711f2 libxc: fix bug in xc_tbuf_get_size()
The size in pages of trace buffer should be t_info->tbuf_size
rather than t_info pages.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2010-02-10 13:30:16 +00:00
Keir Fraser d2a92c94a1 xenpm: Allow user to enable/disable dbs governor turbo mode.
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
2010-02-08 08:48:40 +00:00
Keir Fraser e670c28c9f libxc: Reorder functions in xc_misc.c to avoid weak symbol problem
Using a function, and then declaring it weak later, has undefined
behaviour:
  cc1: warnings being treated as errors
  xc_misc.c:388: error: weak declaration of 'xc_map_foreign_bulk'
  after first use results in unspecified behavior

So swap the functions xc_map_foreign_pages and xc_map_foreign_bulk.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-02-04 13:16:39 +00:00
Keir Fraser afe765651d libxc: Check there's enough memory for segments we're creating
Previously, xc_dom_alloc_segment would go ahead even if the segment
we're trying to create is too big for the domain's RAM (or the
requested addr is out of range).  It would pass invalid parameters to
xc_dom_seg_to_ptr giving undefined behaviour.

Fixing xc_dom_seg_to_ptr to fail is not sufficient because we want to
provide a comprehensible explanation to the caller - which may
ultimately be the user.

In particular, with this change attempting "xl create" with a ramdisk
image bigger than the guest's specified RAM will provide a useful
error message mentioning the ramdisk.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-02-03 09:46:01 +00:00
Keir Fraser 91e172bf6b libxc: Check full range of pfns for xc_dom_pfn_to_ptr
Previously, passing a valid pfn but an overly large count to
xc_dom_pfn_to_ptr, and functions which call it, would run off the end
of the pfn array giving undefined behaviour.

It is tempting to change this check to an assert, as no callers should
be providing invalid parameters here.  But this is probably best not
done while frozen for 4.0.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-02-03 09:45:40 +00:00
Keir Fraser 049ad7d34e libxc: Export do_mca hypercall to user space tools.
This is mainly for software trigger MCE operation, so that test suites
can trigger software MCE.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2010-02-03 09:38:57 +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 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 7d4ad5a07e xc_domain_save: allocate pfn_err before use
Due to recent changes related to xc_map_foreign_bulk, xc_domain_save
segfaults because it tries to use pfn_err without allocating it first.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-01-19 09:40:30 +00:00
Keir Fraser 6127bd73bd minios: implement xc_map_foreign_bulk
In order to do so it modifies map_frames_ex and do_map_frames to take
an int *err as parameter and return any error that way.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-01-18 14:48:18 +00:00
Keir Fraser 2d8eb0f62d libxc: Fix IOCTL_PRIVCMD_MMAPBATCH_V2 fallback check
privcmd_ioctl returns EINVAL if the type is not supported.
This fixes the guest booting issue caused by C/S 20791.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-01-14 14:10:40 +00:00
Keir Fraser b3eb2c1e8b x86: add and use XEN_DOMCTL_getpageframeinfo3
To support wider than 28-bit MFNs, add XEN_DOMCTL_getpageframeinfo3
(with the type replacing the passed in MFN rather than getting or-ed
into it) to properly back xc_get_pfn_type_batch().

With xc_get_pfn_type_batch() only used internally to libxc, move its
prototype from xenctrl.h to xc_private.h.

This also fixes a couple of bugs in pre-existing code:
- the failure path for init_mem_info() leaked minfo->pfn_type,
- one error path of the XEN_DOMCTL_getpageframeinfo2 handler used
  put_domain() where rcu_unlock_domain() was meant, and
- the XEN_DOMCTL_getpageframeinfo2 handler could call
  xsm_getpageframeinfo() with an invalid struct page_info pointer.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-01-13 08:14:01 +00:00
Keir Fraser 9fececad98 libxc: use new (replacement) mmap-batch ioctl
Replace all calls to xc_map_foreign_batch() where the caller doesn't
look at the passed in array to check for errors by calls to
xc_map_foreign_pages(). Replace all remaining calls by such to the
newly introduced xc_map_foreign_bulk().

As a sideband modification (needed while writing the patch to ensure
they're unused) eliminate unused parameters to
uncanonicalize_pagetable() and xc_map_foreign_batch_single(). Also
unmap live_p2m_frame_list earlier in map_and_save_p2m_table(),
reducing the peak amount of virtual address space required.

All supported OSes other than Linux continue to use the old ioctl for
the time being.

Also change libxc's MAJOR to 4.0 to reflect the API change.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-01-13 08:12:56 +00:00
Keir Fraser 6340819756 domctl/sysctl: Clean up definitions
- Use fixed-width types only
 - Use named unions only
 - Bump domctl version number

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-12-22 11:33:15 +00:00
Keir Fraser 154d93f466 Make Citrix copyright strinsg consistent.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-12-18 07:42:09 +00:00
Keir Fraser 7e31226c7a Support for -EAGAIN from xc_gnttab_map_grant_ref.
Signed-off-by: Grzegorz Milos <Grzegorz.Milos@citrix.com>
2009-12-17 06:27:56 +00:00
Keir Fraser 40be3d02f0 Interfaces to memshr domctls.
Signed-off-by: Grzegorz Milos <Grzegorz.Milos@citrix.com>
2009-12-17 06:27:56 +00:00