diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libxc/xc_memshr.c | 11 | ||||
-rw-r--r-- | tools/libxc/xenctrl.h | 1 | ||||
-rw-r--r-- | tools/tests/mem-sharing/memshrtool.c | 11 |
3 files changed, 23 insertions, 0 deletions
diff --git a/tools/libxc/xc_memshr.c b/tools/libxc/xc_memshr.c index 5866960f38..992b9144e5 100644 --- a/tools/libxc/xc_memshr.c +++ b/tools/libxc/xc_memshr.c @@ -211,6 +211,17 @@ int xc_memshr_debug_gref(xc_interface *xch, return xc_memshr_memop(xch, domid, &mso); } +int xc_memshr_audit(xc_interface *xch) +{ + xen_mem_sharing_op_t mso; + + memset(&mso, 0, sizeof(mso)); + + mso.op = XENMEM_sharing_op_audit; + + return do_memory_op(xch, XENMEM_sharing_op, &mso, sizeof(mso)); +} + long xc_sharing_freed_pages(xc_interface *xch) { return do_memory_op(xch, XENMEM_get_sharing_freed_pages, NULL, 0); diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 371a97f5e8..73d24e53d0 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -1951,6 +1951,7 @@ int xc_memshr_debug_mfn(xc_interface *xch, int xc_memshr_debug_gref(xc_interface *xch, domid_t domid, grant_ref_t gref); +int xc_memshr_audit(xc_interface *xch); int xc_flask_load(xc_interface *xc_handle, char *buf, uint32_t size); int xc_flask_context_to_sid(xc_interface *xc_handle, char *buf, uint32_t size, uint32_t *sid); diff --git a/tools/tests/mem-sharing/memshrtool.c b/tools/tests/mem-sharing/memshrtool.c index a5dfc24f94..db44294230 100644 --- a/tools/tests/mem-sharing/memshrtool.c +++ b/tools/tests/mem-sharing/memshrtool.c @@ -27,6 +27,7 @@ static int usage(const char* prog) printf(" add-to-physmap <domid> <gfn> <source> <source-gfn> <source-handle>\n"); printf(" - Populate a page in a domain with a shared page.\n"); printf(" debug-gfn <domid> <gfn> - Debug a particular domain and gfn.\n"); + printf(" audit - Audit the sharing subsytem in Xen.\n"); return 1; } @@ -160,6 +161,16 @@ int main(int argc, const char** argv) gfn = strtol(argv[3], NULL, 0); R(xc_memshr_debug_gfn(xch, domid, gfn)); } + else if( !strcasecmp(cmd, "audit") ) + { + int rc = xc_memshr_audit(xch); + if ( rc < 0 ) + { + printf("error executing xc_memshr_audit: %s\n", strerror(errno)); + return rc; + } + printf("Audit returned %d errors.\n", rc); + } return 0; } |