Begin to disentangle libxenctrl and provide some stable libraries
Subsystems (2)
PATCH v4 1/5 qemu-xen-traditional: Use xentoollog as a separate library
In reply to Ian CampbellThis has been split out of libxenctrl, so the build needs to be able to find the header and the library. QEMU does not use xtl_* itself so -rpath-link is sufficient to allow linking to libxenctrl.so (which links against libxentoollog).
---
v3: Library moved to tools/libs/
--- xen-hooks.mak | 2 ++ 1 file changed, 2 insertions(+)
xen-hooks.mak +2 -0
@@ -1,3 +1,4 @@ +CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/toollog/include CPPFLAGS+= -I$(XEN_ROOT)/tools/libxc/include CPPFLAGS+= -I$(XEN_ROOT)/tools/xenstore/include CPPFLAGS+= -I$(XEN_ROOT)/tools/include
@@ -19,6 +20,7 @@ CFLAGS += $(CMDLINE_CFLAGS) LIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl -lxenguest LIBS += -L$(XEN_ROOT)/tools/xenstore -lxenstore +LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toollog LDFLAGS := $(CFLAGS) $(LDFLAGS)
Signature · 1 line
2.1.4
PATCH v4 2/5 qemu-xen-traditional: Use libxenevtchn
In reply to Ian Campbell/dev/xen/evtchn related wrappers have been moved out of libxenctrl into their own library.
Note that i386-dm/helper2.c's xc_interface * was always really an xc_evtchn *, it's just they used to be typedefs to the same thing...
---
v3: Library moved to tools/libs/
--- hw/xen_backend.c | 26 +++++++++++++------------- hw/xen_backend.h | 2 +- hw/xen_common.h | 1 + i386-dm/helper2.c | 19 ++++++++++--------- xen-hooks.mak | 2 ++ 5 files changed, 27 insertions(+), 23 deletions(-)
hw/xen_backend.c +13 -13
@@ -208,19 +208,19 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev, xendev->debug = debug; xendev->local_port =-1 ; - xendev->evtchndev =xc_evtchn_open (NULL ,0 ); + xendev->evtchndev =xenevtchn_open (NULL ,0 );if (xendev->evtchndev ==NULL ) {xen_be_printf (NULL ,0 ,"can't open evtchn device\n" );qemu_free (xendev);return NULL ; } -fcntl (xc_evtchn_fd (xendev->evtchndev),F_SETFD ,FD_CLOEXEC ); +fcntl (xenevtchn_fd (xendev->evtchndev),F_SETFD ,FD_CLOEXEC );if (ops->flags &DEVOPS_FLAG_NEED_GNTDEV ) { xendev->gnttabdev =xc_gnttab_open (NULL ,0 );if (xendev->gnttabdev ==NULL ) {xen_be_printf (NULL ,0 ,"can't open gnttab device\n" ); -xc_evtchn_close (xendev->evtchndev); +xenevtchn_close (xendev->evtchndev);qemu_free (xendev);return NULL ; }
@@ -268,7 +268,7 @@ static struct XenDevice *xen_be_del_xendev(int dom, int dev) }if (xendev->evtchndev !=NULL ) -xc_evtchn_close (xendev->evtchndev); +xenevtchn_close (xendev->evtchndev);if (xendev->gnttabdev !=NULL )xc_gnttab_close (xendev->gnttabdev);
@@ -630,13 +630,13 @@ static void xen_be_evtchn_event(void *opaque)struct XenDevice *xendev = opaque;evtchn_port_t port; - port =xc_evtchn_pending (xendev->evtchndev); + port =xenevtchn_pending (xendev->evtchndev);if (port != xendev->local_port) { -xen_be_printf (xendev,0 ,"xc_evtchn_pending returned %d (expected %d)\n" , +xen_be_printf (xendev,0 ,"xenevtchn_pending returned %d (expected %d)\n" , port, xendev->local_port);return ; } -xc_evtchn_unmask (xendev->evtchndev, port); +xenevtchn_unmask (xendev->evtchndev, port);if (xendev->ops->event) xendev->ops->event (xendev);
@@ -683,14 +683,14 @@ int xen_be_bind_evtchn(struct XenDevice *xendev) {if (xendev->local_port !=-1 )return 0 ; - xendev->local_port =xc_evtchn_bind_interdomain + xendev->local_port =xenevtchn_bind_interdomain (xendev->evtchndev, xendev->dom, xendev->remote_port);if (xendev->local_port ==-1 ) { -xen_be_printf (xendev,0 ,"xc_evtchn_bind_interdomain failed\n" ); +xen_be_printf (xendev,0 ,"xenevtchn_bind_interdomain failed\n" );return -1 ; }xen_be_printf (xendev,2 ,"bind evtchn port %d\n" , xendev->local_port); -qemu_set_fd_handler (xc_evtchn_fd (xendev->evtchndev), +qemu_set_fd_handler (xenevtchn_fd (xendev->evtchndev), xen_be_evtchn_event,NULL , xendev);return 0 ; }
@@ -699,15 +699,15 @@ void xen_be_unbind_evtchn(struct XenDevice *xendev) {if (xendev->local_port ==-1 )return ; -qemu_set_fd_handler (xc_evtchn_fd (xendev->evtchndev),NULL ,NULL ,NULL ); -xc_evtchn_unbind (xendev->evtchndev, xendev->local_port); +qemu_set_fd_handler (xenevtchn_fd (xendev->evtchndev),NULL ,NULL ,NULL ); +xenevtchn_unbind (xendev->evtchndev, xendev->local_port);xen_be_printf (xendev,2 ,"unbind evtchn port %d\n" , xendev->local_port); xendev->local_port =-1 ; }int xen_be_send_notify (struct XenDevice *xendev) { -return xc_evtchn_notify (xendev->evtchndev, xendev->local_port); +return xenevtchn_notify (xendev->evtchndev, xendev->local_port); }/*
hw/xen_backend.h +1 -1
@@ -44,7 +44,7 @@ struct XenDevice {int remote_port;int local_port; -xc_evtchn *evtchndev; +xenevtchn_handle *evtchndev;xc_gnttab *gnttabdev;struct XenDevOps *ops;
hw/xen_common.h +1 -0
@@ -4,6 +4,7 @@#include <stddef.h> #include <inttypes.h> +#include <xenevtchn.h> #include <xenctrl.h> #include <xenstore.h> #include <xen/io/xenbus.h>
i386-dm/helper2.c +10 -9
@@ -48,6 +48,7 @@#include <limits.h> #include <fcntl.h> +#include <xenevtchn.h> #include <xenctrl.h> #include <xen/hvm/ioreq.h> #include <xen/hvm/hvm_info_table.h>
@@ -104,7 +105,7 @@ buffered_iopage_t *buffered_io_page = NULL;QEMUTimer *buffered_io_timer;/* the evtchn fd for polling */ -xc_interface *xce_handle =NULL ; +xenevtchn_handle *xce_handle =NULL ;/* which vcpu we are serving */ int send_vcpu =0 ;
@@ -141,7 +142,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model) cpu_single_env = env; - xce_handle =xc_evtchn_open (NULL ,0 ); + xce_handle =xenevtchn_open (NULL ,0 );if (xce_handle ==NULL ) {perror ("open" );return NULL ;
@@ -149,7 +150,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model)/* FIXME: how about if we overflow the page here? */ for (i =0 ; i < vcpus; i++) { - rc =xc_evtchn_bind_interdomain ( + rc =xenevtchn_bind_interdomain ( xce_handle, domid, shared_page->vcpu_ioreq[i].vp_eport);if (rc ==-1 ) {fprintf (logfile,"bind interdomain ioctl error %d\n" , errno);
@@ -164,7 +165,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model) errno);return NULL ; } - rc =xc_evtchn_bind_interdomain (xce_handle, domid, (uint32_t )bufioreq_evtchn); + rc =xenevtchn_bind_interdomain (xce_handle, domid, (uint32_t )bufioreq_evtchn);if (rc ==-1 ) {fprintf (logfile,"bind interdomain ioctl error %d\n" , errno);return NULL ;
@@ -278,7 +279,7 @@ static ioreq_t *cpu_get_ioreq(void)int i;evtchn_port_t port; - port =xc_evtchn_pending (xce_handle); + port =xenevtchn_pending (xce_handle);if (port == bufioreq_local_port) {qemu_mod_timer (buffered_io_timer,BUFFER_IO_MAX_DELAY +qemu_get_clock (rt_clock));
@@ -296,7 +297,7 @@ static ioreq_t *cpu_get_ioreq(void) }// unmask the wanted port again -xc_evtchn_unmask (xce_handle, port); +xenevtchn_unmask (xce_handle, port);//get the io packet from shared memory send_vcpu = i;
@@ -539,7 +540,7 @@ static void handle_buffered_io(void *opaque) BUFFER_IO_MAX_DELAY + qemu_get_clock(rt_clock)); }else {qemu_del_timer (buffered_io_timer); -xc_evtchn_unmask (xce_handle, bufioreq_local_port); +xenevtchn_unmask (xce_handle, bufioreq_local_port); } }
@@ -583,7 +584,7 @@ static void cpu_handle_ioreq(void *opaque) } req->state =STATE_IORESP_READY ; -xc_evtchn_notify (xce_handle, ioreq_local_port[send_vcpu]); +xenevtchn_notify (xce_handle, ioreq_local_port[send_vcpu]); } }
@@ -592,7 +593,7 @@ int xen_pause_requested;int main_loop (void ) {CPUState *env = cpu_single_env; -int evtchn_fd = xce_handle ==NULL ?-1 :xc_evtchn_fd (xce_handle); +int evtchn_fd = xce_handle ==NULL ?-1 :xenevtchn_fd (xce_handle);char *qemu_file;fd_set fds;
xen-hooks.mak +2 -0
@@ -1,4 +1,5 @@ CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/toollog/include +CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/evtchn/include CPPFLAGS+= -I$(XEN_ROOT)/tools/libxc/include CPPFLAGS+= -I$(XEN_ROOT)/tools/xenstore/include CPPFLAGS+= -I$(XEN_ROOT)/tools/include
@@ -18,6 +19,7 @@ endif CFLAGS += $(CMDLINE_CFLAGS) +LIBS += -L$(XEN_ROOT)/tools/libs/evtchn -lxenevtchn LIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl -lxenguest LIBS += -L$(XEN_ROOT)/tools/xenstore -lxenstore LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toollog
Signature · 1 line
2.1.4
PATCH v4 3/5 qemu-xen-traditional: Use libxengnttab
In reply to Ian Campbell/dev/xen/gntdev related wrappers have been moved out of libxenctrl into their own library.
---
v3: Library moved to tools/libs/
--- hw/xen_backend.c | 4 ++-- hw/xen_backend.h | 2 +- hw/xen_common.h | 1 + hw/xen_console.c | 4 ++-- hw/xen_disk.c | 24 ++++++++++++------------ xen-hooks.mak | 2 ++ 6 files changed, 20 insertions(+), 17 deletions(-)
hw/xen_backend.c +2 -2
@@ -217,7 +217,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,fcntl (xenevtchn_fd (xendev->evtchndev),F_SETFD ,FD_CLOEXEC );if (ops->flags &DEVOPS_FLAG_NEED_GNTDEV ) { - xendev->gnttabdev =xc_gnttab_open (NULL ,0 ); + xendev->gnttabdev =xengnttab_open (NULL ,0 );if (xendev->gnttabdev ==NULL ) {xen_be_printf (NULL ,0 ,"can't open gnttab device\n" );xenevtchn_close (xendev->evtchndev);
@@ -270,7 +270,7 @@ static struct XenDevice *xen_be_del_xendev(int dom, int dev)if (xendev->evtchndev !=NULL )xenevtchn_close (xendev->evtchndev);if (xendev->gnttabdev !=NULL ) -xc_gnttab_close (xendev->gnttabdev); +xengnttab_close (xendev->gnttabdev);TAILQ_REMOVE (&xendevs, xendev, next);qemu_free (xendev);
hw/xen_backend.h +1 -1
@@ -45,7 +45,7 @@ struct XenDevice {int local_port;xenevtchn_handle *evtchndev; -xc_gnttab *gnttabdev; +xengnttab_handle *gnttabdev;struct XenDevOps *ops;TAILQ_ENTRY (XenDevice) next;
hw/xen_common.h +1 -0
@@ -5,6 +5,7 @@#include <inttypes.h> #include <xenevtchn.h> +#include <xengnttab.h> #include <xenctrl.h> #include <xenstore.h> #include <xen/io/xenbus.h>
hw/xen_console.c +2 -2
@@ -230,7 +230,7 @@ static int con_initialise(struct XenDevice *xendev)PROT_READ |PROT_WRITE , con->ring_ref); else - con->sring = xc_gnttab_map_grant_ref(xendev->gnttabdev, con->xendev.dom, + con->sring = xengnttab_map_grant_ref(xendev->gnttabdev, con->xendev.dom, con->ring_ref,PROT_READ |PROT_WRITE );if (!con->sring)
@@ -263,7 +263,7 @@ static void con_disconnect(struct XenDevice *xendev)if (!xendev->gnttabdev)munmap (con->sring,XC_PAGE_SIZE );else -xc_gnttab_munmap (xendev->gnttabdev, con->sring,1 ); +xengnttab_munmap (xendev->gnttabdev, con->sring,1 ); con->sring =NULL ; } }
hw/xen_disk.c +12 -12
@@ -266,7 +266,7 @@ err:static void ioreq_unmap (struct ioreq *ioreq) { -xc_gnttab *gnt = ioreq->blkdev->xendev.gnttabdev; +xengnttab_handle *gnt = ioreq->blkdev->xendev.gnttabdev;int i;if (ioreq->v.niov ==0 )
@@ -274,8 +274,8 @@ static void ioreq_unmap(struct ioreq *ioreq)if (batch_maps) {if (!ioreq->pages)return ; -if (xc_gnttab_munmap (gnt, ioreq->pages, ioreq->v.niov) !=0 ) -xen_be_printf (&ioreq->blkdev->xendev,0 ,"xc_gnttab_munmap failed: %s\n" , +if (xengnttab_munmap (gnt, ioreq->pages, ioreq->v.niov) !=0 ) +xen_be_printf (&ioreq->blkdev->xendev,0 ,"xengnttab_munmap failed: %s\n" ,strerror (errno)); ioreq->blkdev->cnt_map -= ioreq->v.niov; ioreq->pages =NULL ;
@@ -283,8 +283,8 @@ static void ioreq_unmap(struct ioreq *ioreq)for (i =0 ; i < ioreq->v.niov; i++) {if (!ioreq->page[i])continue ; -if (xc_gnttab_munmap (gnt, ioreq->page[i],1 ) !=0 ) -xen_be_printf (&ioreq->blkdev->xendev,0 ,"xc_gnttab_munmap failed: %s\n" , +if (xengnttab_munmap (gnt, ioreq->page[i],1 ) !=0 ) +xen_be_printf (&ioreq->blkdev->xendev,0 ,"xengnttab_munmap failed: %s\n" ,strerror (errno)); ioreq->blkdev->cnt_map--; ioreq->page[i] =NULL ;
@@ -294,13 +294,13 @@ static void ioreq_unmap(struct ioreq *ioreq)static int ioreq_map (struct ioreq *ioreq) { -xc_gnttab *gnt = ioreq->blkdev->xendev.gnttabdev; +xengnttab_handle *gnt = ioreq->blkdev->xendev.gnttabdev;int i;if (ioreq->v.niov ==0 )return 0 ;if (batch_maps) { - ioreq->pages =xc_gnttab_map_grant_refs + ioreq->pages =xengnttab_map_grant_refs (gnt, ioreq->v.niov, ioreq->domids, ioreq->refs, ioreq->prot);if (ioreq->pages ==NULL ) { xen_be_printf(&ioreq->blkdev->xendev, 0,
@@ -314,7 +314,7 @@ static int ioreq_map(struct ioreq *ioreq) ioreq->blkdev->cnt_map += ioreq->v.niov; }else {for (i =0 ; i < ioreq->v.niov; i++) { - ioreq->page[i] =xc_gnttab_map_grant_ref + ioreq->page[i] =xengnttab_map_grant_ref (gnt, ioreq->domids[i], ioreq->refs[i], ioreq->prot);if (ioreq->page[i] ==NULL ) { xen_be_printf(&ioreq->blkdev->xendev, 0,
@@ -611,9 +611,9 @@ static void blk_alloc(struct XenDevice *xendev) blkdev->bh =qemu_bh_new (blk_bh, blkdev);if (xen_mode !=XEN_EMULATE ) batch_maps =1 ; -if (xc_gnttab_set_max_grants (xendev->gnttabdev, +if (xengnttab_set_max_grants (xendev->gnttabdev,MAX_GRANTS (max_requests,BLKIF_MAX_SEGMENTS_PER_REQUEST )) <0 ) { -xen_be_printf (xendev,0 ,"xc_gnttab_set_max_grants failed: %s\n" , +xen_be_printf (xendev,0 ,"xengnttab_set_max_grants failed: %s\n" ,strerror (errno)); } }
@@ -734,7 +734,7 @@ static int blk_connect(struct XenDevice *xendev) blkdev->protocol =BLKIF_PROTOCOL_X86_64 ; } - blkdev->sring =xc_gnttab_map_grant_ref (blkdev->xendev.gnttabdev, + blkdev->sring =xengnttab_map_grant_ref (blkdev->xendev.gnttabdev, blkdev->xendev.dom, blkdev->ring_ref,PROT_READ |PROT_WRITE );
@@ -787,7 +787,7 @@ static void blk_disconnect(struct XenDevice *xendev)xen_be_unbind_evtchn (&blkdev->xendev);if (blkdev->sring) { -xc_gnttab_munmap (blkdev->xendev.gnttabdev, blkdev->sring,1 ); +xengnttab_munmap (blkdev->xendev.gnttabdev, blkdev->sring,1 ); blkdev->cnt_map--; blkdev->sring =NULL ; }
xen-hooks.mak +2 -0
@@ -1,5 +1,6 @@ CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/toollog/include CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/evtchn/include +CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/gnttab/include CPPFLAGS+= -I$(XEN_ROOT)/tools/libxc/include CPPFLAGS+= -I$(XEN_ROOT)/tools/xenstore/include CPPFLAGS+= -I$(XEN_ROOT)/tools/include
@@ -20,6 +21,7 @@ endif CFLAGS += $(CMDLINE_CFLAGS) LIBS += -L$(XEN_ROOT)/tools/libs/evtchn -lxenevtchn +LIBS += -L$(XEN_ROOT)/tools/libs/gnttab -lxengnttab LIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl -lxenguest LIBS += -L$(XEN_ROOT)/tools/xenstore -lxenstore LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toollog
Signature · 1 line
2.1.4
PATCH v4 4/5 qemu-xen-traditional: Add libxencall to rpath-link
In reply to Ian Campbelllibxenctrl links against this library
---
v3: Library moved to tools/libs
--- xen-hooks.mak | 1 + 1 file changed, 1 insertion(+)
xen-hooks.mak +1 -0
@@ -25,6 +25,7 @@ LIBS += -L$(XEN_ROOT)/tools/libs/gnttab -lxengnttab LIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl -lxenguest LIBS += -L$(XEN_ROOT)/tools/xenstore -lxenstore LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toollog +LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/call LDFLAGS := $(CFLAGS) $(LDFLAGS)
Signature · 1 line
2.1.4
PATCH v4 5/5 qemu-xen-traditional: Add libxenforeignmemory to rpath-link
In reply to Ian Campbelllibxenctrl links against this library.
Also, request the compat xc_map_foreign API from libxc.
---
v3: Library moved to tools/libs/
--- xen-hooks.mak | 2 ++ 1 file changed, 2 insertions(+)
xen-hooks.mak +2 -0
@@ -1,6 +1,7 @@ CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/toollog/include CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/evtchn/include CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/gnttab/include +CPPFLAGS+= -DXC_WANT_COMPAT_MAP_FOREIGN_API CPPFLAGS+= -I$(XEN_ROOT)/tools/libxc/include CPPFLAGS+= -I$(XEN_ROOT)/tools/xenstore/include CPPFLAGS+= -I$(XEN_ROOT)/tools/include
@@ -26,6 +27,7 @@ LIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl -lxenguest LIBS += -L$(XEN_ROOT)/tools/xenstore -lxenstore LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toollog LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/call +LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/foreignmemory LDFLAGS := $(CFLAGS) $(LDFLAGS)
Signature · 1 line
2.1.4
v4 cover Begin to disentangle libxenctrl and provide some stable libraries
In reply to Ian CampbellWe 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
Makefile | 5 +++++ 1 file changed, 5 insertions(+)
Signature · 1 line
2.1.4
PATCH v4 1/5 mini-os: Include libxentoollog with libxc
libxentoollog has just been split out from libxc. From mini-os's point of view we don't care about the distinction, so keep things simple by just including libxentoollog if libxc is enabled.
---
v2: Adjust for libs/$lib layout.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -165,6 +165,7 @@ OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS)) ifeq ($(libc),y) ifeq ($(CONFIG_XC),y) +APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog -whole-archive -lxentoollog -no-whole-archive APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH) -whole-archive -lxenguest -lxenctrl -no-whole-archive endif APP_LDLIBS += -lpci
Signature · 1 line
2.1.4
PATCH v4 2/5 mini-os: Include libxenevtchn with libxc
In reply to Ian Campbelllibxenevtchn has just been split out from libxc. From mini-os's point of view we don't care about the distinction, so keep things simple by just including libxenevtchn if libxc is enabled.
---
v2: Adjust for libs/$lib layout.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -166,6 +166,7 @@ OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS)) ifeq ($(libc),y) ifeq ($(CONFIG_XC),y) APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog -whole-archive -lxentoollog -no-whole-archive +APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn -whole-archive -lxenevtchn -no-whole-archive APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH) -whole-archive -lxenguest -lxenctrl -no-whole-archive endif APP_LDLIBS += -lpci
Signature · 1 line
2.1.4
PATCH v4 3/5 mini-os: Include libxengnttab with libxc
In reply to Ian Campbelllibxengnttab has just been split out from libxc. From mini-os's point of view we don't care about the distinction, so keep things simple by just including libxengnttab if libxc is enabled.
---
v2: Adjust for libs/$lib layout.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -167,6 +167,7 @@ ifeq ($(libc),y) ifeq ($(CONFIG_XC),y) APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog -whole-archive -lxentoollog -no-whole-archive APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn -whole-archive -lxenevtchn -no-whole-archive +APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab -whole-archive -lxengnttab -no-whole-archive APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH) -whole-archive -lxenguest -lxenctrl -no-whole-archive endif APP_LDLIBS += -lpci
Signature · 1 line
2.1.4
PATCH v4 4/5 mini-os: Include libxencall with libxc
In reply to Ian Campbelllibxencall has just been split out from libxc. From mini-os's point of view we don't care about the distinction, so keep things simple by just including libxencall if libxc is enabled.
---
v2: Adjust for libs/$lib layout.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -168,6 +168,7 @@ ifeq ($(CONFIG_XC),y) APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog -whole-archive -lxentoollog -no-whole-archive APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn -whole-archive -lxenevtchn -no-whole-archive APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab -whole-archive -lxengnttab -no-whole-archive +APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call -whole-archive -lxencall -no-whole-archive APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH) -whole-archive -lxenguest -lxenctrl -no-whole-archive endif APP_LDLIBS += -lpci
Signature · 1 line
2.1.4
PATCH v4 5/5 mini-os: Include libxenforeignmemory with libxc
In reply to Ian Campbelllibxenforeignmemory has just been split out from libxc. From mini-os's point of view we don't care about the distinction, so keep things simple by just including libxenforeignmemory if libxc is enabled.
---
v2: Adjust for libs/$lib layout.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -169,6 +169,7 @@ APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog -whole-ar APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn -whole-archive -lxenevtchn -no-whole-archive APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab -whole-archive -lxengnttab -no-whole-archive APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call -whole-archive -lxencall -no-whole-archive +APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/foreignmemory -whole-archive -lxenforeignmemory -no-whole-archive APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH) -whole-archive -lxenguest -lxenctrl -no-whole-archive endif APP_LDLIBS += -lpci
Signature · 1 line
2.1.4
Quoted 9 lines · Ian Campbell, le Wed 21 Oct 2015 16:24:14 +0100, a écrit :
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.
Quoted 6 lines
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
All
in case it was really necessary :)
Quoted 17 lines · Samuel Thibault
Quoted 9 lines · Ian Campbell, le Wed 21 Oct 2015 16:24:14 +0100, a écrit :
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.
Quoted 6 lines
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 5 lines
All
Acked-by Samuel Thibault <[email protected]>in case it was really necessary :)
Thanks!
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
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
(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... N HVMOP_IO_RANGE_(PORT|MEM...) Y None xc_hvm_unmap_pcidev_from_iore... N HVMOP_unmap_io_range_from... Y None
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_physmap and xc_domain_pin_memory_cacheattr are used in tandem solely to populate VRAM with WB memory and to remove again.
xc_domain_populate_physmap_exact is used only to populate RAM and xc_domain_shutdown is 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_exact can 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_cacheattr is XEN_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_cacheattr as 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_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
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.
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 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 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 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.