[libvirt] [PATCH 0/7] perf: add CACHE_L1D perf event support

This patch series adds support and documentation for a generalized hardware cache event called CACHE_L1D perf event. This perf event is split into cache_l1dra, cache_l1drm, cache_l1dwa, cache_l1dwm, cache_l1dpa and cache_l1dpm perf events depending on the config value set. Nitesh Konkar (7): perf: add cache_l1dra perf event support perf: add cache_l1drm perf event support perf: add cache_l1dwa perf event support perf: add cache_l1dwm perf event support perf: add cache_l1dpa perf event support perf: add cache_l1dpm perf event support virsh: Fix manpage typo docs/formatdomain.html.in | 42 ++++++++++++++++++ docs/news.xml | 6 ++- docs/schemas/domaincommon.rng | 6 +++ include/libvirt/libvirt-domain.h | 66 +++++++++++++++++++++++++++++ src/libvirt-domain.c | 18 ++++++++ src/qemu/qemu_driver.c | 6 +++ src/remote/remote_protocol.x | 2 +- src/util/virperf.c | 34 ++++++++++++++- src/util/virperf.h | 6 +++ tests/genericxml2xmlindata/generic-perf.xml | 6 +++ tools/virsh.pod | 26 ++++++++++-- 11 files changed, 210 insertions(+), 8 deletions(-) -- 1.9.3

This patch adds support and documentation for a generalized hardware cache event named as cache_l1dra perf event for measuring read accesses on level 1 data cache Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com> --- docs/formatdomain.html.in | 7 +++++++ docs/news.xml | 4 ++-- docs/schemas/domaincommon.rng | 1 + include/libvirt/libvirt-domain.h | 11 +++++++++++ src/libvirt-domain.c | 3 +++ src/qemu/qemu_driver.c | 1 + src/util/virperf.c | 8 +++++++- src/util/virperf.h | 1 + tests/genericxml2xmlindata/generic-perf.xml | 1 + tools/virsh.pod | 5 ++++- 10 files changed, 38 insertions(+), 4 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 3f7f875..20ef976 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1937,6 +1937,7 @@ <event name='stalled_cycles_frontend' enabled='no'/> <event name='stalled_cycles_backend' enabled='no'/> <event name='ref_cpu_cycles' enabled='no'/> + <event name='cache_l1dra' enabled='no'/> </perf> ... </pre> @@ -2015,6 +2016,12 @@ by applications running on the platform</td> <td><code>perf.ref_cpu_cycles</code></td> </tr> + <tr> + <td><code>cache_l1dra</code></td> + <td>the count of total read accesses for level 1 data cache by + applications running on the platform</td> + <td><code>perf.cache_l1dra</code></td> + </tr> </table> <h3><a name="elementsDevices">Devices</a></h3> diff --git a/docs/news.xml b/docs/news.xml index 26efa3e..b31d0a4 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -106,8 +106,8 @@ <description> Add support to get the count of branch instructions executed, branch misses, bus cycles, stalled frontend - cpu cycles, stalled backend cpu cycles, and ref cpu - cycles by applications running on the platform. + cpu cycles, stalled backend cpu cycles, ref cpu cycles + and cache l1dra by applications running on the platform. </description> </change> <change> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 4d76315..a65ad13 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -433,6 +433,7 @@ <value>stalled_cycles_frontend</value> <value>stalled_cycles_backend</value> <value>ref_cpu_cycles</value> + <value>cache_l1dra</value> </choice> </attribute> <attribute name="enabled"> diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index e303140..e2ba6ce 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -2188,6 +2188,17 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats); */ # define VIR_PERF_PARAM_REF_CPU_CYCLES "ref_cpu_cycles" + /** + * VIR_PERF_PARAM_CACHE_L1DRA: + * + * Macro for typed parameter name that represents cache_l1dra + * perf event which can be used to measure the count of total + * read accesses for level 1 data cache by applications running + * on the platform. It corresponds to the "perf.cache_l1dra" + * field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_CACHE_L1DRA "cache_l1dra" + int virDomainGetPerfEvents(virDomainPtr dom, virTypedParameterPtr *params, int *nparams, diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 5b3e842..fa39069 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -11250,6 +11250,9 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * CPU frequency scaling by applications running * as unsigned long long. It is produced by the * ref_cpu_cycles perf event. + * "perf.cache_l1dra" - The count of total read accesses for level 1 data + * cache as unsigned long long. It is produced by + * cache_l1dra perf event. * * Note that entire stats groups or individual stat fields may be missing from * the output in case they are not supported by the given hypervisor, are not diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d4422f3..7e2ea96 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9877,6 +9877,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom, VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_STALLED_CYCLES_BACKEND, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_REF_CPU_CYCLES, VIR_TYPED_PARAM_BOOLEAN, + VIR_PERF_PARAM_CACHE_L1DRA, VIR_TYPED_PARAM_BOOLEAN, NULL) < 0) return -1; diff --git a/src/util/virperf.c b/src/util/virperf.c index f64692b..11e64df 100644 --- a/src/util/virperf.c +++ b/src/util/virperf.c @@ -43,7 +43,8 @@ VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST, "cache_references", "cache_misses", "branch_instructions", "branch_misses", "bus_cycles", "stalled_cycles_frontend", - "stalled_cycles_backend", "ref_cpu_cycles"); + "stalled_cycles_backend", "ref_cpu_cycles", + "cache_l1dra"); struct virPerfEvent { int type; @@ -112,6 +113,11 @@ static struct virPerfEventAttr attrs[] = { .attrConfig = 0, # endif }, + {.type = VIR_PERF_EVENT_CACHE_L1DRA, + .attrType = PERF_TYPE_HW_CACHE, + .attrConfig = (PERF_COUNT_HW_CACHE_L1D) | + (PERF_COUNT_HW_CACHE_OP_READ << 8) | + (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)}, }; typedef struct virPerfEventAttr *virPerfEventAttrPtr; diff --git a/src/util/virperf.h b/src/util/virperf.h index 1f43c92..36ceb3a 100644 --- a/src/util/virperf.h +++ b/src/util/virperf.h @@ -47,6 +47,7 @@ typedef enum { the backend of the instruction processor pipeline */ VIR_PERF_EVENT_REF_CPU_CYCLES, /* Count of ref cpu cycles */ + VIR_PERF_EVENT_CACHE_L1DRA, /* Count of read accesses for level 1 data cache */ VIR_PERF_EVENT_LAST } virPerfEventType; diff --git a/tests/genericxml2xmlindata/generic-perf.xml b/tests/genericxml2xmlindata/generic-perf.xml index 437cd65..9b01aef 100644 --- a/tests/genericxml2xmlindata/generic-perf.xml +++ b/tests/genericxml2xmlindata/generic-perf.xml @@ -26,6 +26,7 @@ <event name='stalled_cycles_frontend' enabled='yes'/> <event name='stalled_cycles_backend' enabled='yes'/> <event name='ref_cpu_cycles' enabled='yes'/> + <event name='cache_l1dra' enabled='yes'/> </perf> <devices> </devices> diff --git a/tools/virsh.pod b/tools/virsh.pod index 0e434c0..798c02e 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -945,7 +945,8 @@ I<--perf> returns the statistics of all enabled perf events: "perf.bus_cycles" - the count of bus cycles, "perf.stalled_cycles_frontend" - the count of stalled frontend cpu cycles, "perf.stalled_cycles_backend" - the count of stalled backend cpu cycles, -"perf.ref_cpu_cycles" - the count of ref cpu cycles +"perf.ref_cpu_cycles" - the count of ref cpu cycles, +"perf.cache_l1dra" - the count of read accesses for level 1 data cache See the B<perf> command for more details about each event. @@ -2310,6 +2311,8 @@ B<Valid perf event names> ref_cpu_cycles - Provides the count of total cpu cycles not affected by CPU frequency scaling by applications running on the platform. + cache_l1dra - Provides the count of total read accesses for level 1 + data cache by applications running on the platform. B<Note>: The statistics can be retrieved using the B<domstats> command using the I<--perf> flag. -- 1.9.3

This patch adds support and documentation for a generalized hardware cache event named cache_l1drm perf event for measuring read misses on level 1 data cache Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com> --- docs/formatdomain.html.in | 7 +++++++ docs/news.xml | 5 +++-- docs/schemas/domaincommon.rng | 1 + include/libvirt/libvirt-domain.h | 11 +++++++++++ src/libvirt-domain.c | 3 +++ src/qemu/qemu_driver.c | 1 + src/util/virperf.c | 7 ++++++- src/util/virperf.h | 1 + tests/genericxml2xmlindata/generic-perf.xml | 1 + tools/virsh.pod | 5 ++++- 10 files changed, 38 insertions(+), 4 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 20ef976..9db6d38 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1938,6 +1938,7 @@ <event name='stalled_cycles_backend' enabled='no'/> <event name='ref_cpu_cycles' enabled='no'/> <event name='cache_l1dra' enabled='no'/> + <event name='cache_l1drm' enabled='no'/> </perf> ... </pre> @@ -2022,6 +2023,12 @@ applications running on the platform</td> <td><code>perf.cache_l1dra</code></td> </tr> + <tr> + <td><code>cache_l1drm</code></td> + <td>the count of total read misses for level 1 data cache by + applications running on the platform</td> + <td><code>perf.cache_l1drm</code></td> + </tr> </table> <h3><a name="elementsDevices">Devices</a></h3> diff --git a/docs/news.xml b/docs/news.xml index b31d0a4..fe83ce4 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -106,8 +106,9 @@ <description> Add support to get the count of branch instructions executed, branch misses, bus cycles, stalled frontend - cpu cycles, stalled backend cpu cycles, ref cpu cycles - and cache l1dra by applications running on the platform. + cpu cycles, stalled backend cpu cycles, ref cpu cycles, + cache l1dra and cache l1drm by applications running on + the platform. </description> </change> <change> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index a65ad13..6a7c83c 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -434,6 +434,7 @@ <value>stalled_cycles_backend</value> <value>ref_cpu_cycles</value> <value>cache_l1dra</value> + <value>cache_l1drm</value> </choice> </attribute> <attribute name="enabled"> diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index e2ba6ce..abf0e14 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -2199,6 +2199,17 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats); */ # define VIR_PERF_PARAM_CACHE_L1DRA "cache_l1dra" +/** + * VIR_PERF_PARAM_CACHE_L1DRM: + * + * Macro for typed parameter name that represents cache_l1drm + * perf event which can be used to measure the count of total + * read misses for level 1 data cache by applications running + * on the platform. It corresponds to the "perf.cache_l1drm" + * field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_CACHE_L1DRM "cache_l1drm" + int virDomainGetPerfEvents(virDomainPtr dom, virTypedParameterPtr *params, int *nparams, diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index fa39069..7183905 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -11253,6 +11253,9 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * "perf.cache_l1dra" - The count of total read accesses for level 1 data * cache as unsigned long long. It is produced by * cache_l1dra perf event. + * "perf.cache_l1drm" - The count of total read misses for level 1 data + * cache as unsigned long long. It is produced by + * cache_l1drm perf event. * * Note that entire stats groups or individual stat fields may be missing from * the output in case they are not supported by the given hypervisor, are not diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7e2ea96..da50f95 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9878,6 +9878,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom, VIR_PERF_PARAM_STALLED_CYCLES_BACKEND, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_REF_CPU_CYCLES, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_CACHE_L1DRA, VIR_TYPED_PARAM_BOOLEAN, + VIR_PERF_PARAM_CACHE_L1DRM, VIR_TYPED_PARAM_BOOLEAN, NULL) < 0) return -1; diff --git a/src/util/virperf.c b/src/util/virperf.c index 11e64df..4b9fc9a 100644 --- a/src/util/virperf.c +++ b/src/util/virperf.c @@ -44,7 +44,7 @@ VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST, "branch_instructions", "branch_misses", "bus_cycles", "stalled_cycles_frontend", "stalled_cycles_backend", "ref_cpu_cycles", - "cache_l1dra"); + "cache_l1dra", "cache_l1drm"); struct virPerfEvent { int type; @@ -118,6 +118,11 @@ static struct virPerfEventAttr attrs[] = { .attrConfig = (PERF_COUNT_HW_CACHE_L1D) | (PERF_COUNT_HW_CACHE_OP_READ << 8) | (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)}, + {.type = VIR_PERF_EVENT_CACHE_L1DRM, + .attrType = PERF_TYPE_HW_CACHE, + .attrConfig = (PERF_COUNT_HW_CACHE_L1D) | + (PERF_COUNT_HW_CACHE_OP_READ << 8) | + (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)}, }; typedef struct virPerfEventAttr *virPerfEventAttrPtr; diff --git a/src/util/virperf.h b/src/util/virperf.h index 36ceb3a..37058b0 100644 --- a/src/util/virperf.h +++ b/src/util/virperf.h @@ -48,6 +48,7 @@ typedef enum { processor pipeline */ VIR_PERF_EVENT_REF_CPU_CYCLES, /* Count of ref cpu cycles */ VIR_PERF_EVENT_CACHE_L1DRA, /* Count of read accesses for level 1 data cache */ + VIR_PERF_EVENT_CACHE_L1DRM, /* Count of read misses for level 1 data cache */ VIR_PERF_EVENT_LAST } virPerfEventType; diff --git a/tests/genericxml2xmlindata/generic-perf.xml b/tests/genericxml2xmlindata/generic-perf.xml index 9b01aef..bb8a085 100644 --- a/tests/genericxml2xmlindata/generic-perf.xml +++ b/tests/genericxml2xmlindata/generic-perf.xml @@ -27,6 +27,7 @@ <event name='stalled_cycles_backend' enabled='yes'/> <event name='ref_cpu_cycles' enabled='yes'/> <event name='cache_l1dra' enabled='yes'/> + <event name='cache_l1drm' enabled='yes'/> </perf> <devices> </devices> diff --git a/tools/virsh.pod b/tools/virsh.pod index 798c02e..c1bdbdd 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -946,7 +946,8 @@ I<--perf> returns the statistics of all enabled perf events: "perf.stalled_cycles_frontend" - the count of stalled frontend cpu cycles, "perf.stalled_cycles_backend" - the count of stalled backend cpu cycles, "perf.ref_cpu_cycles" - the count of ref cpu cycles, -"perf.cache_l1dra" - the count of read accesses for level 1 data cache +"perf.cache_l1dra" - the count of read accesses for level 1 data cache, +"perf.cache_l1drm" - the count of read misses for level 1 data cache See the B<perf> command for more details about each event. @@ -2313,6 +2314,8 @@ B<Valid perf event names> applications running on the platform. cache_l1dra - Provides the count of total read accesses for level 1 data cache by applications running on the platform. + cache_l1drm - Provides the count of total read misses for level 1 + data cache by applications running on the platform. B<Note>: The statistics can be retrieved using the B<domstats> command using the I<--perf> flag. -- 1.9.3

This patch adds support and documentation for a generalized hardware cache event named cache_l1dwa perf event for measuring write accesses on level 1 data cache Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com> --- docs/formatdomain.html.in | 7 +++++++ docs/news.xml | 4 ++-- docs/schemas/domaincommon.rng | 1 + include/libvirt/libvirt-domain.h | 11 +++++++++++ src/libvirt-domain.c | 3 +++ src/qemu/qemu_driver.c | 1 + src/util/virperf.c | 7 ++++++- src/util/virperf.h | 1 + tests/genericxml2xmlindata/generic-perf.xml | 1 + tools/virsh.pod | 3 +++ 10 files changed, 36 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 9db6d38..4c24ead 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1939,6 +1939,7 @@ <event name='ref_cpu_cycles' enabled='no'/> <event name='cache_l1dra' enabled='no'/> <event name='cache_l1drm' enabled='no'/> + <event name='cache_l1dwa' enabled='no'/> </perf> ... </pre> @@ -2029,6 +2030,12 @@ applications running on the platform</td> <td><code>perf.cache_l1drm</code></td> </tr> + <tr> + <td><code>cache_l1dwa</code></td> + <td>the count of total write accesses for level 1 data cache by + applications running on the platform</td> + <td><code>perf.cache_l1dwa</code></td> + </tr> </table> <h3><a name="elementsDevices">Devices</a></h3> diff --git a/docs/news.xml b/docs/news.xml index fe83ce4..129cbc9 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -107,8 +107,8 @@ Add support to get the count of branch instructions executed, branch misses, bus cycles, stalled frontend cpu cycles, stalled backend cpu cycles, ref cpu cycles, - cache l1dra and cache l1drm by applications running on - the platform. + cache l1dra, cache l1drm and cache l1dwa by applications + running on the platform. </description> </change> <change> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 6a7c83c..9ad5937 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -435,6 +435,7 @@ <value>ref_cpu_cycles</value> <value>cache_l1dra</value> <value>cache_l1drm</value> + <value>cache_l1dwa</value> </choice> </attribute> <attribute name="enabled"> diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index abf0e14..b02eb49 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -2210,6 +2210,17 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats); */ # define VIR_PERF_PARAM_CACHE_L1DRM "cache_l1drm" +/* + * VIR_PERF_PARAM_CACHE_L1DWA: + * + * Macro for typed parameter name that represents cache_l1dwa + * perf event which can be used to measure the count of total + * write accesses for level 1 data cache by applications running + * on the platform. It corresponds to the "perf.cache_l1dwa" + * field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_CACHE_L1DWA "cache_l1dwa" + int virDomainGetPerfEvents(virDomainPtr dom, virTypedParameterPtr *params, int *nparams, diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 7183905..92e8bf1 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -11256,6 +11256,9 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * "perf.cache_l1drm" - The count of total read misses for level 1 data * cache as unsigned long long. It is produced by * cache_l1drm perf event. + * "perf.cache_l1dwa" - The count of total write accesses for level 1 data + * cache as unsigned long long. It is produced by + * cache_l1dwa perf event. * * Note that entire stats groups or individual stat fields may be missing from * the output in case they are not supported by the given hypervisor, are not diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index da50f95..c2f55d3 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9879,6 +9879,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom, VIR_PERF_PARAM_REF_CPU_CYCLES, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_CACHE_L1DRA, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_CACHE_L1DRM, VIR_TYPED_PARAM_BOOLEAN, + VIR_PERF_PARAM_CACHE_L1DWA, VIR_TYPED_PARAM_BOOLEAN, NULL) < 0) return -1; diff --git a/src/util/virperf.c b/src/util/virperf.c index 4b9fc9a..c4cea33 100644 --- a/src/util/virperf.c +++ b/src/util/virperf.c @@ -44,7 +44,7 @@ VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST, "branch_instructions", "branch_misses", "bus_cycles", "stalled_cycles_frontend", "stalled_cycles_backend", "ref_cpu_cycles", - "cache_l1dra", "cache_l1drm"); + "cache_l1dra", "cache_l1drm", "cache_l1dwa"); struct virPerfEvent { int type; @@ -123,6 +123,11 @@ static struct virPerfEventAttr attrs[] = { .attrConfig = (PERF_COUNT_HW_CACHE_L1D) | (PERF_COUNT_HW_CACHE_OP_READ << 8) | (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)}, + {.type = VIR_PERF_EVENT_CACHE_L1DWA, + .attrType = PERF_TYPE_HW_CACHE, + .attrConfig = (PERF_COUNT_HW_CACHE_L1D) | + (PERF_COUNT_HW_CACHE_OP_WRITE << 8) | + (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)}, }; typedef struct virPerfEventAttr *virPerfEventAttrPtr; diff --git a/src/util/virperf.h b/src/util/virperf.h index 37058b0..5671ec7 100644 --- a/src/util/virperf.h +++ b/src/util/virperf.h @@ -49,6 +49,7 @@ typedef enum { VIR_PERF_EVENT_REF_CPU_CYCLES, /* Count of ref cpu cycles */ VIR_PERF_EVENT_CACHE_L1DRA, /* Count of read accesses for level 1 data cache */ VIR_PERF_EVENT_CACHE_L1DRM, /* Count of read misses for level 1 data cache */ + VIR_PERF_EVENT_CACHE_L1DWA, /* Count of write accesses for level 1 data cache */ VIR_PERF_EVENT_LAST } virPerfEventType; diff --git a/tests/genericxml2xmlindata/generic-perf.xml b/tests/genericxml2xmlindata/generic-perf.xml index bb8a085..e9d29a1 100644 --- a/tests/genericxml2xmlindata/generic-perf.xml +++ b/tests/genericxml2xmlindata/generic-perf.xml @@ -28,6 +28,7 @@ <event name='ref_cpu_cycles' enabled='yes'/> <event name='cache_l1dra' enabled='yes'/> <event name='cache_l1drm' enabled='yes'/> + <event name='cache_l1dwa' enabled='yes'/> </perf> <devices> </devices> diff --git a/tools/virsh.pod b/tools/virsh.pod index c1bdbdd..c06c96b 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -948,6 +948,7 @@ I<--perf> returns the statistics of all enabled perf events: "perf.ref_cpu_cycles" - the count of ref cpu cycles, "perf.cache_l1dra" - the count of read accesses for level 1 data cache, "perf.cache_l1drm" - the count of read misses for level 1 data cache +"perf.cache_l1dwa" - the count of write accesses for level 1 data cache See the B<perf> command for more details about each event. @@ -2316,6 +2317,8 @@ B<Valid perf event names> data cache by applications running on the platform. cache_l1drm - Provides the count of total read misses for level 1 data cache by applications running on the platform. + cache_l1dwa - Provides the count of total write accesses for level 1 + data cache by applications running on the platform. B<Note>: The statistics can be retrieved using the B<domstats> command using the I<--perf> flag. -- 1.9.3

This patch adds support and documentation for a generalized hardware cache event named cache_l1dwm perf event for measuring write misses on level 1 data cache Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com> --- docs/formatdomain.html.in | 7 +++++++ docs/news.xml | 4 ++-- docs/schemas/domaincommon.rng | 1 + include/libvirt/libvirt-domain.h | 11 +++++++++++ src/libvirt-domain.c | 3 +++ src/qemu/qemu_driver.c | 1 + src/remote/remote_protocol.x | 2 +- src/util/virperf.c | 8 +++++++- src/util/virperf.h | 1 + tests/genericxml2xmlindata/generic-perf.xml | 1 + tools/virsh.pod | 7 +++++-- 11 files changed, 40 insertions(+), 6 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 4c24ead..d5c2aad 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1940,6 +1940,7 @@ <event name='cache_l1dra' enabled='no'/> <event name='cache_l1drm' enabled='no'/> <event name='cache_l1dwa' enabled='no'/> + <event name='cache_l1dwm' enabled='no'/> </perf> ... </pre> @@ -2036,6 +2037,12 @@ applications running on the platform</td> <td><code>perf.cache_l1dwa</code></td> </tr> + <tr> + <td><code>cache_l1dwm</code></td> + <td>the count of total write misses for level 1 data cache by + applications running on the platform</td> + <td><code>perf.cache_l1dwm</code></td> + </tr> </table> <h3><a name="elementsDevices">Devices</a></h3> diff --git a/docs/news.xml b/docs/news.xml index 129cbc9..eb2e815 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -107,8 +107,8 @@ Add support to get the count of branch instructions executed, branch misses, bus cycles, stalled frontend cpu cycles, stalled backend cpu cycles, ref cpu cycles, - cache l1dra, cache l1drm and cache l1dwa by applications - running on the platform. + cache l1dra, cache l1drm, cache l1dwa and cache l1dwm by + applications running on the platform. </description> </change> <change> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 9ad5937..91ad636 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -436,6 +436,7 @@ <value>cache_l1dra</value> <value>cache_l1drm</value> <value>cache_l1dwa</value> + <value>cache_l1dwm</value> </choice> </attribute> <attribute name="enabled"> diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index b02eb49..0d8d731 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -2221,6 +2221,17 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats); */ # define VIR_PERF_PARAM_CACHE_L1DWA "cache_l1dwa" +/* + * VIR_PERF_PARAM_CACHE_L1DWM: + * + *Macro for typed parameter name that represents cache_l1dwm + *perf event which can be used to measure the count of total + *write misses for level 1 data cache by applications running + *on the platform. It corresponds to the "perf.cache_l1dwm" + *field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_CACHE_L1DWM "cache_l1dwm" + int virDomainGetPerfEvents(virDomainPtr dom, virTypedParameterPtr *params, int *nparams, diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 92e8bf1..3a5a776 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -11259,6 +11259,9 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * "perf.cache_l1dwa" - The count of total write accesses for level 1 data * cache as unsigned long long. It is produced by * cache_l1dwa perf event. + * "perf.cache_l1dwm" - The count of total write misses for level 1 data + * cache as unsigned long long. It is produced by + * cache_l1dwm perf event. * * Note that entire stats groups or individual stat fields may be missing from * the output in case they are not supported by the given hypervisor, are not diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c2f55d3..205d2d2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9880,6 +9880,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom, VIR_PERF_PARAM_CACHE_L1DRA, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_CACHE_L1DRM, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_CACHE_L1DWA, VIR_TYPED_PARAM_BOOLEAN, + VIR_PERF_PARAM_CACHE_L1DWM, VIR_TYPED_PARAM_BOOLEAN, NULL) < 0) return -1; diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 6445685..3da6868 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -101,7 +101,7 @@ const REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX = 16; const REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX = 16; /* Upper limit on list of memory parameters. */ -const REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX = 16; +const REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX = 32; /* Upper limit on list of blockio tuning parameters. */ const REMOTE_DOMAIN_BLOCK_IO_TUNE_PARAMETERS_MAX = 32; diff --git a/src/util/virperf.c b/src/util/virperf.c index c4cea33..384a3e1 100644 --- a/src/util/virperf.c +++ b/src/util/virperf.c @@ -44,7 +44,8 @@ VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST, "branch_instructions", "branch_misses", "bus_cycles", "stalled_cycles_frontend", "stalled_cycles_backend", "ref_cpu_cycles", - "cache_l1dra", "cache_l1drm", "cache_l1dwa"); + "cache_l1dra", "cache_l1drm", "cache_l1dwa", + "cache_l1dwm"); struct virPerfEvent { int type; @@ -128,6 +129,11 @@ static struct virPerfEventAttr attrs[] = { .attrConfig = (PERF_COUNT_HW_CACHE_L1D) | (PERF_COUNT_HW_CACHE_OP_WRITE << 8) | (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)}, + {.type = VIR_PERF_EVENT_CACHE_L1DWM, + .attrType = PERF_TYPE_HW_CACHE, + .attrConfig = (PERF_COUNT_HW_CACHE_L1D) | + (PERF_COUNT_HW_CACHE_OP_WRITE << 8) | + (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)}, }; typedef struct virPerfEventAttr *virPerfEventAttrPtr; diff --git a/src/util/virperf.h b/src/util/virperf.h index 5671ec7..13967d8 100644 --- a/src/util/virperf.h +++ b/src/util/virperf.h @@ -50,6 +50,7 @@ typedef enum { VIR_PERF_EVENT_CACHE_L1DRA, /* Count of read accesses for level 1 data cache */ VIR_PERF_EVENT_CACHE_L1DRM, /* Count of read misses for level 1 data cache */ VIR_PERF_EVENT_CACHE_L1DWA, /* Count of write accesses for level 1 data cache */ + VIR_PERF_EVENT_CACHE_L1DWM, /* Count of write misses for level 1 data cache */ VIR_PERF_EVENT_LAST } virPerfEventType; diff --git a/tests/genericxml2xmlindata/generic-perf.xml b/tests/genericxml2xmlindata/generic-perf.xml index e9d29a1..4351fb2 100644 --- a/tests/genericxml2xmlindata/generic-perf.xml +++ b/tests/genericxml2xmlindata/generic-perf.xml @@ -29,6 +29,7 @@ <event name='cache_l1dra' enabled='yes'/> <event name='cache_l1drm' enabled='yes'/> <event name='cache_l1dwa' enabled='yes'/> + <event name='cache_l1dwm' enabled='yes'/> </perf> <devices> </devices> diff --git a/tools/virsh.pod b/tools/virsh.pod index c06c96b..de7856b 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -947,8 +947,9 @@ I<--perf> returns the statistics of all enabled perf events: "perf.stalled_cycles_backend" - the count of stalled backend cpu cycles, "perf.ref_cpu_cycles" - the count of ref cpu cycles, "perf.cache_l1dra" - the count of read accesses for level 1 data cache, -"perf.cache_l1drm" - the count of read misses for level 1 data cache -"perf.cache_l1dwa" - the count of write accesses for level 1 data cache +"perf.cache_l1drm" - the count of read misses for level 1 data cache, +"perf.cache_l1dwa" - the count of write accesses for level 1 data cache, +"perf.cache_l1dwm" - the count of write misses for level 1 data cache See the B<perf> command for more details about each event. @@ -2319,6 +2320,8 @@ B<Valid perf event names> data cache by applications running on the platform. cache_l1dwa - Provides the count of total write accesses for level 1 data cache by applications running on the platform. + cache_l1dwm - Provides the count of total write misses for level 1 + data cache by applications running on the platform. B<Note>: The statistics can be retrieved using the B<domstats> command using the I<--perf> flag. -- 1.9.3

This patch adds support and documentation for a generalized hardware cache event named cache_l1dpa perf event for measuring prefetch accesses on level 1 data cache Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com> --- docs/formatdomain.html.in | 7 +++++++ docs/news.xml | 4 ++-- docs/schemas/domaincommon.rng | 1 + include/libvirt/libvirt-domain.h | 11 +++++++++++ src/libvirt-domain.c | 3 +++ src/qemu/qemu_driver.c | 1 + src/util/virperf.c | 7 ++++++- src/util/virperf.h | 1 + tests/genericxml2xmlindata/generic-perf.xml | 1 + tools/virsh.pod | 5 ++++- 10 files changed, 37 insertions(+), 4 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index d5c2aad..245120d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1941,6 +1941,7 @@ <event name='cache_l1drm' enabled='no'/> <event name='cache_l1dwa' enabled='no'/> <event name='cache_l1dwm' enabled='no'/> + <event name='cache_l1dpa' enabled='no'/> </perf> ... </pre> @@ -2043,6 +2044,12 @@ applications running on the platform</td> <td><code>perf.cache_l1dwm</code></td> </tr> + <tr> + <td><code>cache_l1dpa</code></td> + <td>the count of total prefetch accesses for level 1 data + cache by applications running on the platform</td> + <td><code>perf.cache_l1dpa</code></td> + </tr> </table> <h3><a name="elementsDevices">Devices</a></h3> diff --git a/docs/news.xml b/docs/news.xml index eb2e815..1f362e2 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -107,8 +107,8 @@ Add support to get the count of branch instructions executed, branch misses, bus cycles, stalled frontend cpu cycles, stalled backend cpu cycles, ref cpu cycles, - cache l1dra, cache l1drm, cache l1dwa and cache l1dwm by - applications running on the platform. + cache l1dra, cache l1drm, cache l1dwa, cache l1dwm, + cache l1dpa by applications running on the platform. </description> </change> <change> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 91ad636..83a205a 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -437,6 +437,7 @@ <value>cache_l1drm</value> <value>cache_l1dwa</value> <value>cache_l1dwm</value> + <value>cache_l1dpa</value> </choice> </attribute> <attribute name="enabled"> diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index 0d8d731..9db4969 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -2232,6 +2232,17 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats); */ # define VIR_PERF_PARAM_CACHE_L1DWM "cache_l1dwm" +/* + * VIR_PERF_PARAM_CACHE_L1DPA: + * + *Macro for typed parameter name that represents cache_l1dpa + *perf event which can be used to measure the count of total + *prefetch accesses for level 1 data cache by applications + *running on the platform. It corresponds to the + *"perf.cache_l1dpa" field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_CACHE_L1DPA "cache_l1dpa" + int virDomainGetPerfEvents(virDomainPtr dom, virTypedParameterPtr *params, int *nparams, diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 3a5a776..089d3f5 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -11262,6 +11262,9 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * "perf.cache_l1dwm" - The count of total write misses for level 1 data * cache as unsigned long long. It is produced by * cache_l1dwm perf event. + * "perf.cache_l1dpa" - The count of total prefetch accesses for level 1 + * data cache as unsigned long long. It is produced by + * cache_l1dpa perf event. * * Note that entire stats groups or individual stat fields may be missing from * the output in case they are not supported by the given hypervisor, are not diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 205d2d2..8acb706 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9881,6 +9881,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom, VIR_PERF_PARAM_CACHE_L1DRM, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_CACHE_L1DWA, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_CACHE_L1DWM, VIR_TYPED_PARAM_BOOLEAN, + VIR_PERF_PARAM_CACHE_L1DPA, VIR_TYPED_PARAM_BOOLEAN, NULL) < 0) return -1; diff --git a/src/util/virperf.c b/src/util/virperf.c index 384a3e1..df2a91a 100644 --- a/src/util/virperf.c +++ b/src/util/virperf.c @@ -45,7 +45,7 @@ VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST, "bus_cycles", "stalled_cycles_frontend", "stalled_cycles_backend", "ref_cpu_cycles", "cache_l1dra", "cache_l1drm", "cache_l1dwa", - "cache_l1dwm"); + "cache_l1dwm", "cache_l1dpa"); struct virPerfEvent { int type; @@ -134,6 +134,11 @@ static struct virPerfEventAttr attrs[] = { .attrConfig = (PERF_COUNT_HW_CACHE_L1D) | (PERF_COUNT_HW_CACHE_OP_WRITE << 8) | (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)}, + {.type = VIR_PERF_EVENT_CACHE_L1DPA, + .attrType = PERF_TYPE_HW_CACHE, + .attrConfig = (PERF_COUNT_HW_CACHE_L1D) | + (PERF_COUNT_HW_CACHE_OP_PREFETCH << 8) | + (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)}, }; typedef struct virPerfEventAttr *virPerfEventAttrPtr; diff --git a/src/util/virperf.h b/src/util/virperf.h index 13967d8..78c8557 100644 --- a/src/util/virperf.h +++ b/src/util/virperf.h @@ -51,6 +51,7 @@ typedef enum { VIR_PERF_EVENT_CACHE_L1DRM, /* Count of read misses for level 1 data cache */ VIR_PERF_EVENT_CACHE_L1DWA, /* Count of write accesses for level 1 data cache */ VIR_PERF_EVENT_CACHE_L1DWM, /* Count of write misses for level 1 data cache */ + VIR_PERF_EVENT_CACHE_L1DPA, /* Count of prefetch accesses for level 1 data cache */ VIR_PERF_EVENT_LAST } virPerfEventType; diff --git a/tests/genericxml2xmlindata/generic-perf.xml b/tests/genericxml2xmlindata/generic-perf.xml index 4351fb2..a575f89 100644 --- a/tests/genericxml2xmlindata/generic-perf.xml +++ b/tests/genericxml2xmlindata/generic-perf.xml @@ -30,6 +30,7 @@ <event name='cache_l1drm' enabled='yes'/> <event name='cache_l1dwa' enabled='yes'/> <event name='cache_l1dwm' enabled='yes'/> + <event name='cache_l1dpa' enabled='yes'/> </perf> <devices> </devices> diff --git a/tools/virsh.pod b/tools/virsh.pod index de7856b..c599aa5 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -949,7 +949,8 @@ I<--perf> returns the statistics of all enabled perf events: "perf.cache_l1dra" - the count of read accesses for level 1 data cache, "perf.cache_l1drm" - the count of read misses for level 1 data cache, "perf.cache_l1dwa" - the count of write accesses for level 1 data cache, -"perf.cache_l1dwm" - the count of write misses for level 1 data cache +"perf.cache_l1dwm" - the count of write misses for level 1 data cache, +"perf.cache_l1dpa" - the count of prefetch accesses for level 1 data cache See the B<perf> command for more details about each event. @@ -2322,6 +2323,8 @@ B<Valid perf event names> data cache by applications running on the platform. cache_l1dwm - Provides the count of total write misses for level 1 data cache by applications running on the platform. + cache_l1dpa - Provides the count of total prefetch accesses for + level 1 data cache by applications running on the platform. B<Note>: The statistics can be retrieved using the B<domstats> command using the I<--perf> flag. -- 1.9.3

This patch adds support and documentation for a generalized hardware cache event named cache_l1dpm perf event for measuring prefetch misses on level 1 data cache Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com> --- docs/formatdomain.html.in | 7 +++++++ docs/news.xml | 3 ++- docs/schemas/domaincommon.rng | 1 + include/libvirt/libvirt-domain.h | 11 +++++++++++ src/libvirt-domain.c | 3 +++ src/qemu/qemu_driver.c | 1 + src/util/virperf.c | 7 ++++++- src/util/virperf.h | 1 + tests/genericxml2xmlindata/generic-perf.xml | 1 + tools/virsh.pod | 3 +++ 10 files changed, 36 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 245120d..179efe3 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1942,6 +1942,7 @@ <event name='cache_l1dwa' enabled='no'/> <event name='cache_l1dwm' enabled='no'/> <event name='cache_l1dpa' enabled='no'/> + <event name='cache_l1dpm' enabled='no'/> </perf> ... </pre> @@ -2050,6 +2051,12 @@ cache by applications running on the platform</td> <td><code>perf.cache_l1dpa</code></td> </tr> + <tr> + <td><code>cache_l1dpm</code></td> + <td>the count of total prefetch misses for level 1 data + cache by applications running on the platform</td> + <td><code>perf.cache_l1dpm</code></td> + </tr> </table> <h3><a name="elementsDevices">Devices</a></h3> diff --git a/docs/news.xml b/docs/news.xml index 1f362e2..954c2af 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -108,7 +108,8 @@ executed, branch misses, bus cycles, stalled frontend cpu cycles, stalled backend cpu cycles, ref cpu cycles, cache l1dra, cache l1drm, cache l1dwa, cache l1dwm, - cache l1dpa by applications running on the platform. + cache l1dpa and cache l1dpm by applications running on + the platform. </description> </change> <change> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 83a205a..05d3579 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -438,6 +438,7 @@ <value>cache_l1dwa</value> <value>cache_l1dwm</value> <value>cache_l1dpa</value> + <value>cache_l1dpm</value> </choice> </attribute> <attribute name="enabled"> diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index 9db4969..6c84c98 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -2243,6 +2243,17 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats); */ # define VIR_PERF_PARAM_CACHE_L1DPA "cache_l1dpa" +/* + * VIR_PERF_PARAM_CACHE_L1DPM: + * + *Macro for typed parameter name that represents cache_l1dpm + *perf event which can be used to measure the count of total + *prefetch misses for level 1 data cache by applications + *running on the platform. It corresponds to the + *"perf.cache_l1dpm" field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_CACHE_L1DPM "cache_l1dpm" + int virDomainGetPerfEvents(virDomainPtr dom, virTypedParameterPtr *params, int *nparams, diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 089d3f5..1f34175 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -11265,6 +11265,9 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * "perf.cache_l1dpa" - The count of total prefetch accesses for level 1 * data cache as unsigned long long. It is produced by * cache_l1dpa perf event. + * "perf.cache_l1dpm" - The count of total prefetch misses for level 1 + * data cache as unsigned long long. It is produced by + * cache_l1dpm perf event. * * Note that entire stats groups or individual stat fields may be missing from * the output in case they are not supported by the given hypervisor, are not diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8acb706..356bc38 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9882,6 +9882,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom, VIR_PERF_PARAM_CACHE_L1DWA, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_CACHE_L1DWM, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_CACHE_L1DPA, VIR_TYPED_PARAM_BOOLEAN, + VIR_PERF_PARAM_CACHE_L1DPM, VIR_TYPED_PARAM_BOOLEAN, NULL) < 0) return -1; diff --git a/src/util/virperf.c b/src/util/virperf.c index df2a91a..788b817 100644 --- a/src/util/virperf.c +++ b/src/util/virperf.c @@ -45,7 +45,7 @@ VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST, "bus_cycles", "stalled_cycles_frontend", "stalled_cycles_backend", "ref_cpu_cycles", "cache_l1dra", "cache_l1drm", "cache_l1dwa", - "cache_l1dwm", "cache_l1dpa"); + "cache_l1dwm", "cache_l1dpa", "cache_l1dpm"); struct virPerfEvent { int type; @@ -139,6 +139,11 @@ static struct virPerfEventAttr attrs[] = { .attrConfig = (PERF_COUNT_HW_CACHE_L1D) | (PERF_COUNT_HW_CACHE_OP_PREFETCH << 8) | (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)}, + {.type = VIR_PERF_EVENT_CACHE_L1DPM, + .attrType = PERF_TYPE_HW_CACHE, + .attrConfig = (PERF_COUNT_HW_CACHE_L1D) | + (PERF_COUNT_HW_CACHE_OP_PREFETCH << 8) | + (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)}, }; typedef struct virPerfEventAttr *virPerfEventAttrPtr; diff --git a/src/util/virperf.h b/src/util/virperf.h index 78c8557..1ec5c3a 100644 --- a/src/util/virperf.h +++ b/src/util/virperf.h @@ -52,6 +52,7 @@ typedef enum { VIR_PERF_EVENT_CACHE_L1DWA, /* Count of write accesses for level 1 data cache */ VIR_PERF_EVENT_CACHE_L1DWM, /* Count of write misses for level 1 data cache */ VIR_PERF_EVENT_CACHE_L1DPA, /* Count of prefetch accesses for level 1 data cache */ + VIR_PERF_EVENT_CACHE_L1DPM, /* Count of prefetch misses for level 1 data cache */ VIR_PERF_EVENT_LAST } virPerfEventType; diff --git a/tests/genericxml2xmlindata/generic-perf.xml b/tests/genericxml2xmlindata/generic-perf.xml index a575f89..875d092 100644 --- a/tests/genericxml2xmlindata/generic-perf.xml +++ b/tests/genericxml2xmlindata/generic-perf.xml @@ -31,6 +31,7 @@ <event name='cache_l1dwa' enabled='yes'/> <event name='cache_l1dwm' enabled='yes'/> <event name='cache_l1dpa' enabled='yes'/> + <event name='cache_l1dpm' enabled='yes'/> </perf> <devices> </devices> diff --git a/tools/virsh.pod b/tools/virsh.pod index c599aa5..467a7d6 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -951,6 +951,7 @@ I<--perf> returns the statistics of all enabled perf events: "perf.cache_l1dwa" - the count of write accesses for level 1 data cache, "perf.cache_l1dwm" - the count of write misses for level 1 data cache, "perf.cache_l1dpa" - the count of prefetch accesses for level 1 data cache +"perf.cache_l1dpm" - the count of prefetch misses for level 1 data cache See the B<perf> command for more details about each event. @@ -2325,6 +2326,8 @@ B<Valid perf event names> data cache by applications running on the platform. cache_l1dpa - Provides the count of total prefetch accesses for level 1 data cache by applications running on the platform. + cache_l1dpm - Provides the count of total prefetch misses for level 1 + data cache by applications running on the platform. B<Note>: The statistics can be retrieved using the B<domstats> command using the I<--perf> flag. -- 1.9.3

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com> --- tools/virsh.pod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/virsh.pod b/tools/virsh.pod index 467a7d6..bf5b93a 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -308,14 +308,14 @@ With I<--pretty> the online CPUs are printed as a range instead of a list. =item B<nodecpustats> [I<cpu>] [I<--percent>] Returns cpu stats of the node. -If I<cpu> is specified, this will prints specified cpu statistics only. -If I<--percent> is specified, this will prints percentage of each kind of cpu +If I<cpu> is specified, this will print specified cpu statistics only. +If I<--percent> is specified, this will print percentage of each kind of cpu statistics during 1 second. =item B<nodememstats> [I<cell>] Returns memory stats of the node. -If I<cell> is specified, this will prints specified cell statistics only. +If I<cell> is specified, this will print specified cell statistics only. =item B<nodesuspend> [I<target>] [I<duration>] -- 1.9.3

On 01/18/2017 11:58 PM, Nitesh Konkar wrote:
Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com> --- tools/virsh.pod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
ACK and pushed (w/ slight adjustment noted below) John
diff --git a/tools/virsh.pod b/tools/virsh.pod index 467a7d6..bf5b93a 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -308,14 +308,14 @@ With I<--pretty> the online CPUs are printed as a range instead of a list. =item B<nodecpustats> [I<cpu>] [I<--percent>]
Returns cpu stats of the node. -If I<cpu> is specified, this will prints specified cpu statistics only. -If I<--percent> is specified, this will prints percentage of each kind of cpu +If I<cpu> is specified, this will print specified cpu statistics only. +If I<--percent> is specified, this will print percentage of each kind of cpu
changed the grammar slightly... "will print the specified" and "will print the percentage"
statistics during 1 second.
=item B<nodememstats> [I<cell>]
Returns memory stats of the node. -If I<cell> is specified, this will prints specified cell statistics only. +If I<cell> is specified, this will print specified cell statistics only.
similar "will print the specified"
=item B<nodesuspend> [I<target>] [I<duration>]

On 01/18/2017 11:58 PM, Nitesh Konkar wrote:
This patch series adds support and documentation for a generalized hardware cache event called CACHE_L1D perf event. This perf event is split into cache_l1dra, cache_l1drm, cache_l1dwa, cache_l1dwm, cache_l1dpa and cache_l1dpm perf events depending on the config value set.
Nitesh Konkar (7): perf: add cache_l1dra perf event support perf: add cache_l1drm perf event support perf: add cache_l1dwa perf event support perf: add cache_l1dwm perf event support perf: add cache_l1dpa perf event support perf: add cache_l1dpm perf event support virsh: Fix manpage typo
docs/formatdomain.html.in | 42 ++++++++++++++++++ docs/news.xml | 6 ++- docs/schemas/domaincommon.rng | 6 +++ include/libvirt/libvirt-domain.h | 66 +++++++++++++++++++++++++++++ src/libvirt-domain.c | 18 ++++++++ src/qemu/qemu_driver.c | 6 +++ src/remote/remote_protocol.x | 2 +- src/util/virperf.c | 34 ++++++++++++++- src/util/virperf.h | 6 +++ tests/genericxml2xmlindata/generic-perf.xml | 6 +++ tools/virsh.pod | 26 ++++++++++-- 11 files changed, 210 insertions(+), 8 deletions(-)
Is there any possibility for combining the first 6 patches in some manner? They're all just some "feature" within the level 1 cache statistics. I'm thinking of syntax such as: virsh perf $dom --enable cache_1d=$LIST where $LIST is a comma separated list and has the possibility for ra, rm, wa, wm, pa, and pm. I didn't put much thought to it API wise and whether there's any other/similar example. It's just something that it would seem would be useful rather than the repetitiveness of these patches. Also, lots of extra work within the *perl and *go bindings that at this point to add all the new definitions. I think you should supply the patches for those rather than relying on myself and/or Daniel to do that. Just follow the countless previous examples! NB: A couple of patches require an extra space between the "*" and description within include/libvirt/libvirt-domain.h. I'll handle patch 7 separately... John

On Wed, Jan 25, 2017 at 9:55 PM, John Ferlan <jferlan@redhat.com> wrote:
On 01/18/2017 11:58 PM, Nitesh Konkar wrote:
This patch series adds support and documentation for a generalized hardware cache event called CACHE_L1D perf event. This perf event is split into cache_l1dra, cache_l1drm, cache_l1dwa, cache_l1dwm, cache_l1dpa and cache_l1dpm perf events depending on the config value set.
Nitesh Konkar (7): perf: add cache_l1dra perf event support perf: add cache_l1drm perf event support perf: add cache_l1dwa perf event support perf: add cache_l1dwm perf event support perf: add cache_l1dpa perf event support perf: add cache_l1dpm perf event support virsh: Fix manpage typo
docs/formatdomain.html.in | 42 ++++++++++++++++++ docs/news.xml | 6 ++- docs/schemas/domaincommon.rng | 6 +++ include/libvirt/libvirt-domain.h | 66 +++++++++++++++++++++++++++++ src/libvirt-domain.c | 18 ++++++++ src/qemu/qemu_driver.c | 6 +++ src/remote/remote_protocol.x | 2 +- src/util/virperf.c | 34 ++++++++++++++- src/util/virperf.h | 6 +++ tests/genericxml2xmlindata/generic-perf.xml | 6 +++ tools/virsh.pod | 26 ++++++++++-- 11 files changed, 210 insertions(+), 8 deletions(-)
Is there any possibility for combining the first 6 patches in some manner? They're all just some "feature" within the level 1 cache statistics. I'm thinking of syntax such as:
virsh perf $dom --enable cache_1d=$LIST where $LIST is a comma separated list and has the possibility for ra, rm, wa, wm, pa, and pm.
I didn't put much thought to it API wise and whether there's any other/similar example. It's just something that it would seem would be useful rather than the repetitiveness of these patches.
I agree. Will work on that.
Also, lots of extra work within the *perl and *go bindings that at this point to add all the new definitions. I think you should supply the patches for those rather than relying on myself and/or Daniel to do that. Just follow the countless previous examples!
Sure. I shall provide it the next time.
NB: A couple of patches require an extra space between the "*" and description within include/libvirt/libvirt-domain.h.
Noted.
I'll handle patch 7 separately...
Sure. I shall also send a patch series to add perf software events, just like we have generic hardware events now. Meanwhile will work on the above suggestion for hardware cache events. Thanks, Nitesh.
John
participants (2)
-
John Ferlan
-
Nitesh Konkar