tools/xenstored: Reduce the useage of unstable interface
cover tools/xenstored: Reduce the useage of unstable interface
xenstored is currently linked against libxc, and uses unstable interfaces for exactly two things:
1) Foreign mapping by MFN
2) xc_dom_getinfo(), but only for shutdown information
This series addresses issue 1. Issue 2 is still open, and can take advantage of loads of us being co-located in Chicago at the moment.
Andrew Cooper (2):
tools/xenstored: Make gnttab interface mandatory tools/xenstored: Drop mapping of the ring via foreign map
tools/xenstore/xenstored_domain.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-)
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 1/2 tools/xenstored: Make gnttab interface mandatory
xenstored currently requires an libxc and evtchn interface, but leaves the gnttab interface as optional.
gnttab is ubiquitous these days, and in practice mandatory in all cases where xenstored isn't running as root in dom0 (due to the inability to foreign map by MFN).
The toolstack has unconditionally set up grant details for many years now, and longterm it would be good to phase out the use of libxc. This requires that xenstored map the store ring by grant map, rather than foreign map.
No practical change.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>
--- tools/xenstore/xenstored_domain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/xenstore/xenstored_domain.c +3 -3
@@ -641,9 +641,9 @@ void domain_init(void) *xgt_handle =xengnttab_open (NULL ,0 );if (*xgt_handle ==NULL ) -xprintf ("WARNING: Failed to open connection to gnttab\n" ); -else -talloc_set_destructor (xgt_handle, close_xgt_handle); +barf_perror ("Failed to open connection to gnttab" ); + +talloc_set_destructor (xgt_handle, close_xgt_handle); xce_handle =xenevtchn_open (NULL ,0 );
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 1/2] tools/xenstored: Make gnttab interface mandatory
Quoted 7 lines · Andrew Cooper
xenstored currently requires an libxc and evtchn interface, but leaves the gnttab interface as optional.
gnttab is ubiquitous these days, and in practice mandatory in all cases where xenstored isn't running as root in dom0 (due to the inability to foreign map by MFN).
Quoted 8 lines
The toolstack has unconditionally set up grant details for many years now, and longterm it would be good to phase out the use of libxc. This requires that xenstored map the store ring by grant map, rather than foreign map.
No practical change.
Signed-off-by Andrew Cooper <[email protected]>
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 2/2 tools/xenstored: Drop mapping of the ring via foreign map
In reply to Andrew CooperThis is a vestigial remnent of the pre xenstored stub domain days.
Foreign mapping via MFN is a privileged operation which is not necessary, because grant details are unconditionally set up during domain construction. In practice, this means xenstored never uses its ability to foreign map the ring.
Drop the ability completely, which removes the penultimate use of the unstable libxc interface.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>
--- tools/xenstore/xenstored_domain.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-)
tools/xenstore/xenstored_domain.c +7 -15
@@ -171,24 +171,16 @@ static int readchn(struct connection *conn, void *data, unsigned int len)return len; } -static void *map_interface (domid_t domid,unsigned long mfn) -{ -if (*xgt_handle !=NULL ) { -/* this is the preferred method */ -return xengnttab_map_grant_ref (*xgt_handle, domid, -GNTTAB_RESERVED_XENSTORE ,PROT_READ |PROT_WRITE ); - }else { -return xc_map_foreign_range (*xc_handle, domid, -XC_PAGE_SIZE ,PROT_READ |PROT_WRITE , mfn); - } +static void *map_interface (domid_t domid) +{ +return xengnttab_map_grant_ref (*xgt_handle, domid, +GNTTAB_RESERVED_XENSTORE , +PROT_READ |PROT_WRITE ); }static void unmap_interface (void *interface) { -if (*xgt_handle !=NULL ) -xengnttab_unmap (*xgt_handle, interface,1 ); -else -munmap (interface,XC_PAGE_SIZE ); +xengnttab_unmap (*xgt_handle, interface,1 ); }static int destroy_domain (void *_domain)
@@ -396,7 +388,7 @@ int do_introduce(struct connection *conn, struct buffered_data *in) domain =find_domain_by_domid (domid);if (domain ==NULL ) { - interface =map_interface (domid, mfn); + interface =map_interface (domid);if (!interface)return errno;/* Hang domain off "in" until we're finished. */
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 2/2] tools/xenstored: Drop mapping of the ring via foreign map
Quoted 11 lines · Andrew Cooper
This is a vestigial remnent of the pre xenstored stub domain days.
Foreign mapping via MFN is a privileged operation which is not necessary, because grant details are unconditionally set up during domain construction. In practice, this means xenstored never uses its ability to foreign map the ring.
Drop the ability completely, which removes the penultimate use of the unstable libxc interface.
Signed-off-by Andrew Cooper <[email protected]>
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel