Begin to disentangle libxenctrl and provide some stable libraries
Subsystems (2)
Re: [Qemu-devel] [PATCH QEMU-XEN v4 9/9] xen: make it possible to build without the Xen PV domain builder
In reply to Stefano StabelliniQuoted 30 lines · Stefano Stabellini
Quoted 29 lines · Ian Campbell
Quoted 15 lines · Stefano Stabellini
(quoted diff) +0
-0@@ -2113,6 +2117,15 @@ if test "$xen_pci_passthrough" != "no"; thenconfigure if test "$xen_pci_passthrough" != "no"; then · line 2127
Quoted 11 lines
fi
ficonfigure +8
-0+if test "$xen_pv_domain_build" != "no"; then + if test "$xen_pv_domain_build" = "yes" && + test "$xen" != "yes"; then + error_exit "User requested Xen PV domain builder support" \ + "which requires Xen support." + fi + xen_pv_domain_build=no +fiCan we simplify this to:
Quoted 8 lines
if test "$xen_pv_domain_build" = "yes" && test "$xen" != "yes"; then error_exit "User requested Xen PV domain builder support" \ "which requires Xen support." fi fiand move xen_pv_domain_build=no at the beginning of the file?
I think so, I hadn't noticed the precedent for doing so further up in the
file.
Quoted 8 lines
Quoted 5 lines
Just to check, is this still your preference after my earlier reply-to -self
explaining why the code above is utter rubbish and proposing a different
simplified version?The simplified check is OK, but I would still prefer if you moved xen_pv_domain_build=no at the beginning of the file.
Ack, I'll do that then.
Quoted 32 lines
Quoted 32 lines
(quoted diff) +0
-0@@ -46,13 +43,22 @@ static void xen_init_pv(MachineState *machine)Quoted 18 lines
Quoted 18 lines
case XEN_ATTACH: /* nothing to do, xend handles everything */ break;hw/xenpv/xen_machine_pv.c +9
-1-case XEN_CREATE : +case XEN_CREATE : { +#ifdef CONFIG_XEN_PV_DOMAIN_BUILD +const char *kernel_filename = machine->kernel_filename; +const char *kernel_cmdline = machine->kernel_cmdline; +const char *initrd_filename = machine->initrd_filename;if (xen_domain_build_pv (kernel_filename, initrd_filename, kernel_cmdline) <0 ) {fprintf (stderr,"xen pv domain creation failed\n" );exit (1 ); } +#else +fprintf (stderr,"xen pv domain creation not supported\n" ); +exit (1 ); +#endif Quoted 8 lines
Quoted 5 lines
break; + } case XEN_EMULATE: fprintf(stderr, "xen emulation not implemented (yet)\n"); exit(1);Please add a default case with an error and place the
XEN_CREATEentirely within the ifdefCONFIG_XEN_PV_DOMAIN_BUILD.Will do.
Re: [PATCH QEMU-XEN v4 7/9] xen: Use stable library interfaces when they are available.
In reply to Stefano StabelliniQuoted 8 lines · Stefano Stabellini
Quoted 8 lines
include/hw/xen/xen_common.h +0
-0@@ -6,6 +6,17 @@#include <stddef.h> #include <inttypes.h>
Quoted 15 lines
include/hw/xen/xen_common.h line 18
Quoted 10 lines
include/hw/xen/xen_common.h +10
-0+#if CONFIG_XEN_CTRL_INTERFACE_VERSION >=470 +/* +* If we have new enough libxenctrl then we do not want/need these compat +* interfaces, despite what the user supplied cflags might say. They +* must be undefined before including xenctrl.h +*/ +#undef XC_WANT_COMPAT_EVTCHN_API +#undef XC_WANT_COMPAT_GNTTAB_API +#undef XC_WANT_COMPAT_MAP_FOREIGN_API +#endif Can we always do the #under given that earlier libxenctrl versions will simple ignore them? I am asking because I would prefer to avoid introducing another ifdef here outside the sequence if ifdefs already present below.
Ah yes, we can indeed.
Ian.
Re: [Qemu-devel] [PATCH QEMU-XEN v4 7/9] xen: Use stable library interfaces when they are available.
In reply to Stefano StabelliniQuoted 8 lines · Stefano Stabellini
Quoted 8 lines
include/hw/xen/xen_common.h +0
-0@@ -6,6 +6,17 @@#include <stddef.h> #include <inttypes.h>
Quoted 15 lines
include/hw/xen/xen_common.h line 18
Quoted 10 lines
include/hw/xen/xen_common.h +10
-0+#if CONFIG_XEN_CTRL_INTERFACE_VERSION >=470 +/* +* If we have new enough libxenctrl then we do not want/need these compat +* interfaces, despite what the user supplied cflags might say. They +* must be undefined before including xenctrl.h +*/ +#undef XC_WANT_COMPAT_EVTCHN_API +#undef XC_WANT_COMPAT_GNTTAB_API +#undef XC_WANT_COMPAT_MAP_FOREIGN_API +#endif Can we always do the #under given that earlier libxenctrl versions will simple ignore them? I am asking because I would prefer to avoid introducing another ifdef here outside the sequence if ifdefs already present below.
Ah yes, we can indeed.
Ian.
Re: [PATCH QEMU-XEN v4 3/9] xen: Switch to libxengnttab interface for compat shims.
In reply to Stefano StabelliniQuoted 20 lines · Stefano Stabellini
Quoted 19 lines · Ian Campbell
In Xen 4.7 we are refactoring parts libxenctrl into a number of separate libraries which will provide backward and forward API and ABI compatiblity.
One such library will be libxengnttab which provides access to grant tables.
In preparation for this switch the compatibility layer in
xen_common.h(which support building with older versions of Xen) to use what will be the new library API. This means that the gnttab shim will disappear for versions of Xen which include libxengnttab.To simplify things for the <= 4.0.0 support we wrap the int fd in a malloc(sizeof int) such that the handle is always a pointer. This leads to less typedef headaches and the need for
XC_HANDLER_INITIAL_VALUEetc for these interfaces.Build tested with 4.0 and 4.5.
Quoted 8 lines
Quoted 4 lines
Note that this patch does not add any support for actually using libxengnttab, it just adjusts the existing shims.
Signed-off-by Ian Campbell <[email protected]>The patch looks OK but doesn't apply cleanly to master, please rebase. After fixing it up, it fails my 4.0 build test (I probably made a mistake).
There was a new xc_gnttab_munmap which needed converting.
BTW, contrary to what every single commit message here says I'm actually build testing on: xen with my other patches from this mega series, 4.6, 4.1, 4.0, 4.5, 4.4, 4.3, 4.2 and on my dev xen with pvbuilder forced to on. I'm just going to drop all these "Build tested.." from the commit messages.
(the strange version ordering is so I test the different API classes first and fail early on problems and then fill in the gaps).
Ian.
Re: [Qemu-devel] [PATCH QEMU-XEN v4 3/9] xen: Switch to libxengnttab interface for compat shims.
In reply to Stefano StabelliniQuoted 20 lines · Stefano Stabellini
Quoted 19 lines · Ian Campbell
In Xen 4.7 we are refactoring parts libxenctrl into a number of separate libraries which will provide backward and forward API and ABI compatiblity.
One such library will be libxengnttab which provides access to grant tables.
In preparation for this switch the compatibility layer in
xen_common.h(which support building with older versions of Xen) to use what will be the new library API. This means that the gnttab shim will disappear for versions of Xen which include libxengnttab.To simplify things for the <= 4.0.0 support we wrap the int fd in a malloc(sizeof int) such that the handle is always a pointer. This leads to less typedef headaches and the need for
XC_HANDLER_INITIAL_VALUEetc for these interfaces.Build tested with 4.0 and 4.5.
Quoted 8 lines
Quoted 4 lines
Note that this patch does not add any support for actually using libxengnttab, it just adjusts the existing shims.
Signed-off-by Ian Campbell <[email protected]>The patch looks OK but doesn't apply cleanly to master, please rebase. After fixing it up, it fails my 4.0 build test (I probably made a mistake).
There was a new xc_gnttab_munmap which needed converting.
BTW, contrary to what every single commit message here says I'm actually build testing on: xen with my other patches from this mega series, 4.6, 4.1, 4.0, 4.5, 4.4, 4.3, 4.2 and on my dev xen with pvbuilder forced to on. I'm just going to drop all these "Build tested.." from the commit messages.
(the strange version ordering is so I test the different API classes first and fail early on problems and then fill in the gaps).
Ian.
Quoted 16 lines · Ian Campbell
We intend to stabilise some parts of the libxenctrl interface by splitting out some functionality into separate stable libraries.
This is the mini-os part of the first phase of that change.
This mail is (or is intended to be) a reply to a "0/<VARIOUS>" super-intro mail covering all of the related patch series and which contains more details.
Ian Campbell (5):
mini-os: Include libxentoollog with libxc
mini-os: Include libxenevtchn with libxc
mini-os: Include libxengnttab with libxc
mini-os: Include libxencall with libxc
mini-os: Include libxenforeignmemory with libxc
Quoted 2 lines
Makefile | 5 +++++ 1 file changed, 5 insertions(+)
Quoted 3 lines
Signature · 2 lines
-- 2.1.4
Re: [PATCH XEN v4 01/23] tools/Rules.mk: Properly handle libraries with recursive dependencies.
In reply to Ian CampbellQuoted 7 lines · Ian Campbell
In tree libraries which link against other in tree libraries in a way which is opaque to their callers need special handling, specifically correct use of -Wl,-rpath-link for the recusively used libraries.
Currently this is rather simple, but up coming changes are going to introduce transitive dependencies more than 1 step deep.
Quoted 8 lines
Introduce a SHDEPS idiom to contain all the recursive deps for a library and include those in both LDLIBS (for linking) and SHLIB (for recursive uses).
Try and document the whole thing.
Signed-off-by Ian Campbell <[email protected]>Acked-by Ian Jackson <[email protected]>
tools/Rules.mk INSTALL_SHLIB = : install-shlib-unsupported-fail · line 87
Quoted 8 lines
CFLAGS_libxenguest= -I$(XEN_LIBXC)/include $(CFLAGS_xeninclude)tools/Rules.mk +3
-2-LDLIBS_libxenguest = $(XEN_LIBXC)/libxenguest$(libextension) -SHLIB_libxenguest = -Wl,-rpath-link=L$(XEN_LIBXC) +SHDEPS_libxenguest = +LDLIBS_libxenguest = $(SHDEPS_libxenguest) $(XEN_LIBXC)/libxenguest$(libextension) +SHLIB_libxenguest = $(SHDEPS_libxenguest) -Wl,-rpath-link=L$(XEN_LIBXC)
There is an extra "L" preceding XEN_LIBXC. Jan spotted and fixed it in one of his patch.
Wei.
Re: [PATCH XEN v4 02/23] tools: Refactor "xentoollog" into its own library
In reply to Ian CampbellQuoted 13 lines · Ian Campbell
In attempting to disaggregate libxenctrl I found that many of the pieces were going to want access to this library, so split it out (as it probably should always have been).
Various build adjustments are needed. In particular things which use xtl_* themselves now need to explicity link against the library.
This has a nice side effect which is that users of libxl no longer need to link against libxenctrl just to create a logger, which was counter to the principal that applications using libxl shouldn't be required to look behind the curtain. This means that xl no longer links against libxenctrl.
Quoted 6 lines
The new library uses a version script to ensure that only expected symbols are exported and to version them such that ABI guarantees can be kept in the future.
Signed-off-by Ian Campbell <[email protected]>Acked-by Ian Jackson <[email protected]>
Re: [PATCH XEN v4 03/23] tools/libxc: Remove osdep indirection for xc_evtchn
In reply to Ian CampbellQuoted 7 lines · Ian Campbell
The alternative backend (a xen-api/xapi shim) is no longer around and so this stuff is now just baggage which is getting in the way of refactoring libxenctrl.
Note that the intention is to move this into a separate library shortly.
Quoted 7 lines
Nested virt probably suffices for this use case now.
One incorrect instance of using
xc_interfacewherexc_evtchn(in ocaml stubs) is removed, this used to work because they were typedefs to the same struct, but is no longer permitted.Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 04/23] tools: Refactor /dev/xen/evtchn wrappers into libxenevtchn.
In reply to Ian CampbellQuoted 31 lines · Ian Campbell
libxenevtchn will provide a stable API and ABI for accessing the evtchn device.
The functions are moved into the xenevtchn namespace to make a clean break from libxc and avoid ambiguity regarding which interfaces are stable.
All in-tree users are updated to use the new names.
Upon request (via #define
XC_WANT_COMPAT_EVTCHN_API) libxenctrl will provide a compat API for the old names. This is used by qemu-xen for the time being. qemu-xen-traditional is updated in lockstep.This leaves a few event channel related functions which go via privcmd (EVTCHNOP) rather than ioctls on the
/dev/xen/evtchndevice in libxenctrl. Specifically:-
xc_evtchn_alloc_unbound
-xc_evtchn_reset
-xc_evtchn_statusNote that xc_evtchn_alloc_unbound's functionality is also provided by
xenevtchn_bind_unbound_port()(néexc_evtchn_bind_unbound_port) and is probably redundant.These functions do not appear to be needed by qemu-dm, qemu-pv (provision of device model to HVM guests and PV backends respectively) or by libvchan suggesting they are not needed by non-toolstack uses of event channels. QEMU does use these in
hw/xenpv/xen_domainbuild.cbut that is a "toolstack use".
Quoted 5 lines
The new library uses a version script to ensure that only expected symbols are exported and to version them such that ABI guarantees can be kept in the future.
Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 05/23] tools: Arrange to check public headers for ANSI compatiblity
In reply to Ian CampbellQuoted 4 lines · Ian Campbell
Using the same rune as we use for the Xen public headers, except we do not need
stdint.hhere and we use -pedantic too.Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 06/23] tools/libxc: Remove osdep indirection for xc_gnt{shr, tab}
In reply to Ian CampbellQuoted 14 lines · Ian Campbell
The alternative backend (a xen-api/xapi shim) is no longer around and so this stuff is now just baggage which is getting in the way of refactoring libxenctrl.
Nested virt probably suffices for this use case now.
It is now necessary to provide explicit versions of things for platforms which do not implement this functionality, since the osdep dispatcher cannot fulfil this need any more. These are provided by appropriate xc_nognt???.c files which are compiled and linked on the appropriate platforms. In them open and close return failure and everything else aborts, since if open fails they should never be called.
Quoted 1 line
Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 07/23] tools: Refactor /dev/xen/gnt{dev, shr} wrappers into libxengnttab.
In reply to Ian CampbellQuoted 10 lines · Ian Campbell
libxengnttab will provide a stable API and ABI for accessing the grant table devices.
The functions are moved into the xengnt{tab,shr} namespace to make a clean break from libxc and avoid ambiguity regarding which interfaces are stable.
XXX consider combining into a single namespace (i.e. with
xengnttab_handlehaving two open fd's in it on Linux)
This?
Wei.
Re: [PATCH XEN v4 08/23] tools/libxc: Remove osdep indirection for privcmd
In reply to Ian CampbellQuoted 13 lines · Ian Campbell
The alternative backend (a xen-api/xapi shim) is no longer around and so this stuff is now just baggage which is getting in the way of refactoring libxenctrl.
Nested virt probably suffices for this use case now.
This was the last component of the osdep infrastructure, so all the dynamic loading etc stuff all falls away too.
As part of this I was forced to investigate the twisty xc_map_foreign_* maze, which I have added to the toolstack-library-apis doc in the hopes of doing something sensible.
Quoted 8 lines
NetBSD and Solaris now call
xc_map_foreign_bulk_compatdirectly from theirxc_map_foreign_bulk, which could have been achieved by using some ifdefs around a renamed function. This will fall out in the wash when these functions move to their own library.Signed-off-by Ian Campbell <[email protected]>Acked-by David Scott <[email protected]>Cc David Scott <[email protected]>
Re: [PATCH XEN v4 09/23] tools: Refactor hypercall calling wrappers into libxencall.
In reply to Ian CampbellQuoted 19 lines · Ian Campbell
libxencall will provide a stable API and ABI for calling hypercalls (although those hypercalls themselves may not have a stable API). As well as the hypercall buffer infrastructure needed in order to safely provide pointer arguments to hypercalls.
libxenctrl encapsulates a instance of this interface, so users of that library are not currently subjected to any actual changes. However all hypercalls made internally by libxc now use the correct interface. It is expected that most users of this library will be other libraries providing a higher level interface, rather than applications directly.
Only the basic functionality to allocate hypercall safe memory is moved, the type safe stuff and bounce buffers remain in libxc.
Note that the functionality to map foreign pages using privcmd is not yet moved, meaning that an
xc_interfacewill now contain two open privcmd file descriptors. Foreign memory mapping is logically separate functionality and will be moved into its own library.
Quoted 5 lines
The new library uses a version script to ensure that only expected symbols are exported and to version them such that ABI guarantees can be kept in the future.
Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 10/23] tools/libxc: drop xc_map_foreign_bulk_compat wrappers
In reply to Ian CampbellQuoted 4 lines · Ian Campbell
On Solaris and NetBSD
xc_map_foreign_bulkis implemented by callingxc_map_foreign_bulk_compatandxc_map_foreign_bulk_compatis exposed as a symbol by libxenctrl.so.
Quoted 8 lines
Remove these wrappers and turn the compat function into the real thing surrounded by the appropriate ifdef.
As this is a compat function all new ports should instead implement
xc_map_foreign_bulkproperly, hence the ifdef should never be expanded.Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 11/23] tools: Remove xc_map_foreign_batch
In reply to Ian CampbellQuoted 9 lines · Ian Campbell
It can trivially be replaced by
xc_map_foreign_bulkwhich is the interface I want to move to going forward. All in tree users are trivially converted by supplying the appropriate error array and adjusting the what error handling exists (which in many cases is not much).This reduces the twist maze of xc_map_foreign_* by one, which will be useful when trying to come up with an underlying stable interface.
Quoted 8 lines
NetBSD and Solaris implemented
xc_map_foreign_bulkin terms ofxc_map_foreign_batchvia a compat layer, soxc_map_foreign_batchbecomes an internal osdep for them. New OS ports should always implementxc_map_foreign_bulkinstead.Signed-off-by Ian Campbell <[email protected]>Acked-by George Dunlap <[email protected]>Cc George Dunlap <[email protected]>
Re: [PATCH XEN v4 12/23] tools: Implement xc_map_foreign_range(s) in terms of common helper
In reply to Ian CampbellQuoted 9 lines · Ian Campbell
Both Linux and FreeBSD already implemented these functions using identical helpers based on
xc_map_foreign_pages. Make one copy of these common helpers and switch all OSes to use them, even those which previously had a specific lower level implementation of this functionality.This is makes two fewer low level interfaces to think about.
Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 13/23] tools: Refactor foreign memory mapping into libxenforeignmemory
In reply to Ian CampbellQuoted 8 lines · Ian Campbell
libxenforeignmemory will provide a stable API and ABI for mapping foreign domain memory (subject to appropriate privileges).
The new library exposes an interface equivalent to
xc_map_foreign_memory_bulk, which all the other xc_map_foreign_memory_* functions (which remain in libxc) are implemented in terms of.
Quoted 7 lines
Upon request (via #define
XC_WANT_COMPAT_MAP_FOREIGN_API) libxenctrl will provide a compat API for the old names. This is used by qemu-xen and qemu-trad as well as various in tree things (which required de-dupping various #includes in some too to get the #define before the first).Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 14/23] tools: foreignmemory: provide xenforeignmemory_unmap.
In reply to Ian CampbellQuoted 11 lines · Ian Campbell
And require it be used instead of direct munmap.
This will allow e.g. Valgrind hooks to help track incorrect use of foreign mappings.
Switch all uses of
xenforeignmemory_mapto usexenforeignmemory_unmap, not that foreign mappings via the libxc compat xc_map_foreign_* interface will not take advantage of this and will need converting.Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 15/23] foreignmemory: use size_t for size arguments.
In reply to Ian CampbellQuoted 3 lines · Ian Campbell
Surprisingly it appears no callers need updating.
Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 16/23] tools/libs/evtchn: Review and update doc comments.
In reply to Ian CampbellQuoted 5 lines · Ian Campbell
Remove the reference to pre-4.1, since this is now a new library.
Fixup references to xc.
Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 17/23] tools/libs: Clean up hard tabs.
In reply to Ian CampbellQuoted 6 lines · Ian Campbell
These were wrong in the context of libxc before this code was extracted, clean them up.
Also add some emacs magic blocks
Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 18/23] tools/libs/gnttab: Review and update doc comments.
In reply to Ian CampbellQuoted 8 lines · Ian Campbell
Remove some stray xc references.
While I'm not convinced by javadoc/doxygen cause the existing comments which appear to use that syntax to have the appropriate /** marker.
Also fix a typo in a code comment.
Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 19/23] tools/libs/call: Update some log messages to not refer to xc.
In reply to Ian CampbellQuoted 1 line · Ian Campbell
Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 20/23] tools/libs/call: Avoid xc_memalign in netbsd and solaris backends
In reply to Ian CampbellQuoted 4 lines · Ian Campbell
These are already arch specific, so just use the appropriate interfaces (as determined by looking at the
xc_memalignbackend).Signed-off-by Ian Campbell <[email protected]>
Quoted 35 lines
--- tools/libs/call/netbsd.c | 4 ++-- tools/libs/call/solaris.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)tools/libs/call/netbsd.c +2
-2@@ -74,8 +74,8 @@ void *osdep_alloc_hypercall_buffer(xencall_handle *xcall, unsigned int npages)size_t size = npages *XC_PAGE_SIZE ;void *p; - p =xc_memalign (xcall,XC_PAGE_SIZE , size); -if (!p) + ret =posix_memalign (&p,XC_PAGE_SIZE , size); +if ( ret !=0 || !p )return NULL ;if (mlock (p, size) <0 )tools/libs/call/solaris.c +1
-1@@ -71,7 +71,7 @@ int osdep_xencall_close(xencall_handle *xcall)void *osdep_alloc_hypercall_buffer (xencall_handle *xcall,unsigned int npages) { -return xc_memalign (xcall,XC_PAGE_SIZE , npages *XC_PAGE_SIZE ); +return memalign (XC_PAGE_SIZE , npages *XC_PAGE_SIZE ); } void osdep_free_hypercall_buffer(xencall_handle *xcall, void *ptr,Signature · 1 line
2.1.4
Re: [PATCH XEN v4 21/23] tools/libs/foreignmemory: Mention restrictions on fork in docs.
In reply to Ian CampbellQuoted 1 line · Ian Campbell
Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 22/23] tools: Update CFLAGS for qemu-xen to allow it to use new libraries
In reply to Ian CampbellQuoted 5 lines · Ian Campbell
This means adding -L for libxen{evtchn,gnttab,foreignmemory} so that it can link them directly (rather than using the libxenctrl compat layer exposed via -rpath-link). Also add -I for libxenforeignmemory.
Signed-off-by Ian Campbell <[email protected]>
Re: [PATCH XEN v4 01/23] tools/Rules.mk: Properly handle libraries with recursive dependencies.
In reply to Wei LiuQuoted 20 lines · Wei Liu
Quoted 7 lines · Ian Campbell
In tree libraries which link against other in tree libraries in a way which is opaque to their callers need special handling, specifically correct use of -Wl,-rpath-link for the recusively used libraries.
Currently this is rather simple, but up coming changes are going to introduce transitive dependencies more than 1 step deep.
Quoted 8 lines
Introduce a SHDEPS idiom to contain all the recursive deps for a library and include those in both LDLIBS (for linking) and SHLIB (for recursive uses).
Try and document the whole thing.
Signed-off-by Ian Campbell <[email protected]>Acked-by Ian Jackson <[email protected]>Acked-by Wei Liu <[email protected]>Quoted 1 line
Quoted 12 lines
Review
Quoted 9 lines
CFLAGS_libxenguest= -I$(XEN_LIBXC)/include $(CFLAGS_xeninclude)tools/Rules.mk +2
-2-LDLIBS_libxenguest = $(XEN_LIBXC)/libxenguest$(libextension) -SHLIB_libxenguest = -Wl,-rpath-link=L$(XEN_LIBXC) +SHDEPS_libxenguest = +LDLIBS_libxenguest = $(SHDEPS_libxenguest)$(XEN_LIBXC)/libxenguest$(libextension)
(quoted diff) +1
-1+SHLIB_libxenguest = $(SHDEPS_libxenguest) -Wl,-rpath -link=L$(XEN_LIBXC)There is an extra "L" preceding
XEN_LIBXC. Jan spotted and fixed it in one of his patch.
Gah, I just replied to Jan claiming to have (inadvertently) spotted this, but I didn't do so at all! Oh well..
Re: [PATCH XEN v4 07/23] tools: Refactor /dev/xen/gnt{dev, shr} wrappers into libxengnttab.
In reply to Wei LiuQuoted 8 lines · Wei Liu
Quoted 7 lines · Ian Campbell
libxengnttab will provide a stable API and ABI for accessing the grant table devices.
The functions are moved into the xengnt{tab,shr} namespace to make a clean break from libxc and avoid ambiguity regarding which interfaces are stable.
Quoted 5 lines
Quoted 3 lines
XXX consider combining into a single namespace (i.e. with
xengnttab_handlehaving two open fd's in it on Linux)This?
Currently there are two separate interfaces (i.e. 2x_open, 2x handle types, 2x sets of functions for using the handle, 2x namespaces, etc) in this library corresponding to two underlying devices in /dev/xen, one of which is for utilising grant references which you have been given (gntdev), the other of which is for allocating suitable memory for granting and creating grants of it to give away to others (gntshr).
Only Linux and mini-os implement gntshr today, I think.
AFAIK most consumers (e.g. qemu's pv backends, or userspace pv backends generally) are only using the first (consuming grants). The only user of gntshr I know of is libvchan, but in general any userspace frontend would likely need this functionality.
There are three possibilities here for the stable library interface:
* Do nothing, keep it as two interfaces in one library.
* Split into separate libgntdev and libgntshr libraries.
* Unify the two APIs such that a single handle actually contains two fd's and functions are all in the same namespace etc and just the correct underlying fd associated with the op.
The comment is wondering if we should do the third, I hadn't thought of the middle one at the time.
Right now my preference is towards the first, the implementation of which is "delete the XXX comment".
The downside of not merging is that if some new OS port comes along which has gntdev and gntshr in a single device that the applications then still have to open and manage two handles and updating the ABI to unify them later would be a pain.
I'm inclined towards lazily thinking that having two handles is not such a big deal, even on an OS where the underlying implementation is such that they contain "redundant" file handles.
Ian.
I've just sent out v5. Anyone got any thoughts on how to proceed with qemu- xen?
Quoted 125 lines · Ian Campbell
(Trimming CCs a bit)
Quoted 1 line · Ian Campbell
[...]
Quoted 4 lines
Still to come would be libraries for specific out of tree purposes (device model, kexec), which would be adding new library at the same level as libxc I think, rather than underneath, i.e. also using the libraries split out here, but hopefully not libxenctrl itself.
Next steps for qemu-xen, with reference to:
http://xenbits.xen.org/people/ianc/libxenctrl-split/v4.html#by-functional-area
First the two simple cases:
The PV backend support now only (I think) uses got from these new libraries.
The PV domain builder is now configured off by default, I don't intend to make this
use a stable API so when enabling this qemu will then be linked against the unstable
libxen{guest,ctrl} libraries.Now the more complex cases.
The actual DM functionality looks in reasonably good shape, from the pandoc
source to the above (the "S" columns represent whether the column to the left is a stable interface or not):Interface S Underlying Interface S Other users ---------------------------------- - ------------------------------ - ---------------
xenevtchn_bind_interdomainYxenevtchn_closeYxenevtchn_fdYxenevtchn_notifyYxenevtchn_openYxenevtchn_pendingYxenevtchn_unmaskYxenforeignmemory_mapYxenforeignmemory_openYxenforeignmemory_unmapYxc_domain_add_to_physmapNXENMEM_add_to_physmapY libxc (dombuilder)xc_domain_populate_physmap_exactNXENMEM_populate_physmapY libxc (several)xc_domain_pin_memory_cacheattrNXEN_DOMCTL_pin_mem_cacheattrN Nonexc_domain_shutdownNSCHEDOP_remote_shutdownY libxlxc_set_hvm_paramNHVM_PARAM_ACPI_S_STATEY Nonexc_hvm_inject_msiNHVMOP_inject_msiY Nonexc_hvm_modified_memoryNHVMOP_modified_memoryY Nonexc_hvm_set_isa_irq_levelNHVMOP_set_isa_irq_levelY Nonexc_hvm_set_mem_typeNHVMOP_set_mem_typeY Nonexc_hvm_set_pci_intx_levelNHVMOP_set_pci_intx_levelY Nonexc_hvm_set_pci_link_routeNHVMOP_set_pci_link_routeY Nonexc_hvm_track_dirty_vramNHVMOP_track_dirty_vramY Nonexc_hvm_unmap_io_range_from_ir...NHVMOP_IO_RANGE_(PORT|MEM...)Y Nonexc_hvm_unmap_pcidev_from_iore...NHVMOP_unmap_io_range_from...Y NoneI think it would be reasonable to add a new library (say, libxendevicemodel, for arguments sake) with a stable ABI and to move all of the xc_hvm_* above into it. They are not used for anything else and are based on HVMOP which is a stable interface (AFAIK).
Within qemu
xc_domain_add_to_physmapandxc_domain_pin_memory_cacheattrare used in tandem solely to populate VRAM with WB memory and to remove again.
xc_domain_populate_physmap_exactis used only to populate RAM andxc_domain_shutdownis used on shutdown.I think having three or four functions in libxendevicemodel which offer these exact facilities while retaining the underlying (possibly more flexible) functionality in libxenctrl for other users (dombuilder, other in tree tools) would be tolerable.
Three or four functions depends on whether the uses of xc_domain_add_to_physmap+xc_domain_pin_memory_cacheattr and
xc_domain_populate_physmap_exactcan be satisfied with a single API or not. I don't know that yet.The main question would then be whether libxendevicemodel should wrap libxenctrl in a stable layer or whether it should actually duplicate the functionality in the thin wrappers.
Wrapping libxenctrl would mean that libxendevicemodel would need to be built by all releases with a fixed ABI such that the corresponding one (linking against the correct libxenctrl) can be flipped into place on boot. I think that is going to be too tricky for distros and users a like and that the small amount of duplication is therefore more tolerable.
The only blocker for that is that
xc_domain_pin_memory_cacheattrisXEN_DOMCTL_pin_mem_cacheattr(i.e. not stable), but this route would either require it to move to a stable hypercall interface or for the library to DTRT for all versions. I think moving to a stable h/call interface is more feasible.In terms of deprivileging QEMU (one of the end goals of this work) I think all the xen* libraries could very easily gain a xen???_set_target_domain which would make an appropriate ioctl to lock the underlying fd into operating only on that domain (another argument in finding a way to do
pin_mem_cacheattras a stable API). This would require support from all the underlying drivers, but could be added right away with errno=ENOTTY + return -1 and then plumbed in later. Obviously qemu would need to check the return values.The PCI passthrough case is less clear:
Interface S Underlying Interface S Other users ---------------------------------- - ------------------------------ - ---------------
xc_domain_bind_pt_pci_irqNXEN_DOMCTL_bind_pt_irqN Nonexc_domain_ioport_mappingNXEN_DOMCTL_ioport_mappingN Nonexc_domain_memory_mappingNXEN_DOMCTL_memory_mappingN libxlxc_domain_unbind_msi_irqNXEN_DOMCTL_unbind_pt_irqN Nonexc_domain_unbind_pt_irqNXEN_DOMCTL_unbind_pt_irqN Nonexc_domain_update_msi_irqNXEN_DOMCTL_bind_pt_irqN Nonexc_physdev_map_pirqNPHYSDEVOP_map_pirqY libxlxc_physdev_map_pirq_msiNPHYSDEVOP_map_pirqY Nonexc_physdev_unmap_pirqNPHYSDEVOP_unmap_pirqY libxlNB: More might be used by libxl in the future e.g. for ARM or PVH passthrough?
It seems like much of this would be candidates for adding to libxendevicemodel, but the underlying unstable interfaces pose a problem there. I'm going to leave this for another day.
Quoted 7 lines
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 71 lines · Ian Campbell
(Trimming CCs a bit)
Quoted 1 line · Ian Campbell
[...]
Quoted 4 lines
Still to come would be libraries for specific out of tree purposes (device model, kexec), which would be adding new library at the same level as libxc I think, rather than underneath, i.e. also using the libraries split out here, but hopefully not libxenctrl itself.
Next steps for qemu-xen, with reference to:
http://xenbits.xen.org/people/ianc/libxenctrl-split/v4.html#by-functional-area
First the two simple cases:
The PV backend support now only (I think) uses got from these new libraries.
The PV domain builder is now configured off by default, I don't intend to make this
use a stable API so when enabling this qemu will then be linked against the unstable
libxen{guest,ctrl} libraries.Now the more complex cases.
The actual DM functionality looks in reasonably good shape, from the pandoc
source to the above (the "S" columns represent whether the column to the left is a stable interface or not):Interface S Underlying Interface S Other users
---------------------------------- - ------------------------------ - ---------------`xenevtchn_bind_interdomain` Y `xenevtchn_close` Y `xenevtchn_fd` Y `xenevtchn_notify` Y `xenevtchn_open` Y `xenevtchn_pending` Y `xenevtchn_unmask` Y `xenforeignmemory_map` Y `xenforeignmemory_open` Y `xenforeignmemory_unmap` Y `xc_domain_add_to_physmap` N `XENMEM_add_to_physmap` Y libxc (dombuilder) `xc_domain_populate_physmap_exact` N `XENMEM_populate_physmap` Y libxc (several) `xc_domain_pin_memory_cacheattr` N `XEN_DOMCTL_pin_mem_cacheattr` N None `xc_domain_shutdown` N `SCHEDOP_remote_shutdown` Y libxl `xc_set_hvm_param` N `HVM_PARAM_ACPI_S_STATE` Y None `xc_hvm_inject_msi` N `HVMOP_inject_msi` Y None `xc_hvm_modified_memory` N `HVMOP_modified_memory` Y None `xc_hvm_set_isa_irq_level` N `HVMOP_set_isa_irq_level` Y None `xc_hvm_set_mem_type` N `HVMOP_set_mem_type` Y None `xc_hvm_set_pci_intx_level` N `HVMOP_set_pci_intx_level` Y None `xc_hvm_set_pci_link_route` N `HVMOP_set_pci_link_route` Y None `xc_hvm_track_dirty_vram` N `HVMOP_track_dirty_vram` Y None
xc_hvm_unmap_io_range_from_ir...NHVMOP_IO_RANGE_(PORT|MEM...)Y Nonexc_hvm_unmap_pcidev_from_iore...NHVMOP_unmap_io_range_from...Y NoneI think it would be reasonable to add a new library (say, libxendevicemodel, for arguments sake) with a stable ABI and to move all of the xc_hvm_* above into it. They are not used for anything else and are based on HVMOP which is a stable interface (AFAIK).
Within qemu
xc_domain_add_to_physmapandxc_domain_pin_memory_cacheattrare used in tandem solely to populate VRAM with WB memory and to remove again.
xc_domain_populate_physmap_exactis used only to populate RAM andxc_domain_shutdownis used on shutdown.I think having three or four functions in libxendevicemodel which offer these exact facilities while retaining the underlying (possibly more flexible) functionality in libxenctrl for other users (dombuilder, other in tree tools) would be tolerable.
Quoted 8 lines
Three or four functions depends on whether the uses of xc_domain_add_to_physmap+xc_domain_pin_memory_cacheattr and
xc_domain_populate_physmap_exactcan be satisfied with a single API or not. I don't know that yet.The main question would then be whether libxendevicemodel should wrap libxenctrl in a stable layer or whether it should actually duplicate the functionality in the thin wrappers.
Couldn't we rename the existing libxc calls and make them stable? Keep in mind that we already have stable wrappers in QEMU in include/hw/xen/xen_common.h. I don't think we need two layers of wrappers :-)
Quoted 5 lines
Wrapping libxenctrl would mean that libxendevicemodel would need to be built by all releases with a fixed ABI such that the corresponding one (linking against the correct libxenctrl) can be flipped into place on boot. I think that is going to be too tricky for distros and users a like and that the small amount of duplication is therefore more tolerable.
I am not in favor of wrapping, but I don't think that what you describe is a problem, unless I am misunderstanding. libxendevicemodel and libxenctrl are built together from the same place. We don't really expect users to mix and match them. Even if libxendevicemodel was wrapping libxenctrl, it wouldn't really be a problem, given that they would always be updated together.
We do expect users to mix and match QEMU and Xen, and that is the problem that libxendevicemodel would solve.
Quoted 6 lines
The only blocker for that is that
xc_domain_pin_memory_cacheattrisXEN_DOMCTL_pin_mem_cacheattr(i.e. not stable), but this route would either require it to move to a stable hypercall interface or for the library to DTRT for all versions. I think moving to a stable h/call interface is more feasible.
Quoted 8 lines
In terms of deprivileging QEMU (one of the end goals of this work) I think all the xen* libraries could very easily gain a xen???_set_target_domain which would make an appropriate ioctl to lock the underlying fd into operating only on that domain (another argument in finding a way to do
pin_mem_cacheattras a stable API). This would require support from all the underlying drivers, but could be added right away with errno=ENOTTY + return -1 and then plumbed in later. Obviously qemu would need to check the return values.
+1
Quoted 14 lines
The PCI passthrough case is less clear:
Interface S Underlying Interface S Other users
---------------------------------- - ------------------------------ - ---------------`xc_domain_bind_pt_pci_irq` N `XEN_DOMCTL_bind_pt_irq` N None `xc_domain_ioport_mapping` N `XEN_DOMCTL_ioport_mapping` N None `xc_domain_memory_mapping` N `XEN_DOMCTL_memory_mapping` N libxl `xc_domain_unbind_msi_irq` N `XEN_DOMCTL_unbind_pt_irq` N None `xc_domain_unbind_pt_irq` N `XEN_DOMCTL_unbind_pt_irq` N None `xc_domain_update_msi_irq` N `XEN_DOMCTL_bind_pt_irq` N None `xc_physdev_map_pirq` N `PHYSDEVOP_map_pirq` Y libxl `xc_physdev_map_pirq_msi` N `PHYSDEVOP_map_pirq` Y None `xc_physdev_unmap_pirq` N `PHYSDEVOP_unmap_pirq` Y libxl
Quoted 6 lines
NB: More might be used by libxl in the future e.g. for ARM or PVH passthrough?
It seems like much of this would be candidates for adding to libxendevicemodel, but the underlying unstable interfaces pose a problem there. I'm going to leave this for another day.
Does the Xen<->libxc interface need to be stable for libxendevicemodel to have a stable ABI?
I think that libxendevicemodel could be stable, no matter what hypercall is eventually called underneath. Am I missing something?
On Thu, 2015-11-19 at 16:20 +0000, Stefano Stabellini wrote:
I'll just answer this bit, since it ties into your other answers, I think.
Quoted 2 lines
Does the Xen<->libxc interface need to be stable for libxendevicemodel to have a stable ABI?
We could:
1) support multiple versions of Xen in a single library binary by detecting the Xen version and dispatch the right kind of domctl with the right ABI
or:
2) provide multiple copies of libxendevicemodel.so.1 (the SONAME of the library), one per Xen release and require that the distro's scripting to arrange on boot that the dynamic linker finds the right one for the version of Xen you are actually running under right now.
Neither of them are as easy as just having the Xen<->libxc interface in question be stable.
Also, consider a distro package, typically the qemu package would depend on libxendevicemodel.so.1 (in some way or another), but actually the dependency would be on a version of libxendevicemodel.so associated with a version of Xen >= the running version (i.e. libxendevicemodel from 4.7 obviously won't know about the ABI of 4.8).
We don't want to change the SONAME, since that defeats the purpose of having a stable ABI.
Remember that the distro may have built qemu against the libxendevicemodel from 4.7 but end up running it on 4.8 and that users may, for various reasons only do partial upgrades of userspace stuff like QEMU.
Quoted 2 lines
I think that libxendevicemodel could be stable, no matter what hypercall is eventually called underneath. Am I missing something?
It's possible but there are downsides and its not as simple as all that.
Ian.
Quoted 11 lines · Ian Campbell
On Thu, 2015-11-19 at 16:20 +0000, Stefano Stabellini wrote:
I'll just answer this bit, since it ties into your other answers, I think.
Quoted 2 lines
Does the Xen<->libxc interface need to be stable for libxendevicemodel to have a stable ABI?
We could:
1) support multiple versions of Xen in a single library binary by detecting the Xen version and dispatch the right kind of domctl with the right ABI
It doesn't look like we need to go that far, given that we can assume that libxendevicemodel and the hypervisor are the same version.
Quoted 6 lines
or:
2) provide multiple copies of libxendevicemodel.so.1 (the SONAME of the library), one per Xen release and require that the distro's scripting to arrange on boot that the dynamic linker finds the right one for the version of Xen you are actually running under right now.
Do distros support having multiple different Xen packages installed on the same system? That would be where the difficulty comes from. If that is not a supported use case, then I don't see the problem.
On the other hand if that is supported, then yes, they would also need to arrange scripts to link the right libxendevicemodel to libxendevicemodel.so.1.
Quoted 8 lines
Neither of them are as easy as just having the Xen<->libxc interface in question be stable.
Also, consider a distro package, typically the qemu package would depend on libxendevicemodel.so.1 (in some way or another), but actually the dependency would be on a version of libxendevicemodel.so associated with a version of Xen >= the running version (i.e. libxendevicemodel from 4.7 obviously won't know about the ABI of 4.8).
I think that's fine, as long as the ABI is stable and you only have one libxendevicemodel.so.1 in your system: the one provided by the running Xen package.
Quoted 2 lines
We don't want to change the SONAME, since that defeats the purpose of having a stable ABI.
OK
Quoted 11 lines
Remember that the distro may have built qemu against the libxendevicemodel from 4.7 but end up running it on 4.8 and that users may, for various reasons only do partial upgrades of userspace stuff like QEMU.
Quoted 2 lines
I think that libxendevicemodel could be stable, no matter what hypercall is eventually called underneath. Am I missing something?
It's possible but there are downsides and its not as simple as all that.
Ian.
Quoted 12 lines · Stefano Stabellini
Quoted 11 lines · Ian Campbell
On Thu, 2015-11-19 at 16:20 +0000, Stefano Stabellini wrote:
I'll just answer this bit, since it ties into your other answers, I think.
Quoted 3 lines
Does the Xen<->libxc interface need to be stable for libxendevicemodel
to have a stable ABI?We could:
Quoted 7 lines
Quoted 4 lines
1) support multiple versions of Xen in a single library binary by detecting
the Xen version and dispatch the right kind of domctl with the right ABIIt doesn't look like we need to go that far, given that we can assume that libxendevicemodel and the hypervisor are the same version.
I don't think we necessarily can.
Quoted 9 lines
Quoted 8 lines
or:
2) provide multiple copies of libxendevicemodel.so.1 (the SONAME of the library), one per Xen release and require that the distro's scripting to
arrange on boot that the dynamic linker finds the right one for the version
of Xen you are actually running under right now.
Quoted 3 lines
Do distros support having multiple different Xen packages installed on the same system? That would be where the difficulty comes from. If that is not a supported use case, then I don't see the problem.
Debian does support this and in general it is important for upgrades (i.e. installing 4.8 while running 4.7 and then expecting to shut down VMs on reboot etc), and also because people naturally like to keep the old version as a fallback after an upgrade (like one typically does with the kernel etc).
I think it is something we as upstream should be moving more towards, or at least not making it more difficult.
Quoted 3 lines
On the other hand if that is supported, then yes, they would also need to arrange scripts to link the right libxendevicemodel to libxendevicemodel.so.1.
Yes, they could do this, it seems to me like a pretty unusual and not very friendly requirement to push onto the distros though.
Quoted 11 lines
Quoted 10 lines
Neither of them are as easy as just having the Xen<->libxc interface in question be stable.
Also, consider a distro package, typically the qemu package would depend on
libxendevicemodel.so.1 (in some way or another), but actually the dependency would be on a version of libxendevicemodel.so associated with a
version of Xen >= the running version (i.e. libxendevicemodel from 4.7 obviously won't know about the ABI of 4.8).
Quoted 3 lines
I think that's fine, as long as the ABI is stable and you only have one libxendevicemodel.so.1 in your system: the one provided by the running Xen package.
Thinking about this some more last night it occurred to me that the Xen 4.8 packages would necessarily require the corresponding libxendevicemodel to be around through dependencies (which would be >= 4.8, not ==4.8 as they would be for an unstable ABI library).
So even if we were doing the versioning dynamically at runtime in the library and the user was booting 4.7 the prevailing libxendevicemodel.so would be one which spoke both 4.7 and 4.8.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 19 lines · Stefano Stabellini
Quoted 18 lines
I think it would be reasonable to add a new library (say, libxendevicemodel, for arguments sake) with a stable ABI and to move all of the xc_hvm_* above into it. They are not used for anything else and are based on HVMOP which is a stable interface (AFAIK).
Within qemu
xc_domain_add_to_physmapandxc_domain_pin_memory_cacheattrare used in tandem solely to populate VRAM with WB memory and to remove again.
xc_domain_populate_physmap_exactis used only to populate RAM andxc_domain_shutdownis used on shutdown.I think having three or four functions in libxendevicemodel which offer these exact facilities while retaining the underlying (possibly more flexible) functionality in libxenctrl for other users (dombuilder, other in tree tools) would be tolerable.
Three or four functions depends on whether the uses of xc_domain_add_to_physmap+xc_domain_pin_memory_cacheattr and
xc_domain_populate_physmap_exactcan be satisfied with a single API or not. I don't know that yet.
Quoted 5 lines
Quoted 3 lines
The main question would then be whether libxendevicemodel should wrap libxenctrl in a stable layer or whether it should actually duplicate the functionality in the thin wrappers.
Couldn't we rename the existing libxc calls and make them stable?
This was what I was trying to get at a couple of paras earlier.
The current functions are far more flexible than what QEMU requires (and that flexibility is used by other in tree components).
I'm not sure we can (or want to) declare the full breadth of the functionality of e.g. xc_domain_add_to_physmap and xc_domain_pin_memory_cacheattr as being stable.
It would be much easier to arrive at and agree on a suitable stable interface for the more limited specific functionality which is actually used by (or useful to) device models. (In the case
of xc_domain_add_to_physmap and xc_domain_pin_memory_cacheattr that more limited functionality is something like a function to populate VRAM in the guest).
If we were to just say "xc_domain_add_to_physmap and xc_domain_pin_memory_cacheattr are now stable" then having them in a libxendevicemodel would be incorrect, since they are not in any way specific to device models.
My question about wrappers vs duplicating was assuming we wanted libxendevicemodel to provide some specific stable functionality like "populate the VRAM" and in that case how to implement it, either by calling xc_domain_add_to_physmap and xc_domain_pin_memory_cacheattr from libxenctrl or by calling the domctls directly from libxendevicemodel.
Quoted 4 lines
Keep
in mind that we already have stable wrappers in QEMU ininclude/hw/xen/xen_common.h. I don't think we need two layers of wrappers :-)
Indeed, but part of the purpose of Xen providing stable libraries is that external components/users should not need wrappers.
IOW IMHO the current wrappers in QEMU should, as part of this exercise in providing stable interfaces, be deprecated and remain only to retain compatibility with older versions of Xen which lacked the stable interfaces, with a view to them eventually being removed as support for those older Xen's is removed from QEMU.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 5 lines · Stefano Stabellini
Quoted 5 lines
I think having three or four functions in libxendevicemodel which offer these exact facilities while retaining the underlying (possibly more flexible) functionality in libxenctrl for other users (dombuilder, other in tree tools) would be tolerable.
[...]
Quoted 5 lines
The main question would then be whether libxendevicemodel should wrap
Quoted 2 lines
libxenctrl in a stable layer or whether it should actually duplicate the functionality in the thin wrappers.
Couldn't we rename the existing libxc calls and make them stable?
This was sort of what I was getting at a couple of paras earlier (quotes trimmed to just that bit).
The current functions are far more flexible than what QEMU requires (and that flexibility is used by in tree components). I'm not sure we can (or want to) declare the full breadth of the functionality of e.g. xc_domain_add_to_physmap and xc_domain_pin_memory_cacheattr as being stable and it would be much easier to arrive at and agree on a suitable stable interface for more limited specific functionality.
If we were to just say "xc_domain_add_to_physmap and xc_domain_pin_memory_cacheattr are now stable" then having them in a libxendevicemodel would be incorrect, since they are not in any way specific to device models.
Quoted 4 lines
Keep
in mind that we already have stable wrappers in QEMU ininclude/hw/xen/xen_common.h. I don't think we need two layers of wrappers :-)
Indeed, but part of the purpose of Xen providing stable libraries is that external components/users should not need wrappers.
IOW IMHO the current wrappers in QEMU should, as part of this exercise in providing stable interfaces, be deprecated and remain only to retain compatibility with older versions of Xen which lacked the stable interfaces, with a view to them eventually being removed as support for those older Xen's is removed from QEMU.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 16 lines · Ian Campbell
Quoted 5 lines · Stefano Stabellini
Quoted 5 lines
I think having three or four functions in libxendevicemodel which offer these exact facilities while retaining the underlying (possibly more flexible) functionality in libxenctrl for other users (dombuilder, other in tree tools) would be tolerable.
[...]
Quoted 5 lines
The main question would then be whether libxendevicemodel should wrap
Quoted 2 lines
libxenctrl in a stable layer or whether it should actually duplicate the functionality in the thin wrappers.
Couldn't we rename the existing libxc calls and make them stable?
This was sort of what I was getting at a couple of paras earlier (quotes trimmed to just that bit).
Quoted 6 lines
The current functions are far more flexible than what QEMU requires (and that flexibility is used by in tree components). I'm not sure we can (or want to) declare the full breadth of the functionality of e.g.
xc_domain_add_to_physmapandxc_domain_pin_memory_cacheattras being stable and it would be much easier to arrive at and agree on a suitable stable interface for more limited specific functionality.
This is a good point.
Quoted 11 lines
If we were to just say "
xc_domain_add_to_physmapandxc_domain_pin_memory_cacheattrare now stable" then having them in a libxendevicemodel would be incorrect, since they are not in any way specific to device models.Quoted 4 lines
Keep
in mind that we already have stable wrappers in QEMU ininclude/hw/xen/xen_common.h. I don't think we need two layers of wrappers :-)
Quoted 8 lines
Indeed, but part of the purpose of Xen providing stable libraries is that external components/users should not need wrappers.
IOW IMHO the current wrappers in QEMU should, as part of this exercise in providing stable interfaces, be deprecated and remain only to retain compatibility with older versions of Xen which lacked the stable interfaces, with a view to them eventually being removed as support for those older Xen's is removed from QEMU.
I agree that it would be nicer to have the wrapper in Xen, but realistically we won't be able to get rid of the ones in QEMU anytime soon.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 18 lines · Ian Campbell
Quoted 17 lines · Stefano Stabellini
Quoted 15 lines · Ian Campbell
On Thu, 2015-11-19 at 16:20 +0000, Stefano Stabellini wrote:
I'll just answer this bit, since it ties into your other answers, I think.
Quoted 3 lines
Does the Xen<->libxc interface need to be stable for libxendevicemodel
to have a stable ABI?We could:
1) support multiple versions of Xen in a single library binary by detecting
the Xen version and dispatch the right kind of domctl with the right ABI
Quoted 4 lines
Quoted 2 lines
It doesn't look like we need to go that far, given that we can assume that libxendevicemodel and the hypervisor are the same version.
I don't think we necessarily can.
But we have always stated that userspace libraries need to match the hypervisor version, right? This would be one of the userspace libraries with a stable ABI, just like libxl.
Quoted 13 lines
Quoted 9 lines
Quoted 8 lines
or:
2) provide multiple copies of libxendevicemodel.so.1 (the SONAME of the library), one per Xen release and require that the distro's scripting to
arrange on boot that the dynamic linker finds the right one for the version
of Xen you are actually running under right now.Quoted 3 lines
Do distros support having multiple different Xen packages installed on the same system? That would be where the difficulty comes from. If that is not a supported use case, then I don't see the problem.
Quoted 8 lines
Debian does support this and in general it is important for upgrades (i.e. installing 4.8 while running 4.7 and then expecting to shut down VMs on reboot etc), and also because people naturally like to keep the old version as a fallback after an upgrade (like one typically does with the kernel etc).
I think it is something we as upstream should be moving more towards, or at least not making it more difficult.
Fair enough. But if the concern is upgrades and reboots, then changing the installed library wouldn't change the version of the library loaded in memory and called by QEMU at runtime. Right?
If people wants to keep the old version of the library around they still can, they just need to rename it instead of removing it.
Quoted 22 lines
Quoted 3 lines
On the other hand if that is supported, then yes, they would also need to arrange scripts to link the right libxendevicemodel to libxendevicemodel.so.1.
Yes, they could do this, it seems to me like a pretty unusual and not very friendly requirement to push onto the distros though.
Quoted 11 lines
Quoted 10 lines
Neither of them are as easy as just having the Xen<->libxc interface in question be stable.
Also, consider a distro package, typically the qemu package would depend on
libxendevicemodel.so.1 (in some way or another), but actually the dependency would be on a version of libxendevicemodel.so associated with a
version of Xen >= the running version (i.e. libxendevicemodel from 4.7 obviously won't know about the ABI of 4.8).Quoted 3 lines
I think that's fine, as long as the ABI is stable and you only have one libxendevicemodel.so.1 in your system: the one provided by the running Xen package.
Quoted 8 lines
Thinking about this some more last night it occurred to me that the Xen 4.8 packages would necessarily require the corresponding libxendevicemodel to be around through dependencies (which would be >= 4.8, not ==4.8 as they would be for an unstable ABI library).
So even if we were doing the versioning dynamically at runtime in the library and the user was booting 4.7 the prevailing libxendevicemodel.so would be one which spoke both 4.7 and 4.8.
Ah, that's good.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 23 lines · Stefano Stabellini
Quoted 15 lines
If we were to just say "
xc_domain_add_to_physmapandxc_domain_pin_memory_cacheattrare now stable" then having them in a libxendevicemodel would be incorrect, since they are not in any way specific to device models.Quoted 4 lines
Keep
in mind that we already have stable wrappers in QEMU ininclude/hw/xen/xen_common.h. I don't think we need two layers of wrappers :-)Indeed, but part of the purpose of Xen providing stable libraries is that
external components/users should not need wrappers.Quoted 6 lines
IOW IMHO the current wrappers in QEMU should, as part of this exercise in
providing stable interfaces, be deprecated and remain only to retain compatibility with older versions of Xen which lacked the stable interfaces, with a view to them eventually being removed as support for those older Xen's is removed from QEMU.
Quoted 3 lines
I agree that it would be nicer to have the wrapper in Xen, but realistically we won't be able to get rid of the ones in QEMU anytime soon.
It's certainly a long term thing, but in the meantime it does mean that the QEMU wrappers should never need to be touched again until their removal.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
On Thu, 2015-11-19 at 16:20 +0000, Stefano Stabellini wrote:
(Backing up this thread a bit).
Quoted 8 lines
Quoted 3 lines
It seems like much of this would be candidates for adding to libxendevicemodel, but the underlying unstable interfaces pose a problem there. I'm going to leave this for another day.
Does the Xen<->libxc interface need to be stable for libxendevicemodel to have a stable ABI?
I think that libxendevicemodel could be stable, no matter what hypercall is eventually called underneath. Am I missing something?
I remember this morning why this matters, it's not the user space library ABI etc, but rather that if we want libxendevicemodel to be able to lock its fd to a specific domain (which we eventually do) then the kernel driver needs to be able to introspect the privcmd hypercalls[0] so the underlying hypercall does really need to be stable (since we don't want to be constantly reving the kernel driver when something changes).
Given a stable hypercall interface underneath given the wrapping library a stable ABI is a no brainer.
Ian.
[0] or to provide a dedicate ioctl or something, either way it is the kernel which needs to be providing the lockdown functionality.