tools/libxc: add interface for GNTTABOP_query_size
PATCH 1/2 tools/libxc: add interface for GNTTABOP_query_size
This patch adds new interface for GNTTABOP_query_size in libxc to help query the current grant table frames and maximum grant table frames for a specific domain.
--- tools/libxc/include/xenctrl.h | 1 + tools/libxc/xc_gnttab.c | 12 ++++++++++++ 2 files changed, 13 insertions(+)
tools/libxc/include/xenctrl.h +1 -0
@@ -1597,6 +1597,7 @@ int xc_gnttab_op(xc_interface *xch, int cmd, void * op, int op_size, int count);/* Logs iff hypercall bounce fails, otherwise doesn't. */ +int xc_gnttab_query_size (xc_interface *xch,struct gnttab_query_size *query);int xc_gnttab_get_version (xc_interface *xch,int domid);/* Never logs */ grant_entry_v1_t *xc_gnttab_map_table_v1 (xc_interface *xch,int domid,int *gnt_num);grant_entry_v2_t *xc_gnttab_map_table_v2 (xc_interface *xch,int domid,int *gnt_num);
tools/libxc/xc_gnttab.c +12 -0
@@ -38,6 +38,18 @@ int xc_gnttab_op(xc_interface *xch, int cmd, void * op, int op_size, int count)return ret; } +int xc_gnttab_query_size (xc_interface *xch,struct gnttab_query_size *query) +{ +int rc; + + rc =xc_gnttab_op (xch, GNTTABOP_query_size, query,sizeof (*query),1 ); + +if ( rc || (query->status != GNTST_okay) ) +ERROR ("Could not query dom %d's grant size\n" , query->dom); + +return rc; +} +int xc_gnttab_get_version (xc_interface *xch,int domid) {struct gnttab_get_version query;
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 2/2 tools: utility to dump guest grant table info
As both xen-netfront and xen-blkfront support multi-queue, they would consume a lot of grant table references when there are many paravirtual devices and vcpus assigned to guest. Guest domU might panic or hang due to grant allocation failure when nr_grant_frames in guest has reached its max value.
This utility would help the administrators to monitor the guest grant table frame usage on dom0 side so that it is not required to debug on guest kernel side for crash/hang analysis anymore.
--- tools/misc/Makefile | 4 ++++ tools/misc/xen-gnttab-query.c | 45 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 tools/misc/xen-gnttab-query.c
tools/misc/Makefile +4 -0
@@ -31,6 +31,7 @@ INSTALL_SBIN += xenperf INSTALL_SBIN += xenpm INSTALL_SBIN += xenwatchdogd INSTALL_SBIN += xen-livepatch +INSTALL_SBIN += xen-gnttab-query INSTALL_SBIN += $(INSTALL_SBIN-y) # Everything to be installed in a private bin/
@@ -108,4 +109,7 @@ xen-lowmemd: xen-lowmemd.o xencov: xencov.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) +xen-gnttab-query: xen-gnttab-query.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) + -include $(DEPS)
tools/misc/xen-gnttab-query.c new file +45 -0
45 lines not on this page · raw message
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH 2/2] tools: utility to dump guest grant table info
Quoted 8 lines · Dongli Zhang
tools/misc/xen-gnttab-query.c new file +8
-0+ +int main (int argc,char *argv[]) +{ +xc_interface *xch; +int domid, rc, c; +struct gnttab_query_size query; + +while ( (c =getopt (argc, argv,"h" )) !=-1 )
tools/misc/xen-gnttab-query.c line 29
Quoted 10 lines
tools/misc/xen-gnttab-query.c new file +10
-0+ { +switch ( c ) + { +case 'h' : +show_help (); +return 0 ; + } + } + + domid = (argc >1 ) ?strtol (argv[1 ],NULL ,10 ) :0 ;
This is too simplistic. It basically means ./query -x 100 will not report an error. You should use optind instead. See man 3 getopt for examples.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 2/2] tools: utility to dump guest grant table info
In reply to Dongli ZhangQuoted 6 lines · Dongli Zhang
As both xen-netfront and xen-blkfront support multi-queue, they would consume a lot of grant table references when there are many paravirtual devices and vcpus assigned to guest. Guest domU might panic or hang due to grant allocation failure when
nr_grant_framesin guest has reached its max value.
Quoted 8 lines
This utility would help the administrators to monitor the guest grant table frame usage on dom0 side so that it is not required to debug on guest kernel side for crash/hang analysis anymore.
Signed-off-by Dongli Zhang <[email protected]>--- tools/misc/Makefile | 4 ++++ tools/misc/xen-gnttab-query.c | 45 +++++++++++++++++++++++++++++++++++++++++++
Would this be better name 'xen-diag' or such? And in the future more diagnostic pieces could be added in? For example I can see parts of xen-hptool moving in there.
tools/misc/xen-gnttab-query.c
Quoted 29 lines
2 files changed, 49 insertions(+) create mode 100644 tools/misc/xen-gnttab-query.ctools/misc/Makefile +4
-0@@ -31,6 +31,7 @@ INSTALL_SBIN += xenperf INSTALL_SBIN += xenpm INSTALL_SBIN += xenwatchdogd INSTALL_SBIN += xen-livepatch +INSTALL_SBIN += xen-gnttab-query INSTALL_SBIN += $(INSTALL_SBIN-y) # Everything to be installed in a private bin/@@ -108,4 +109,7 @@ xen-lowmemd: xen-lowmemd.o xencov: xencov.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) +xen-gnttab-query: xen-gnttab-query.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) + -include $(DEPS)tools/misc/xen-gnttab-query.c new file +0
-0@@ -0,0 +1,45 @@
Please add Oracle's copyright (see the xen-livepatch.c for example).
Quoted 53 lines
tools/misc/xen-gnttab-query.c new file +45
-0+#include <stdio.h> +#include <stdlib.h> +#include <err.h> +#include <xenctrl.h> + +void show_help (void ) +{ +fprintf (stderr, +"xen-gnttab-query: query grant table info\n" +"Usage: xen-gnttab-query [domid (default 0)]\n" ); +} + +int main (int argc,char *argv[]) +{ +xc_interface *xch; +int domid, rc, c; +struct gnttab_query_size query; + +while ( (c =getopt (argc, argv,"h" )) !=-1 ) + { +switch ( c ) + { +case 'h' : +show_help (); +return 0 ; + } + } + + domid = (argc >1 ) ?strtol (argv[1 ],NULL ,10 ) :0 ; + + xch =xc_interface_open (0 ,0 ,0 ); +if ( !xch ) +errx (1 ,"failed to open control interface" ); + + query.dom = domid; + rc =xc_gnttab_query_size (xch, &query); + +if ( rc ==0 && (query.status == GNTST_okay) ) +printf ("domid=%d: nr_frames=%d, max_nr_frames=%d\n" , + query.dom, query.nr_frames, query.max_nr_frames); + +xc_interface_close (xch); + +return 0 ; +}Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 28 lines · Dongli Zhang
This patch adds new interface for
GNTTABOP_query_sizein libxc to help query the current grant table frames and maximum grant table frames for a specific domain.Signed-off-by Dongli Zhang <[email protected]>--- tools/libxc/include/xenctrl.h | 1 + tools/libxc/xc_gnttab.c | 12 ++++++++++++ 2 files changed, 13 insertions(+)tools/libxc/include/xenctrl.h +1
-0@@ -1597,6 +1597,7 @@ int xc_gnttab_op(xc_interface *xch, int cmd, void * op, int op_size, int count);/* Logs iff hypercall bounce fails, otherwise doesn't. */ +int xc_gnttab_query_size (xc_interface *xch,struct gnttab_query_size *query);int xc_gnttab_get_version (xc_interface *xch,int domid);/* Never logs */ grant_entry_v1_t *xc_gnttab_map_table_v1 (xc_interface *xch,int domid,int *gnt_num);grant_entry_v2_t *xc_gnttab_map_table_v2 (xc_interface *xch,int domid,int *gnt_num);tools/libxc/xc_gnttab.c +0
-0@@ -38,6 +38,18 @@ int xc_gnttab_op(xc_interface *xch, int cmd, void * op, int op_size, int count)return ret;
tools/libxc/xc_gnttab.c int xc_gnttab_op(xc_interface *xch, int cmd, void * op, int op_size, int count) · line 48
Quoted 10 lines
tools/libxc/xc_gnttab.c +8
-0} +int xc_gnttab_query_size (xc_interface *xch,struct gnttab_query_size *query) +{ +int rc; + + rc =xc_gnttab_op (xch, GNTTABOP_query_size, query,sizeof (*query),1 ); + +if ( rc || (query->status != GNTST_okay) ) +ERROR ("Could not query dom %d's grant size\n" , query->dom);
%u please.
Otherwise:
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel