From: Chao Peng Date: Thu, 9 Jul 2015 08:54:12 +0000 (+0800) Subject: tools/libxl: add command to show PSR hardware info X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~2881 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b128c388e9fdd81111d1b0b30b64d63261e20397;p=xen.git tools/libxl: add command to show PSR hardware info Add dedicated one to show hardware information. [root@vmm-psr]xl psr-hwinfo Cache Monitoring Technology (CMT): Enabled : 1 Total RMID : 63 Supported monitor types: cache-occupancy total-mem-bandwidth local-mem-bandwidth Signed-off-by: Chao Peng Reviewed-by: Dario Faggioli Acked-by: Ian Campbell --- diff --git a/docs/man/xl.pod.1 b/docs/man/xl.pod.1 index 7951affa30..f37b5c7e96 100644 --- a/docs/man/xl.pod.1 +++ b/docs/man/xl.pod.1 @@ -1460,6 +1460,10 @@ for any of these monitoring types. =over 4 +=item B + +Show CMT hardware information. + =item B [I] attach: Attach the platform shared resource monitoring service to a domain. diff --git a/tools/libxl/xl.h b/tools/libxl/xl.h index fe44b86d7c..1df732d320 100644 --- a/tools/libxl/xl.h +++ b/tools/libxl/xl.h @@ -112,6 +112,7 @@ int main_remus(int argc, char **argv); #endif int main_devd(int argc, char **argv); #ifdef LIBXL_HAVE_PSR_CMT +int main_psr_hwinfo(int argc, char **argv); int main_psr_cmt_attach(int argc, char **argv); int main_psr_cmt_detach(int argc, char **argv); int main_psr_cmt_show(int argc, char **argv); diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 274fd088c9..330f8f293c 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -7974,6 +7974,36 @@ out: } #ifdef LIBXL_HAVE_PSR_CMT +static int psr_cmt_hwinfo(void) +{ + int rc; + int enabled; + uint32_t total_rmid; + + printf("Cache Monitoring Technology (CMT):\n"); + + enabled = libxl_psr_cmt_enabled(ctx); + printf("%-16s: %s\n", "Enabled", enabled ? "1" : "0"); + if (!enabled) + return 0; + + rc = libxl_psr_cmt_get_total_rmid(ctx, &total_rmid); + if (rc) { + fprintf(stderr, "Failed to get max RMID value\n"); + return rc; + } + printf("%-16s: %u\n", "Total RMID", total_rmid); + + printf("Supported monitor types:\n"); + if (libxl_psr_cmt_type_supported(ctx, LIBXL_PSR_CMT_TYPE_CACHE_OCCUPANCY)) + printf("cache-occupancy\n"); + if (libxl_psr_cmt_type_supported(ctx, LIBXL_PSR_CMT_TYPE_TOTAL_MEM_COUNT)) + printf("total-mem-bandwidth\n"); + if (libxl_psr_cmt_type_supported(ctx, LIBXL_PSR_CMT_TYPE_LOCAL_MEM_COUNT)) + printf("local-mem-bandwidth\n"); + + return rc; +} #define MBM_SAMPLE_RETRY_MAX 4 static int psr_cmt_get_mem_bandwidth(uint32_t domid, @@ -8140,6 +8170,17 @@ static int psr_cmt_show(libxl_psr_cmt_type type, uint32_t domid) return 0; } +int main_psr_hwinfo(int argc, char **argv) +{ + int opt; + + SWITCH_FOREACH_OPT(opt, "", NULL, "psr-hwinfo", 0) { + /* No options */ + } + + return psr_cmt_hwinfo(); +} + int main_psr_cmt_attach(int argc, char **argv) { uint32_t domid; diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c index 426981373b..b0ab62a73e 100644 --- a/tools/libxl/xl_cmdtable.c +++ b/tools/libxl/xl_cmdtable.c @@ -509,6 +509,11 @@ struct cmd_spec cmd_table[] = { "-F Run in the foreground", }, #ifdef LIBXL_HAVE_PSR_CMT + { "psr-hwinfo", + &main_psr_hwinfo, 0, 1, + "Show hardware information for Platform Shared Resource", + "", + }, { "psr-cmt-attach", &main_psr_cmt_attach, 0, 1, "Attach Cache Monitoring Technology service to a domain",