Commit Graph
71 Commits
Author SHA1 Message Date
Aravindh Puthiyaparambil 9fdeb539ee tools/libxc: Remove xc_hvm_[sg]et_mem_access() APIs
Remove xc_hvm_[sg]et_mem_access() APIs which have been replaced by
xc_[sg]_mem_access() APIs.

Signed-off-by: Aravindh Puthiyaparambil <aravindp@cisco.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2014-04-24 12:08:52 +01:00
Andrew Cooper 492b0688f5 tools/libxc: Fix error checking for xc_get_{cpu, node}map_size() callers
c/s 2e82c18cd8 changed the error returns of
xc_get_{cpu,node}map_size() to now include returning -1.  This invalidated the
error checks from callers, which expected 0 to be the only error case.

Coverity ID: 1135907 1135908 1135909 1135910 1135911 1135912 1135913 1135914

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: George Dunlap <george.dunlap@eu.citrix.com>
2013-12-18 11:09:58 +00:00
Dario Faggioli 62f25a16a4 libxc/libxl: allow to retrieve the number of online pCPUs
by introducing introduce xc_get_online_cpus() and
libxl_get_online_cpus().

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2013-12-09 15:20:12 +00:00
Dario Faggioli 2e82c18cd8 libxc/libxl: sanitize error handling in *_get_max_{cpus, nodes}
In libxc, make xc_get_max_{cpus,node}() always return either a
positive number or -1, and change all the callers to deal with
that.

In libxl, make libxl_get_max_{cpus,nodes}() always return either a
positive number or a libxl error code. Thanks to that, it is also
possible to fix loggig for libxl_{cpu,node}_bitmap_alloc(), which
now happens inside the functions themselves, more accurately
reporting what happened.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2013-12-09 15:20:12 +00:00
Dario Faggioli 225fa55e53 xen, libxc: introduce xc_nodemap_t
And its handling functions, following suit from xc_cpumap_t.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Acked-by: Keir Fraser <keir@xen.org>
2013-04-17 12:11:14 +01:00
David Vrabel 82639998a5 Fix emacs local variable block to use correct C style variable.
The emacs variable to set the C style from a local variable block is
c-file-style, not c-set-style.

Signed-off-by: David Vrabel <david.vrabel@citrix.com
2013-02-21 16:12:46 +00:00
Dario Faggioli 97467ae4a0 libxl,libxc: introduce libxl_get_numainfo()
Make some NUMA node information available to the toolstack. Achieve
this by means of xc_numainfo(), which exposes memory size and amount
of free memory of each node, as well as the relative distances of
each node to all the others.

For properly exposing distances we need the IDL to support arrays.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
2012-07-06 13:17:41 +01:00
Keir Fraser 54d70ad278 Rename: inslen -> insn_len
Signed-off-by: Keir Fraser <keir@xen.org>
2012-05-30 13:25:51 +01:00
Xudong Hao c0e9f48077 Add instruction length and trap type in HVMOP_inject_trap.
Signed-off-by: Xudong Hao <xudong.hao@intel.com>
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
2012-05-30 11:38:41 +01:00
Keir Fraser 5d6e4fe28b Rename inj_msi -> inject_msi
Signed-off-by: Keir Fraser <keir@xen.org>
2011-05-26 15:04:29 +01:00
Wei Liu 79df5f2ba8 libxc: add new operation in HVMOP to deliver emulated MSI.
Signed-off-by: Wei Liu <liuw@liuw.name>
2011-05-26 15:01:17 +01:00
Joe Epstein cd0e05deeb mem_access: added trap injection to libxc
* Carries forward the trap injection hypercall into libxc

Signed-off-by: Joe Epstein <jepstein98@gmail.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
2011-01-07 11:54:50 +00:00
Joe Epstein 81f8af44ba mem_access: HVMOPs for setting mem access
* Creates HVMOPs for setting and getting memory access.  The hypercalls
  can set individual pages or the default access for new/refreshed
  pages.

* Added functions to libxc to access these hypercalls.

Signed-off-by: Joe Epstein <jepstein98@gmail.com>
Reviewed-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-01-07 11:54:45 +00:00
Ian Campbell fd81c3683a libxc: move foreign memory functions to xc_foreign_memory.c
Now that this file exists it is a better home for these than xc_misc.c

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
2010-12-03 09:36:47 +00:00
Ian Campbell f32797d331 libxc: osdep: convert xc_map_foreign_{batch,bulk}
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
2010-12-03 09:36:47 +00:00
Jan Beulich c88b07f045 libxc: correct bounce direction for debug-key handling
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-12-10 18:27:17 +00:00
Ian Campbell d549bdb2a0 libxc: correct dirty_bitmap bounce size in xc_hvm_track_dirty_vram
The size should be in bytes not 32-bit words. Fixes graphics
corruption issues for HVM guests due to bouncing too little data.

Also the dirty_bitmap buffer is output only and therefore only needs
bouncing in one direction.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-11-10 14:56:06 +00:00
Juergen Gross 9180abe568 tools: change cpumaps to uint8_t
Cpumap types in tools (libxc and libxl) are changed to be based on bytes like
in the interface to the hypervisor.
To make handling easier the size of used cpumaps is always based on the
number of physical cpus supported by the hypervisor. This eliminates the need
to keep track of the cpumap size in external interfaces.
In libxl a macro for cycling through a cpumap is added (libxl_for_each_cpu).

Interfaces changed:
libxl_set_vcpuaffinity()
libxl_cpumap_alloc()
xc_vcpu_setaffinity()
xc_vcpu_getaffinity()
xc_cpupool_freeinfo()

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-11-03 12:10:46 +00:00
Ian Campbell 4fd0fc305b libxc: finalise transition to hypercall buffers.
Rename xc_set_xen_guest_handle to set_xen_guest_handle[0] and remove now
unused functions:
  - xc_memalign
  - lock_pages
  - unlock_pages
  - hcall_buf_prep
  - hcall_buf_release

[0] sed -i -e 's/xc_set_xen_guest_handle/set_xen_guest_handle/g' \
	tools/libxc/*.[ch] \
	tools/python/xen/lowlevel/xc/xc.c \
	tools/python/xen/lowlevel/acm/acm.c \
	tools/libxc/ia64/xc_ia64_stubs.c \
	tools/security/secpol_tool.c \
	tools/misc/xenpm.c

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
2010-10-22 15:14:51 +01:00
Ian Campbell 0947f260d8 libxc: convert mca interface over to hypercall buffers
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
2010-10-22 15:14:51 +01:00
Ian Campbell 2ac2a1c5d5 libxc: convert hvmop interfaces over to hypercall buffers
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
2010-10-22 15:14:51 +01:00
Ian Campbell 4513025a87 libxc: convert sysctl interfaces over to hypercall buffers
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
2010-10-22 15:14:51 +01:00
Juergen Gross 63c5ef9841 tools: cpupools: Support arbitrary numbers of physical cpus
To be able to support arbitrary numbers of physical cpus it was necessary to
include the size of cpumaps in the xc-interfaces for cpu pools.
These were:
  definition of xc_cpupoolinfo_t
  xc_cpupool_getinfo()
  xc_cpupool_freeinfo()
xc_cpupool_getinfo() and xc_cpupool_freeinfo() are changed to allocate the
needed buffer and return it.

Signed-off-by: juergen.gross@ts.fujitsu.com
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-21 18:32:56 +01:00
Ian Campbell 4f42a4e74f libxc: simplify lock profiling API
Current function has heavily overloaded semantics for the various
arguments. Separate out into more specific functions.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-18 17:37:50 +01:00
Ian Campbell 656ba9748a libxc: simplify performance counters API
Current function has heavily overloaded semantics for the various
arguments. Separate out into more specific functions.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-18 17:37:31 +01:00
Ian Campbell f5c808b428 libxc: use correct size of struct xen_mc
We want the size of the struct not the pointer (although rounding up
to page size in lock_pages probably saves us).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-18 16:53:04 +01:00
Ian Campbell e43181a5eb libxc: remove unnecessary double indirection from xc_readconsolering
The double indirection has been unnecessary since 9867:ec61a8c25429,
there is no possibility of the buffer being reallocated now.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-18 16:52:37 +01:00
Ian Campbell f114466a23 libxc: pass an xc_interface handle to page locking functions
Not actually used here but useful to confirm that a handle is passed
down to each location where it will be required once we switch to
hypercall buffers.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-18 16:43:58 +01:00
Ian Campbell 6993e9f5ce # HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1282671421 -3600
# Node ID d1dd29a470ef1b9d2c77478a123326036dfe90bb
# Parent  d7a4adad9c328decbd384d87b23001aea8951b86
tools/libxc, tools/libelf: Relicense under LGPL v2.1

Relicense these two libraries under LGPL v2.1 only except where
individual files already included the "or later" provision.

Copyright holders have been contacted by Stephen Spector and have all
agreed this change.

Removed tools/libxc/ia64/aclinux.h since it appeared to be
unused. There is a separate, more up to date, copy in
xen/include/acpi/platform/aclinux.h which does appear to be used.

Clarify the license of MiniOS privcmd.h under the same terms as other
tools/include/xen-sys headers.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stephen Spector <stephen.spector@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-08-24 18:42:59 +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 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 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 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 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 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 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 51cf89ed5d x86 hvm: New hvm_op "set_mem_type" which allows marking ram page
ranges as ro, rw, or mmio_dm.

Signed-off-by: Trolle Selander <trolle.selander@eu.citrix.com>
2008-07-10 15:30:39 +01:00
Keir Fraser 7d03c1bec2 stubdom: add live migration support by having ioemu just notify the
hypervisor about memory changes.

The impact on disk performance is typically making it from 71.5MBps
down to 70.5Mbps during the live migration. The impact on network
performance is actually even hard to measure.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-06-30 09:57:27 +01:00
Keir Fraser 4fe64c6d1b shadow: track video RAM dirty bits
This adds a new HVM op that enables tracking dirty bits of a range of
video RAM.  The idea is to optimize just for the most common case
(only one guest mapping, with sometimes some temporary other
mappings), which permits to keep the overhead on shadow as low as
possible.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-05-02 15:08:27 +01:00
Keir Fraser ee41f1c835 Allow incremental access to hypervisor console log.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-29 12:56:27 +00:00
kfraser@localhost.localdomain 05cf544b87 xc_map_foreign_pages(), a convenient alternative to xc_map_foreign_batch()
xc_map_foreign_batch() can succeed partially.  It is awkward to use
when you're only interested in complete success.  Provide new
xc_map_foreign_pages() convenience function for that kind of use.
Also convert two obvious calls to use it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
2007-09-07 11:39:10 +01:00
kfraser@localhost.localdomain be259653f3 Extended the physinfo sysctl to export NUMA cpu_to_node topology info.
Print this in 'xm info'.
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-07-06 16:12:07 +01:00
Keir Fraser 41b3adc925 More getcpuinfo sysctl cleanup.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-06-27 21:43:43 +01:00
Steven Hand 3bc33badf2 Add new sysctl to return runtime information about physical CPU utilization.
Signed-off-by: Steven Hadn <steven@xensource.com>
2007-06-27 21:01:08 +01:00
kfraser@localhost.localdomain e1bc13a960 xm: New command 'debug-keys' to inject debug-key events into Xen.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-03-09 11:11:59 +00:00
kaf24@localhost.localdomain aacbdffaf8 Replace mlock() calls with lock_pages().
Signed-off-by: Russell Blaine <russell.blaine@sun.com>
2007-01-26 13:31:59 +00:00
kfraser@localhost.localdomain d46c9ce0d7 [HVM] Reworked interrupt distribution logic.
TODO:
 1. Fix IO-APIC ID to not conflict with LAPIC IDS.
 2. Fix i8259 device model (seems to work already though!).
 3. Add INTSRC overrides in MPBIOS and ACPI tables so
    that PCI legacy IRQ routing always ends up at an
    IO-APIC input with level trigger. Restricting link
    routing to {5,6,10,11} and setting overrides for all
    four of those would work.

Signed-off-by: Keir Fraser <keir@xensource.com>
2006-11-21 19:22:25 +00:00
kfraser@localhost.localdomain 25f5b0ff15 [HVM] Replace shared-memory PIC state with a set-irq-level hypercall.
This simplifies the IRQ logic significantly and avoids the bogus
hvm_pic_assist() on domain resume path.

There is more work to be done here. At least:
 1. set-irq-level should really be set-interrupt-wire-level. Wire
    state needs to be distinguished from PIC (in particular, PIC IRR)
    state.
 2. Hypercalls can be batched in qemu and pushed down in one
    multicall.

Signed-off-by: Keir Fraser <keir@xensource.com>
2006-11-07 13:13:52 +00:00