[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [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. Signed-off-by: Dongli Zhang <dongli.zhang@xxxxxxxxxx> --- 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 diff --git a/tools/misc/Makefile b/tools/misc/Makefile index 8152f7b..d081b4b 100644 --- a/tools/misc/Makefile +++ b/tools/misc/Makefile @@ -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) diff --git a/tools/misc/xen-gnttab-query.c b/tools/misc/xen-gnttab-query.c new file mode 100644 index 0000000..3f93a6c --- /dev/null +++ b/tools/misc/xen-gnttab-query.c @@ -0,0 +1,45 @@ +#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; +} -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |