Skip to contentSkip to conversation

tools/libxc: add interface for GNTTABOP_query_size

PATCH In review Dongli Zhang 2 participants 6 messages Jul 2, 2017 – Jul 4, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

---
Changed since v1:
* Change %d to %u in ERROR()

---
 tools/libxc/include/xenctrl.h |  1 +
 tools/libxc/xc_gnttab.c       | 12 ++++++++++++
 2 files changed, 13 insertions(+)
tools/libxc/include/xenctrl.h +1 -0
index 1629f41..155c69e 100644
@@ -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
index af53fac..9e6f1fb 100644
@@ -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 %u'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
#1 lore raw

PATCH v2 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 diagnose xen issue. There is only one command gnttab_query_size so far 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.

It is extensible for adding new commands for more diagnostic functions and the framework of xen-diag.c is from xen-livepatch.c.

---
Changed since v1:
* rewrite xen-gnttab-query.c to xen-diag.c based on livepatch.c framework

---
 tools/misc/Makefile   |   4 ++
 tools/misc/xen-diag.c | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 133 insertions(+)
 create mode 100644 tools/misc/xen-diag.c
tools/misc/Makefile +4 -0
index 8152f7b..c1113b9 100644
@@ -31,6 +31,7 @@ INSTALL_SBIN                   += xenperf
 INSTALL_SBIN                   += xenpm
 INSTALL_SBIN                   += xenwatchdogd
 INSTALL_SBIN                   += xen-livepatch
+INSTALL_SBIN                   += xen-diag
 INSTALL_SBIN += $(INSTALL_SBIN-y)
 
 # Everything to be installed in a private bin/
@@ -102,6 +103,9 @@ xenwatchdogd: xenwatchdogd.o
 xen-livepatch: xen-livepatch.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
+xen-diag: xen-diag.o
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
+
 xen-lowmemd: xen-lowmemd.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS)
 
tools/misc/xen-diag.c new file +129 -0

129 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
Acked-by on v2 2/2
#2 lore raw

Re: [PATCH v2 2/2] tools: utility to dump guest grant table info

Quoted 11 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_frames in guest has reached its max value.

This utility would help the administrators to diagnose xen issue. There is only one command gnttab_query_size so far 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.

Quoted 4 lines

It is extensible for adding new commands for more diagnostic functions and the framework of xen-diag.c is from xen-livepatch.c.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw

Re: [PATCH v2 2/2] tools: utility to dump guest grant table info

Hi Wei,

I will send the patch based on staging.

Dongli Zhang

Quoted 8 lines · Wei Liu

I pushed your two patches and discovered you also need to patch .gitignore. Could you please send a patch for that? thanks

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel