aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_private.h
Commit message (Collapse)AuthorAgeFilesLines
* libxc: match types of 'subject' and 'foreigndom' between struct xc_mmu and ↵Dario Faggioli2013-01-241-2/+2
| | | | | | | | | | | | | | | | | | | do_mmu_update In do_mmu_update() (in the hypervisor) the parameter 'foreigndom' is 'unsigned int' and both its high (bits 31-16) and low (bits 15-0) are parts utilised, as explained here: http://xenbits.xen.org/docs/unstable/hypercall/include,public,xen.h.html#Func_HYPERVISOR_mmu_update However, the actual parameter, i.e., the 'subject' field in struct xc_mmu is declared as domid_t, which typedef-s to uint16_t. This means we are never able to pass anything via the higher 16 bits of 'foreigndom', which in turns may cause the hypercall to fail when called on an actual foreign domain. 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>
* flask: Update flask_op hypercall structureDaniel De Graaf2012-02-061-0/+2
| | | | | | | | Instead of placing string parsing inside the hypervisor, use binary structures like other Xen hypercalls do. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* libxc: maintain a small, per-handle, cache of hypercall buffer memoryIan Campbell2011-02-011-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | Constantly m(un)locking memory can have significant overhead on systems with large numbers of CPUs. This was previously fixed by 20841:fbe8f32fa257 but this was dropped during the transition to hypercall buffers. Introduce a small cache of single page hypercall buffer allocations which can be resused to avoid this overhead. Add some statistics tracking to the hypercall buffer allocations. The cache size of 4 was chosen based on these statistics since they indicated that 2 pages was sufficient to satisfy all concurrent single page hypercall buffer allocations seen during "xl create", "xl shutdown" and "xl destroy" of both a PV and HVM guest therefore 4 pages should cover the majority of important cases. This fixes http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1719. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Reported-by: Zheng, Shaohui <shaohui.zheng@intel.com> Tested-by: Haitao Shan <maillists.shan@gmail.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: Do not use dom0 physmem as parameter to lzma decoderIan Jackson2011-01-281-3/+0
| | | | | | | | | | | | | | | | | | It's not clear why a userspace lzma decode would want to use that particular value, what bearing it has on anything or why it would assume it could use 1/3 of the total RAM in the system (potentially quite a large amount of RAM) as opposed to any other limit number. Instead, hardcode 32Mby. This reverts 22830:c80960244942, removes the xc_get_physmem/physmem function entirely, and replaces the expression at the call site with a fixed constant. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <Ian.Campbell@eu.citrix.com> Cc: Christoph Egger <Christoph.Egger@amd.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: break xc_get_physmem out into os-dependent filesChristoph Egger2011-01-271-0/+3
| | | | | | | | | | | NetBSD doesn't have sysconf(_SC_PHYS_PAGES). Factor physmem() out into os-dependent files and rename it to xc_get_physmem() so as not to pollute the namespace. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: osdep: Use XC_PAGE_{SHIFT,MASK}.Ian Campbell2010-12-031-2/+2
| | | | | | | Avoid dependency on xc_private.h Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: drop fd from xc_interfaceIan Campbell2010-12-031-1/+0
| | | | | | | | Transition to xc_osdep_handle is now complete and nothing uses (or should be using) it. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: add framework for abstracting access to dom0 OS hypervisor ↵Ian Campbell2010-12-031-16/+6
| | | | | | | | | | interfaces. This patch introduces the basic infrastructure and uses it for open and close operations on privcmd, evtchn and gnttab devices. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: convert gnttab interfaces to use an opaque handle typeIan Campbell2010-12-231-0/+4
| | | | | | | | | | | | | The xc_interface previously passed to xc_gnttab_* was only used for logging which can now be done via the xc_gnttab handle instead. This makes the interface consistent with the changes made to the main interface in 21483:779c0ef9682c. Also update QEMU_TAG to pull in the corresponding qemu change. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: convert evtchn interfaces to use an opaque handle typeIan Campbell2010-12-231-3/+12
| | | | | | | | | | | | This makes the interface consistent with the changes made to the main interface in 21483:779c0ef9682c. Also fix some references to "struct xc_interface" which should have been simply "xc_interface" in tools/xenpaging, and update QEMU_TAG to pull in the corresponding qemu change. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: allow caller to specify no re-entrancy protection when opening the ↵Ian Campbell2010-12-021-0/+1
| | | | | | | | | | | interface Used by language bindings which provide their own re-entrancy which conflicts with pthreads. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* libxc: rename safe_strerror to xc_strerror and pass in an XC handle for ↵Ian Campbell2010-12-021-2/+1
| | | | | | | | | | future use. Make the function public since I have future patches which depend on this. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* libxc: finalise transition to hypercall buffers.Ian Campbell2010-10-221-8/+0
| | | | | | | | | | | | | | | | | | | | | 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>
* libxc: convert physdevop interface over to hypercall buffersIan Campbell2010-10-221-6/+5
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: convert sysctl interfaces over to hypercall buffersIan Campbell2010-10-221-8/+7
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: convert domctl interfaces over to hypercall buffersIan Campbell2010-10-221-7/+7
| | | | | | | (defer save/restore and shadow related interfaces til a later patch) Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: convert xc_version over to hypercall buffersIan Campbell2010-10-221-2/+3
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: infrastructure for hypercall safe data buffers.Ian Campbell2010-10-261-0/+58
| | | | | | | | (Modified version of this patch, with updated #includes in xc_hcall_buf.c to fix stubdomain build.) Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: make xc_memory_op library privateIan Campbell2010-10-181-0/+2
| | | | | | | | | | | | | | | Now that all XENMEM_* callers go via an op specific function make xc_memory_op private to libxc (and rename to do_memory_op for consistency with other private functions). Also change the interface to take a size parameter so that do_memory_op knows how much memory to lock for the top-level argument, removing some of the introspection. [ Compatibility note: this breaks qemu-xen before 706bc8c588cb ] Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: pass an xc_interface handle to page locking functionsIan Campbell2010-10-181-10/+10
| | | | | | | | | 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>
* libxc: flask: use (un)lock pages rather than open coding m(un)lock.Ian Campbell2010-10-181-7/+0
| | | | | | | Allows us to do away with safe_unlock and merge into unlock_pages. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* # HG changeset patchIan Campbell2010-08-241-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | # 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>
* libxc: save/restore error handling fixesKeir Fraser2010-05-281-2/+2
| | | | | | | | | | | | | | * 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>
* libxc: Use new DBGPRINTF for a few debugging output messagesKeir Fraser2010-05-281-0/+1
| | | | | | | 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>
* libxc: eliminate static variables, use xentoollog; API changeKeir Fraser2010-05-281-39/+49
| | | | | | | | | | | | | | | | | | | | 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>
* cpupool: Control interface should be a sysctl rather than a domctl.Keir Fraser2010-05-041-13/+0
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* cpupools [2/6]: libxc changesKeir Fraser2010-04-211-0/+13
| | | | Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
* libxc: New hcall_buf_{prep,release} pre-mlock interfaceKeir Fraser2010-01-221-20/+26
| | | | | | | | | | 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>
* x86: add and use XEN_DOMCTL_getpageframeinfo3Keir Fraser2010-01-131-0/+3
| | | | | | | | | | | | | | | | | | 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>
* x86_64: allow more vCPU-s per guestKeir Fraser2009-06-181-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* libxc: Define xc_ffs{8,16,32,64} functions. Use them.Keir Fraser2009-01-061-0/+5
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* libxc: Fix xc_pm.c build by avoiding bogus header includes.Keir Fraser2008-12-111-0/+3
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* libxc: Clean up xc_map_foreign_ranges() interface to hide theKeir Fraser2008-07-231-2/+3
| | | | | | | underlying mmap() invocation. From: Christoph Egger <Christoph.Egger@amd.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* libxc: The following patch replace the libxc interface to useKeir Fraser2008-06-191-2/+2
| | | | | | | vcpu_guest_context_any_t (which is both 32 and 64 bits) instead of vcpu_guest_context_t. Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
* MSI 2/6: change the pirq to be per-domainKeir Fraser2008-05-011-0/+30
| | | | | Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com> Signed-off-by: Shan Haitao <haitao.shan@intel.com>
* libxc: Consolidate read()/write() syscall wrappers to read/write anKeir Fraser2007-11-111-0/+4
| | | | | | | exact number of bytes. The consolidated versions are more watertight than the various versions previously distributed around the library source code. Signed-off-by: Keir Fraser <keir@xensource.com>
* libxc: Clarify xc_mmu interface and make it private.kfraser@localhost.localdomain2007-04-061-0/+12
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* libxc: Quieten the discard_file_cache() function. Preserve errnokfraser@localhost.localdomain2007-02-281-1/+1
| | | | | | across it. No longer make calls to the function dependent on 'non-live save/restore': it's not a good test of whether the fd is a socket. Signed-off-by: Keir Fraser <keir@xensource.com>
* Reduce impact of saving/restoring/dumping large domains on Dom0 memoryKeir Fraser2007-02-241-0/+10
| | | | | | | usage by means of fadvise64() to tell the OS to discard the cache pages used for the save/dump file. Signed-off-by: Simon Graham <Simon.Graham@stratus.com>
* [LIBXC] Convert between byte-based and 64-bit bitmap arrays. Use thiskfraser@localhost.localdomain2007-01-191-0/+3
| | | | | | for conversion of the domctl_cpumap. Original patch from Jimi Xenidis <jimix@watson.ibm.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* [LIBXC] Clean up use of sterror(). Define a thread-safekfraser@localhost.localdomain2006-12-081-1/+2
| | | | | | version which uses strerror_r(), and tries to cope with the POSIX and GNU versions of that function. Signed-off-by: Keir Fraser <keir@xensource.com>
* Fix PERROR.Ewan Mellor2006-12-071-1/+1
| | | | Signed-off-by: Ewan Mellor <ewan@xensource.com>
* [LIBXC] Add an error reporting API to the libxc library.kfraser@localhost.localdomain2006-12-071-14/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - An 'xc_error' struct is used to pass around error details. Currently contains two members 'code' an enumeration of error types, and 'message' a free text description of the specific problem. - The xc_get_last_error() method returns a const pointer to the internal instance of this struct manged by libxc. By returning a const pointer we can add extra members to the end of the struct at any time without worrying about ABI of callers. This will let us provide more fine-grained info if needed in the future. - The xc_error instance is statically defined inside libxc and marked __thread. This ensures that errors are recorded per-thread, and that when dealing with errors we never need to call malloc - all storage needed is statically allocated. - The xc_clear_last_error() method resets any currently recorded error details - The xc_error_code_to_desc() method converts the integer error code into a generic user facing messsage. eg "Invalid kernel". Together with the 'message' field from xc_error, this provides the user visible feedback. eg "Invalid kernel: Non PAE-kernel on PAE host." - A callback can be registered with xc_set_error_handler to receive notification whenever an error is recorded, rather than querying for error details after the fact with xc_get_last_error - If built with -DDEBUG set, a default error handler will be registered which calls fprintf(stderr), thus maintaining current behaviour of logging errors to stderr during developer builds. - The python binding for libxc is updated to use xc_get_last_error to pull out error details whenever appropriate, instead of returning info based on 'errno' - The xc_set_error method is private to libxc internals, and is used for setting error details - The ERROR and PERROR macros have been updated to call xc_set_error automatically specifying XC_INTERNAL_ERROR as the error code. This gives a generic error report for all current failure points - Some uses of the ERROR macro have been replaced with explicit calls to xc_set_error to enable finer grained error reporting. In particular the code dealing with invalid kernel types uses this to report about PAE/architecture/wordsize mismatches The patch has been tested by calling xm create against a varietry of config files defining invalid kernels of various kinds. It has also been tested with libvirt talking to xend. In both cases the error messages were propagated all the way back up the stack. There is only one place where I need to do further work. The suspend & restore APIs in Xend invoke external helper programs rather than calling libxc directly. This means that error details are essentially lost. Since there is already code in XenD which scans STDERR from these programs I will investigate adapting this to extract actual error messages from these helpers. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* [XEN] Remove VGCF_hvm_guest, replace with XEN_DOMINF_hvm_guest.kfraser@localhost.localdomain2006-11-031-0/+5
| | | | | | Rename DOMFLAGS_* to XEN_DOMINF_*. Clean up tools to deal with flags changes. Signed-off-by: Keir Fraser <keir@xensource.com>
* [SOLARIS] Don't mlock() hypercall buffers.kfraser@localhost.localdomain2006-10-231-4/+7
| | | | | | | On solaris mlock requires a page aligned address and mlock doesn't ensure the pages won't minor page fault. Signed-off-by: Mark Johnson <mark.johnson@sun.com>
* Remove ERR() macro from libxc. Use ERROR/PERROR as appropriate.kfraser@localhost.localdomain2006-10-171-5/+0
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* [SOLARIS] Don't build ptrace code on Solaris.kfraser@localhost.localdomain2006-10-171-0/+3
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* Replace dom0_ops hypercall with three new hypercalls:kfraser@localhost.localdomain2006-08-251-11/+42
| | | | | | | | | | | | | | | | | | | | | | 1. platform_op -- used by dom0 kernel to perform actions on the hardware platform (e.g., MTRR access, microcode update, platform quirks, ...) 2. domctl -- used by management tools to control a specified domain 3. sysctl -- used by management tools for system-wide actions Benefits include more sensible factoring of actions to hypercalls. Also allows tool compatibility to be tracked separately from the dom0 kernel. The assumption is that it will be easier to replace libxenctrl, libxenguest and Xen as a matched set if the dom0 kernel does not need to be replaced too (e.g., because that would require vendor revalidation). From here on we hope to maintain dom0 kernel compatibility. This promise is not extended to tool compatibility beyond the existing guarantee that compatibility will not be broken within a three-level stable release [3.0.2, 3.0.3, etc.]. Signed-off-by: Keir Fraser <keir@xensource.com>
* [LIBXC] Convert all printf/fprintf uses to use a macro instead.kaf24@firebug.cl.cam.ac.uk2006-06-071-13/+38
| | | | | | | Thus all can be disabled at compile time. It would be easy to make enabling/disabling a run-time option too. Signed-off-by: Keir Fraser <keir@xensource.com>
* Move Linux-specific privcmd code into private libxc implementations.kaf24@firebug.cl.cam.ac.uk2006-05-021-33/+4
| | | | | | | | | Make header path for kernel's privcmd/evtchn headers generic. Remove pointless xi_*() interface that was using private libxc interfaces. Signed-off-by: John Levon <john.levon@sun.com>