enable Memory Bandwidth Monitoring (MBM) for VMs
v3 cover enable Memory Bandwidth Monitoring (MBM) for VMs
Changes from v2:
* Remove the usage of "static" to cache data in xc;
NOTE: Other places that already existed before are not touched due to
the needs for API change. Will fix in separate patch if desirable.
* Coding style;
Changes from v1:
* Move event type check from xc to xl;
* Add retry capability for MBM sampling;
* Fix Coding style/docs;
Intel Memory Bandwidth Monitoring(MBM) is a new hardware feature which builds on the CMT infrastructure to allow monitoring of system memory bandwidth. Event codes are provided to monitor both "total" and "local" bandwidth, meaning bandwidth over QPI and other external links can be monitored.
For XEN, MBM is used to monitor memory bandwidth for VMs. Due to its dependency on CMT, the software also makes use of most of CMT codes. Actually, besides introducing two additional events and some cpuid feature bits, there are no extra changes compared to cache occupancy monitoring in CMT. Due to this, CMT should be enabled first to use this feature.
For interface changes, the patch serial only introduces a new command "XEN_SYSCTL_PSR_CMT_get_l3_event_mask" which exposes MBM feature capability to user space and introduces two additional options for "xl psr-cmt-show":
total_mem_bandwidth: Show total memory bandwidth local_mem_bandwidth: Show local memory bandwidth
The usage flow keeps the same with CMT.
Chao Peng (5):
x86: expose CMT L3 event mask to user space
tools: add routine to get CMT L3 event mask
tools: correct coding style for psr
tools: code refactoring for MBM
tools: add total/local memory bandwith monitoring
docs/man/xl.pod.1 | 9 +++ tools/libxc/include/xenctrl.h | 11 ++-- tools/libxc/xc_psr.c | 35 ++++++++-- tools/libxl/libxl.h | 20 ++++-- tools/libxl/libxl_psr.c | 142 +++++++++++++++++++++++++++++++++++++---- tools/libxl/libxl_types.idl | 2 + tools/libxl/xl_cmdimpl.c | 72 +++++++++++++++------ tools/libxl/xl_cmdtable.c | 4 +- xen/arch/x86/sysctl.c | 3 + xen/include/public/sysctl.h | 1 + 10 files changed, 251 insertions(+), 48 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v3 1/5 x86: expose CMT L3 event mask to user space
L3 event mask indicates the event types supported in host, including cache occupancy event as well as local/total memory bandwidth events for Memory Bandwidth Monitoring(MBM). Expose it so all these events can be monitored in user space.
--- xen/arch/x86/sysctl.c | 3 +++ xen/include/public/sysctl.h | 1 + 2 files changed, 4 insertions(+)
xen/arch/x86/sysctl.c +3 -0
@@ -157,6 +157,9 @@ long arch_do_sysctl( sysctl->u.psr_cmt_op.u.data = (ret ?0 : info.size);break ; } +case XEN_SYSCTL_PSR_CMT_get_l3_event_mask: + sysctl->u.psr_cmt_op.u.data = psr_cmt->l3.features; +break ;default : sysctl->u.psr_cmt_op.u.data =0 ; ret = -ENOSYS ;
xen/include/public/sysctl.h +1 -0
@@ -641,6 +641,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_sysctl_coverage_op_t);/* The L3 cache size is returned in KB unit */ #define XEN_SYSCTL_PSR_CMT_get_l3_cache_size 2#define XEN_SYSCTL_PSR_CMT_enabled 3 +#define XEN_SYSCTL_PSR_CMT_get_l3_event_mask 4struct xen_sysctl_psr_cmt_op {uint32_t cmd;/* IN: XEN_SYSCTL_PSR_CMT_* */ uint32_t flags;/* padding variable, may be extended for future use */
Signature · 1 line
1.7.9.5
PATCH v3 2/5 tools: add routine to get CMT L3 event mask
In reply to Chao PengThis is the tools side wrapper for XEN_SYSCTL_PSR_CMT_get_l3_event_mask of XEN_SYSCTL_psr_cmt_op.
--- tools/libxc/include/xenctrl.h | 1 + tools/libxc/xc_psr.c | 17 +++++++++++++++++ tools/libxl/libxl.h | 1 + tools/libxl/libxl_psr.c | 15 +++++++++++++++ 4 files changed, 34 insertions(+)
tools/libxc/include/xenctrl.h +1 -0
@@ -2697,6 +2697,7 @@ int xc_psr_cmt_get_domain_rmid(xc_interface *xch, uint32_t domid,int xc_psr_cmt_get_total_rmid (xc_interface *xch,uint32_t *total_rmid);int xc_psr_cmt_get_l3_upscaling_factor (xc_interface *xch,uint32_t *upscaling_factor); +int xc_psr_cmt_get_l3_event_mask (xc_interface *xch,uint32_t *event_mask);int xc_psr_cmt_get_l3_cache_size (xc_interface *xch,uint32_t cpu,uint32_t *l3_cache_size); int xc_psr_cmt_get_data(xc_interface *xch, uint32_t rmid,
tools/libxc/xc_psr.c +17 -0
@@ -112,6 +112,23 @@ int xc_psr_cmt_get_l3_upscaling_factor(xc_interface *xch,return rc; } +int xc_psr_cmt_get_l3_event_mask (xc_interface *xch,uint32_t *event_mask) +{ +int rc; +DECLARE_SYSCTL ; + + sysctl.cmd = XEN_SYSCTL_psr_cmt_op; + sysctl.u.psr_cmt_op.cmd = + XEN_SYSCTL_PSR_CMT_get_l3_event_mask; + sysctl.u.psr_cmt_op.flags =0 ; + + rc =xc_sysctl (xch, &sysctl); +if ( !rc ) + *event_mask = sysctl.u.psr_cmt_op.u.data; + +return rc; +} +int xc_psr_cmt_get_l3_cache_size (xc_interface *xch,uint32_t cpu,uint32_t *l3_cache_size) {
tools/libxl/libxl.h +1 -0
@@ -1456,6 +1456,7 @@ int libxl_psr_cmt_enabled(libxl_ctx *ctx);int libxl_psr_cmt_get_total_rmid (libxl_ctx *ctx,uint32_t *total_rmid);int libxl_psr_cmt_get_l3_cache_size (libxl_ctx *ctx,uint32_t socketid,uint32_t *l3_cache_size); +int libxl_psr_cmt_get_l3_event_mask (libxl_ctx *ctx,uint32_t *event_mask);int libxl_psr_cmt_get_cache_occupancy (libxl_ctx *ctx,uint32_t domid,uint32_t socketid,uint32_t *l3_cache_occupancy);#endif
tools/libxl/libxl_psr.c +15 -0
@@ -160,6 +160,21 @@ out:return rc; } +int libxl_psr_cmt_get_l3_event_mask (libxl_ctx *ctx,uint32_t *event_mask) +{ +GC_INIT (ctx); +int rc; + + rc =xc_psr_cmt_get_l3_event_mask (ctx->xch, event_mask); +if (rc <0 ) { +libxl__psr_cmt_log_err_msg (gc, errno); + rc =ERROR_FAIL ; + } + +GC_FREE ; +return rc; +} +int libxl_psr_cmt_get_cache_occupancy (libxl_ctx *ctx,uint32_t domid,uint32_t socketid,uint32_t *l3_cache_occupancy) {
Signature · 1 line
1.7.9.5
PATCH v3 3/5 tools: correct coding style for psr
In reply to Chao Peng- space: remove space after '(' or before ')' in 'if' condition;
- indention: align function definition/call arguments;
--- tools/libxc/include/xenctrl.h | 8 ++++---- tools/libxc/xc_psr.c | 10 +++++----- tools/libxl/libxl.h | 11 +++++++---- tools/libxl/libxl_psr.c | 11 +++++++---- tools/libxl/xl_cmdimpl.c | 11 ++++++----- 5 files changed, 29 insertions(+), 22 deletions(-)
tools/libxc/include/xenctrl.h +4 -4
@@ -2693,15 +2693,15 @@ typedef enum xc_psr_cmt_type xc_psr_cmt_type;int xc_psr_cmt_attach (xc_interface *xch,uint32_t domid);int xc_psr_cmt_detach (xc_interface *xch,uint32_t domid);int xc_psr_cmt_get_domain_rmid (xc_interface *xch,uint32_t domid, -uint32_t *rmid); +uint32_t *rmid);int xc_psr_cmt_get_total_rmid (xc_interface *xch,uint32_t *total_rmid);int xc_psr_cmt_get_l3_upscaling_factor (xc_interface *xch, -uint32_t *upscaling_factor); +uint32_t *upscaling_factor);int xc_psr_cmt_get_l3_event_mask (xc_interface *xch,uint32_t *event_mask);int xc_psr_cmt_get_l3_cache_size (xc_interface *xch,uint32_t cpu,uint32_t *l3_cache_size); -int xc_psr_cmt_get_data (xc_interface *xch,uint32_t rmid, -uint32_t cpu,uint32_t psr_cmt_type,uint64_t *monitor_data); +int xc_psr_cmt_get_data (xc_interface *xch,uint32_t rmid,uint32_t cpu, +uint32_t psr_cmt_type,uint64_t *monitor_data);int xc_psr_cmt_enabled (xc_interface *xch);#endif
tools/libxc/xc_psr.c +5 -5
@@ -47,7 +47,7 @@ int xc_psr_cmt_detach(xc_interface *xch, uint32_t domid) }int xc_psr_cmt_get_domain_rmid (xc_interface *xch,uint32_t domid, -uint32_t *rmid) +uint32_t *rmid) {int rc;DECLARE_DOMCTL ;
@@ -88,7 +88,7 @@ int xc_psr_cmt_get_total_rmid(xc_interface *xch, uint32_t *total_rmid) }int xc_psr_cmt_get_l3_upscaling_factor (xc_interface *xch, -uint32_t *upscaling_factor) +uint32_t *upscaling_factor) {static int val =0 ;int rc;
@@ -130,7 +130,7 @@ int xc_psr_cmt_get_l3_event_mask(xc_interface *xch, uint32_t *event_mask) }int xc_psr_cmt_get_l3_cache_size (xc_interface *xch,uint32_t cpu, -uint32_t *l3_cache_size) +uint32_t *l3_cache_size) {static int val =0 ;int rc;
@@ -155,8 +155,8 @@ int xc_psr_cmt_get_l3_cache_size(xc_interface *xch, uint32_t cpu,return rc; } -int xc_psr_cmt_get_data (xc_interface *xch,uint32_t rmid, -uint32_t cpu,xc_psr_cmt_type type,uint64_t *monitor_data) +int xc_psr_cmt_get_data (xc_interface *xch,uint32_t rmid,uint32_t cpu, +xc_psr_cmt_type type,uint64_t *monitor_data) {xc_resource_op_t op;xc_resource_entry_t entries[2 ];
tools/libxl/libxl.h +7 -4
@@ -1454,11 +1454,14 @@ int libxl_psr_cmt_detach(libxl_ctx *ctx, uint32_t domid);int libxl_psr_cmt_domain_attached (libxl_ctx *ctx,uint32_t domid);int libxl_psr_cmt_enabled (libxl_ctx *ctx);int libxl_psr_cmt_get_total_rmid (libxl_ctx *ctx,uint32_t *total_rmid); -int libxl_psr_cmt_get_l3_cache_size (libxl_ctx *ctx,uint32_t socketid, -uint32_t *l3_cache_size); +int libxl_psr_cmt_get_l3_cache_size (libxl_ctx *ctx, +uint32_t socketid, +uint32_t *l3_cache_size);int libxl_psr_cmt_get_l3_event_mask (libxl_ctx *ctx,uint32_t *event_mask); -int libxl_psr_cmt_get_cache_occupancy (libxl_ctx *ctx,uint32_t domid, -uint32_t socketid,uint32_t *l3_cache_occupancy); +int libxl_psr_cmt_get_cache_occupancy (libxl_ctx *ctx, +uint32_t domid, +uint32_t socketid, +uint32_t *l3_cache_occupancy);#endif /* misc */
tools/libxl/libxl_psr.c +7 -4
@@ -135,8 +135,9 @@ int libxl_psr_cmt_get_total_rmid(libxl_ctx *ctx, uint32_t *total_rmid)return rc; } -int libxl_psr_cmt_get_l3_cache_size (libxl_ctx *ctx,uint32_t socketid, -uint32_t *l3_cache_size) +int libxl_psr_cmt_get_l3_cache_size (libxl_ctx *ctx, +uint32_t socketid, +uint32_t *l3_cache_size) {GC_INIT (ctx);
@@ -175,8 +176,10 @@ int libxl_psr_cmt_get_l3_event_mask(libxl_ctx *ctx, uint32_t *event_mask)return rc; } -int libxl_psr_cmt_get_cache_occupancy (libxl_ctx *ctx,uint32_t domid, -uint32_t socketid,uint32_t *l3_cache_occupancy) +int libxl_psr_cmt_get_cache_occupancy (libxl_ctx *ctx, +uint32_t domid, +uint32_t socketid, +uint32_t *l3_cache_occupancy) {GC_INIT (ctx);
tools/libxl/xl_cmdimpl.c +6 -5
@@ -7847,7 +7847,7 @@ out:#ifdef LIBXL_HAVE_PSR_CMT static void psr_cmt_print_domain_cache_occupancy (libxl_dominfo *dominfo, -uint32_t nr_sockets) +uint32_t nr_sockets) {char *domain_name;uint32_t socketid;
@@ -7861,8 +7861,8 @@ static void psr_cmt_print_domain_cache_occupancy(libxl_dominfo *dominfo,free (domain_name);for (socketid =0 ; socketid < nr_sockets; socketid++) { -if ( !libxl_psr_cmt_get_cache_occupancy (ctx, dominfo->domid, - socketid, &l3_cache_occupancy) ) +if (!libxl_psr_cmt_get_cache_occupancy (ctx, dominfo->domid, socketid, + &l3_cache_occupancy))printf ("%13u KB" , l3_cache_occupancy); }
@@ -7910,8 +7910,9 @@ static int psr_cmt_show_cache_occupancy(uint32_t domid)for (socketid =0 ; socketid < nr_sockets; socketid++) { rc =libxl_psr_cmt_get_l3_cache_size (ctx, socketid, &l3_cache_size);if (rc <0 ) { -fprintf (stderr,"Failed to get system l3 cache size for socket:%d\n" , - socketid); +fprintf (stderr, +"Failed to get system l3 cache size for socket:%d\n" , + socketid);return -1 ; }printf ("%13u KB" , l3_cache_size);
Signature · 1 line
1.7.9.5
PATCH v3 4/5 tools: code refactoring for MBM
In reply to Chao PengMake some internal routines common so that total/local memory bandwidth monitoring in the next patch can make use of them.
--- tools/libxl/libxl_psr.c | 44 ++++++++++++++++++++++++------------- tools/libxl/xl_cmdimpl.c | 54 +++++++++++++++++++++++++++------------------- 2 files changed, 61 insertions(+), 37 deletions(-)
tools/libxl/libxl_psr.c +29 -15
@@ -176,20 +176,16 @@ int libxl_psr_cmt_get_l3_event_mask(libxl_ctx *ctx, uint32_t *event_mask)return rc; } -int libxl_psr_cmt_get_cache_occupancy (libxl_ctx *ctx, -uint32_t domid, -uint32_t socketid, -uint32_t *l3_cache_occupancy) +static int libxl__psr_cmt_get_l3_monitoring_data (libxl__gc *gc, +uint32_t domid, +xc_psr_cmt_type type, +uint32_t socketid, +uint64_t *data) { -GC_INIT (ctx); -unsigned int rmid; -uint32_t upscaling_factor; -uint64_t monitor_data;int cpu, rc; -xc_psr_cmt_type type; - rc =xc_psr_cmt_get_domain_rmid (ctx->xch, domid, &rmid); + rc =xc_psr_cmt_get_domain_rmid (CTX ->xch, domid, &rmid);if (rc <0 || rmid ==0 ) {LOGE (ERROR ,"fail to get the domain rmid, " "or domain is not attached with platform QoS monitoring service" );
@@ -204,14 +200,32 @@ int libxl_psr_cmt_get_cache_occupancy(libxl_ctx *ctx, goto out; } - type =XC_PSR_CMT_L3_OCCUPANCY ; - rc =xc_psr_cmt_get_data (ctx->xch, rmid, cpu, type, &monitor_data); + rc =xc_psr_cmt_get_data (CTX ->xch, rmid, cpu, type, data);if (rc <0 ) {LOGE (ERROR ,"failed to get monitoring data" ); rc =ERROR_FAIL ; - goto out; } +out: +return rc; +} + +int libxl_psr_cmt_get_cache_occupancy (libxl_ctx *ctx, +uint32_t domid, +uint32_t socketid, +uint32_t *l3_cache_occupancy) +{ +GC_INIT (ctx); +uint64_t data; +uint32_t upscaling_factor; +int rc; + + rc =libxl__psr_cmt_get_l3_monitoring_data (gc, domid, +XC_PSR_CMT_L3_OCCUPANCY , + socketid, &data); +if (rc <0 ) + goto out; + rc =xc_psr_cmt_get_l3_upscaling_factor (ctx->xch, &upscaling_factor);if (rc <0 ) {LOGE (ERROR ,"failed to get L3 upscaling factor" );
@@ -219,8 +233,8 @@ int libxl_psr_cmt_get_cache_occupancy(libxl_ctx *ctx, goto out; } - *l3_cache_occupancy = upscaling_factor * monitor_data /1024 ; - rc =0 ; + *l3_cache_occupancy = upscaling_factor * data /1024 ; + out:GC_FREE ;return rc;
tools/libxl/xl_cmdimpl.c +32 -22
99 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v3 5/5 tools: add total/local memory bandwith monitoring
In reply to Chao PengAdd Memory Bandwidth Monitoring(MBM) for VMs. Two types of monitoring are supported: total and local memory bandwidth monitoring. To use it, CMT should be enabled in hypervisor.
--- docs/man/xl.pod.1 | 9 +++++ tools/libxc/include/xenctrl.h | 2 + tools/libxc/xc_psr.c | 8 ++++ tools/libxl/libxl.h | 8 ++++ tools/libxl/libxl_psr.c | 84 +++++++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_types.idl | 2 + tools/libxl/xl_cmdimpl.c | 21 ++++++++++- tools/libxl/xl_cmdtable.c | 4 +- 8 files changed, 136 insertions(+), 2 deletions(-)
docs/man/xl.pod.1 +9 -0
@@ -1461,6 +1461,13 @@ is domain level. To monitor a specific domain, just attach the domain id with the monitoring service. When the domain doesn't need to be monitored any more, detach the domain id from the monitoring service. +Intel Broadwell and later server platforms also offer total/local memory +bandwidth monitoring. Xen supports per-domain monitoring for these two +additional monitoring types. Both memory bandwidth monitoring and L3 cache +occupancy monitoring share the same set of underground monitoring service. Once +a domain is attached to the monitoring service, monitoring data can be showed +for any of these monitoring types. + =over 4 =item B<psr-cmt-attach> [I<domain-id>]
@@ -1476,6 +1483,8 @@ detach: Detach the platform shared resource monitoring service from a domain. Show monitoring data for a certain domain or all domains. Current supported monitor types are: - "cache-occupancy": showing the L3 cache occupancy. + - "total-mem-bandwidth": showing the total memory bandwidth. + - "local-mem-bandwidth": showing the local memory bandwidth. =back
tools/libxc/include/xenctrl.h +2 -0
@@ -2688,6 +2688,8 @@ int xc_resource_op(xc_interface *xch, uint32_t nr_ops, xc_resource_op_t *ops);#if defined(__i386__) || defined(__x86_64__)enum xc_psr_cmt_type {XC_PSR_CMT_L3_OCCUPANCY , +XC_PSR_CMT_TOTAL_MEM_BANDWIDTH , +XC_PSR_CMT_LOCAL_MEM_BANDWIDTH , };typedef enum xc_psr_cmt_type xc_psr_cmt_type ;int xc_psr_cmt_attach (xc_interface *xch,uint32_t domid);
tools/libxc/xc_psr.c +8 -0
@@ -23,6 +23,8 @@#define IA32_CMT_CTR_ERROR_MASK (0x3ull << 62)#define EVTID_L3_OCCUPANCY 0x1 +#define EVTID_TOTAL_MEM_BANDWIDTH 0x2 +#define EVTID_LOCAL_MEM_BANDWIDTH 0x3int xc_psr_cmt_attach (xc_interface *xch,uint32_t domid) {
@@ -168,6 +170,12 @@ int xc_psr_cmt_get_data(xc_interface *xch, uint32_t rmid, uint32_t cpu,case XC_PSR_CMT_L3_OCCUPANCY : evtid =EVTID_L3_OCCUPANCY ;break ; +case XC_PSR_CMT_TOTAL_MEM_BANDWIDTH : + evtid =EVTID_TOTAL_MEM_BANDWIDTH ; +break ; +case XC_PSR_CMT_LOCAL_MEM_BANDWIDTH : + evtid =EVTID_LOCAL_MEM_BANDWIDTH ; +break ;default :return -1 ; }
tools/libxl/libxl.h +8 -0
@@ -1462,6 +1462,14 @@ int libxl_psr_cmt_get_cache_occupancy(libxl_ctx *ctx,uint32_t domid, uint32_t socketid, uint32_t *l3_cache_occupancy); +int libxl_psr_cmt_get_total_mem_bandwidth (libxl_ctx *ctx, +uint32_t domid, +uint32_t socketid, +uint32_t *bandwidth); +int libxl_psr_cmt_get_local_mem_bandwidth (libxl_ctx *ctx, +uint32_t domid, +uint32_t socketid, +uint32_t *bandwidth);#endif /* misc */
tools/libxl/libxl_psr.c +84 -0
96 lines not on this page · raw message
tools/libxl/libxl_types.idl +2 -0
@@ -693,4 +693,6 @@ libxl_event = Struct("event",[ libxl_psr_cmt_type = Enumeration("psr_cmt_type", [ (1, "CACHE_OCCUPANCY"), + (2, "TOTAL_MEM_BANDWIDTH"), + (3, "LOCAL_MEM_BANDWIDTH"), ])
tools/libxl/xl_cmdimpl.c +20 -1
@@ -7868,6 +7868,16 @@ static void psr_cmt_print_domain_l3_info(libxl_dominfo *dominfo, socketid, &data))printf ("%13u KB" , data);break ; +case LIBXL_PSR_CMT_TYPE_TOTAL_MEM_BANDWIDTH : +if (!libxl_psr_cmt_get_total_mem_bandwidth (ctx, dominfo->domid, + socketid, &data)) +printf ("%11u KB/s" , data); +break ; +case LIBXL_PSR_CMT_TYPE_LOCAL_MEM_BANDWIDTH : +if (!libxl_psr_cmt_get_local_mem_bandwidth (ctx, dominfo->domid, + socketid, &data)) +printf ("%11u KB/s" , data); +break ;default :return ; }
@@ -7879,7 +7889,7 @@ static void psr_cmt_print_domain_l3_info(libxl_dominfo *dominfo,static int psr_cmt_show_l3_info (libxl_psr_cmt_type type,uint32_t domid) {uint32_t i, socketid, nr_sockets, total_rmid; -uint32_t l3_cache_size; +uint32_t l3_cache_size, l3_event_mask;libxl_physinfo info;int rc, nr_domains;
@@ -7888,6 +7898,13 @@ static int psr_cmt_show_l3_info(libxl_psr_cmt_type type, uint32_t domid)return -1 ; } + rc =libxl_psr_cmt_get_l3_event_mask (ctx, &l3_event_mask); +if (rc <0 || !(l3_event_mask & (1 << (type -1 )))) { +fprintf (stderr,"Monitor type '%s' is not supported in the system\n" , +libxl_psr_cmt_type_to_string (type)); +return -1 ; + } +libxl_physinfo_init (&info); rc =libxl_get_physinfo (ctx, &info);if (rc <0 ) {
@@ -8005,6 +8022,8 @@ int main_psr_cmt_show(int argc, char **argv)switch (type) {case LIBXL_PSR_CMT_TYPE_CACHE_OCCUPANCY : +case LIBXL_PSR_CMT_TYPE_TOTAL_MEM_BANDWIDTH : +case LIBXL_PSR_CMT_TYPE_LOCAL_MEM_BANDWIDTH : ret =psr_cmt_show_l3_info (type, domid);break ;default :
tools/libxl/xl_cmdtable.c +3 -1
@@ -538,7 +538,9 @@ struct cmd_spec cmd_table[] = {"Show Cache Monitoring Technology information" ,"<PSR-CMT-Type> <Domain>" ,"Available monitor types:\n" - "\"cache_occupancy\": Show L3 cache occupancy\n", +"\"cache_occupancy\": Show L3 cache occupancy\n" +"\"total_mem_bandwidth\": Show total memory bandwidth\n" + "\"local_mem_bandwidth\": Show local memory bandwidth\n", }, #endif };
Signature · 1 line
1.7.9.5
Re: [PATCH v3 1/5] x86: expose CMT L3 event mask to user space
In reply to Chao PengQuoted 9 lines
Quoted 1 line
Quoted 1 line · On 13.01.15 at 09:02, <[email protected]> wrote:
L3 event mask indicates the event types supported in host, including cache occupancy event as well as local/total memory bandwidth events for Memory Bandwidth Monitoring(MBM). Expose it so all these events can be monitored in user space.
Signed-off-by Chao Peng <[email protected]>Reviewed-by Andrew Cooper <[email protected]>Acked-by Jan Beulich <[email protected]>
Please don't re-send patches already applied.
Jan
Re: [PATCH v3 1/5] x86: expose CMT L3 event mask to user space
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 13.01.15 at 09:02, <[email protected]> wrote:
L3 event mask indicates the event types supported in host, including cache occupancy event as well as local/total memory bandwidth events for Memory Bandwidth Monitoring(MBM). Expose it so all these events can be monitored in user space.
Quoted 6 lines
Quoted 3 lines
Signed-off-by Chao Peng <[email protected]>Reviewed-by Andrew Cooper <[email protected]>Acked-by Jan Beulich <[email protected]>Please don't re-send patches already applied.
Oh, sorry! Just noticed it's already in.
Chao
Quoted 6 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 4/5] tools: code refactoring for MBM
In reply to Chao PengQuoted 4 lines · Chao Peng
Make some internal routines common so that total/local memory bandwidth monitoring in the next patch can make use of them.
Signed-off-by Chao Peng <[email protected]>
Could you please in your later patch submission include short change log int the commit message so that reviewers can know what has changed.
The change log can be separated with "---" so they do appear in the commit message in tree.
Wei.
Re: [PATCH v3 5/5] tools: add total/local memory bandwith monitoring
In reply to Chao PengQuoted 21 lines · Chao Peng
Add Memory Bandwidth Monitoring(MBM) for VMs. Two types of monitoring are supported: total and local memory bandwidth monitoring. To use it, CMT should be enabled in hypervisor.
Signed-off-by Chao Peng <[email protected]>--- docs/man/xl.pod.1 | 9 +++++ tools/libxc/include/xenctrl.h | 2 + tools/libxc/xc_psr.c | 8 ++++ tools/libxl/libxl.h | 8 ++++ tools/libxl/libxl_psr.c | 84 +++++++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_types.idl | 2 + tools/libxl/xl_cmdimpl.c | 21 ++++++++++- tools/libxl/xl_cmdtable.c | 4 +- 8 files changed, 136 insertions(+), 2 deletions(-)docs/man/xl.pod.1 +0
-0
docs/man/xl.pod.1 is domain level. To monitor a specific domain, just attach the domain id with · line 1467
Quoted 7 lines
docs/man/xl.pod.1 +4
-0@@ -1461,6 +1461,13 @@ is domain level. To monitor a specific domain, just attach the domain id with the monitoring service. When the domain doesn't need to be monitored any more, detach the domain id from the monitoring service. +Intel Broadwell and later server platforms also offer total/local memory +bandwidth monitoring. Xen supports per-domain monitoring for these two +additional monitoring types. Both memory bandwidth monitoring and L3 cache +occupancy monitoring share the same set of underground monitoring service. Once
^^^^^^^^^^^
underlying?I'm not native speaker though. I will defer reviewing this paragraph to a native English speaker.
Quoted 5 lines
docs/man/xl.pod.1 +3
-0+a domain is attached to the monitoring service, monitoring data can be showed +for any of these monitoring types. + =over 4
[...]
Quoted 19 lines
docs/man/xl.pod.1 +19
-0+static int libxl__psr_cmt_get_mem_bandwidth(libxl__gc *gc, + uint32_t domid, + xc_psr_cmt_type type, + uint32_t socketid, + uint32_t *bandwidth) +{ + uint64_t sample1, sample2; + uint32_t upscaling_factor; + int retry_attempts = 0; + int rc; + + do { + rc = libxl__psr_cmt_get_l3_monitoring_data(gc, domid, type, socketid, + &sample1); + if (rc < 0) { + rc = ERROR_FAIL; + goto out; + } +
docs/man/xl.pod.1
Quoted 10 lines
docs/man/xl.pod.1 +10
-0+ usleep(10000); + + rc = libxl__psr_cmt_get_l3_monitoring_data(gc, domid, type, socketid, + &sample2); + if (rc < 0) { + rc = ERROR_FAIL; + goto out; + } + + if (sample2 >= sample1)
If sample2 == sample1 then bandwidth is zero. Is this expected?
docs/man/xl.pod.1
Quoted 11 lines
docs/man/xl.pod.1 +11
-0+ break; + + if (retry_attempts < MBM_SAMPLE_RETRY_MAX) { + retry_attempts++; + } else { + LOGE(ERROR, "event counter overflowed"); + rc = ERROR_FAIL; + goto out; + } + + } while(1);
Minor nit, should be "while (1)".
The rest of this patch looks OK to me.
Wei.
Re: [PATCH v3 4/5] tools: code refactoring for MBM
In reply to Wei LiuQuoted 6 lines · Wei Liu
Quoted 4 lines · Chao Peng
Make some internal routines common so that total/local memory bandwidth monitoring in the next patch can make use of them.
Signed-off-by Chao Peng <[email protected]>
Quoted 8 lines
Acked-by Wei Liu <[email protected]>Could you please in your later patch submission include short change log int the commit message so that reviewers can know what has changed.
The change log can be separated with "---" so they do appear in the commit message in tree.
Thanks Wei. I added the change logs in the cover letter for the whole patch serial. But your suggestion is valuable as we can add more detail change logs on per-patch base. I will take your VNUMA patch as an example :)
Chao
Quoted 5 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel