Add support for parameterized events from sysfs
Subsystems (2)
v3 cover Add support for parameterized events from sysfs
What this patchset does:
- the first patch (override sysfs in tools/perf via SYSFS_PATH) was sent out previously, but needed a resend anyhow. Having it is useful for testing the later changes to tools/perf.
- the second patch is a bugfix to the powerpc hv-24x7 code which was previously sent out, which is a good idea to have when testing these patches on POWER8 hardware.
- document perf sysfs and the changes to add parameterized events
- semi-notably: removes the growing list of specific POWER cpu events and begins documenting them generically, much like the docs for /sys/modules/MODULENAME do for modules.
- tools/perf changes to support parameterized events
- export some parameterized events from the powerpc pmus hv_24x7 and hv_gpci
Description of "event parameters" from the documentation patch:
Event parameters are a basic way for partial events to be specified in sysfs with per-event names given to the fields that need to be filled in when using a particular event.
It is intended for supporting cases where the single 'cpu' parameter is insufficient. For example, POWER 8 has events for physical sockets/cores/cpus that are accessible from with virtual machines. To keep using the single 'cpu' parameter we'd need to perform a mapping between Linux's cpus and the physical machine's cpus (in this case Linux is running under a hypervisor). This isn't possible because bindings between our cpus and physical cpus may not be fixed, and we probably won't have a "cpu" on each physical cpu.
Description of the sysfs contents when events are parameterized (copied from an included patch):
Examples:
domain=0x1,offset=0x8,starting_index=phys_cpu
In the case of the last example, a value replacing "phys_cpu" would need to be provided by the user selecting the particular event. This is refered to as "event parameterization". All non-numerical values indicate an event parameter.
Notes on how perf-list displays parameterized events (and how to use them, again culled from an included patch):
PARAMETERIZED EVENTS
--------------------
Some pmu events listed by 'perf-list' will be displayed with '?' in them. For example:
hv_gpci/dtbp_ptitc,phys_processor_idx=?/
This means that when provided as an event, a value for phys_processor_idx must also be supplied. For example:
perf stat -e 'hv_gpci/dtbp_ptitc,phys_processor_idx=0x2/' ...
Changelog[v3]
- [Jiri Olsa] Changed the event parameters are specified. If event file specifes 'param=val' make the usage 'param=123' rather than 'val=123'. (patch 1,2/10)
- Shortened event names using "PHYS" and "VCPU" (patch 4/10)
- Print help message if invalid parameter is specified or required parameter is missing.
- Moved 3 patches that are unrelated to parametrized events into a separate patchset.
- Reordered patches so code changes come first.
Changelog[v2]
- [Joe Perches, David Laight] Use beNN_to_cpu() instead of guessing the size from type.
- Use kmem_cache_free() to free page allocated with kmem_cache_alloc().
- Rebase to recent kernel
*** BLURB HERE ***
Cody P Schafer (10):
tools/perf: support parsing parameterized events tools/perf: extend format_alias() to include event parameters
perf: provide sysfs_show for struct perf_pmu_events_attr powerpc/perf/hv-24x7: parse catalog and populate sysfs with events
perf: add PMU_EVENT_ATTR_STRING() helper powerpc/perf/{hv-gpci,hv-common}: generate requests with counters
annotated
powerpc/perf/hv-gpci: add the remaining gpci requests perf Documentation: add event parameters
tools/perf: Document parameterized and symbolic events powerpc/perf/hv-24x7: Document sysfs event description entries
.../testing/sysfs-bus-event_source-devices-events | 6 + .../testing/sysfs-bus-event_source-devices-hv_24x7 | 22 + arch/powerpc/perf/hv-24x7-catalog.h | 25 + arch/powerpc/perf/hv-24x7-domains.h | 28 + arch/powerpc/perf/hv-24x7.c | 787 +++++++++++++++++++- arch/powerpc/perf/hv-24x7.h | 12 +- arch/powerpc/perf/hv-common.c | 10 +- arch/powerpc/perf/hv-gpci-requests.h | 262 +++++++ arch/powerpc/perf/hv-gpci.c | 8 + arch/powerpc/perf/hv-gpci.h | 37 +- arch/powerpc/perf/req-gen/_begin.h | 13 + arch/powerpc/perf/req-gen/_clear.h | 5 + arch/powerpc/perf/req-gen/_end.h | 4 + arch/powerpc/perf/req-gen/_request-begin.h | 15 + arch/powerpc/perf/req-gen/_request-end.h | 8 + arch/powerpc/perf/req-gen/perf.h | 155 ++++ include/linux/perf_event.h | 10 + kernel/events/core.c | 8 + tools/perf/Documentation/perf-list.txt | 13 + tools/perf/Documentation/perf-record.txt | 12 + tools/perf/Documentation/perf-stat.txt | 20 +- tools/perf/util/parse-events.h | 1 + tools/perf/util/pmu.c | 90 ++- 23 files changed, 1491 insertions(+), 60 deletions(-) create mode 100644 arch/powerpc/perf/hv-24x7-domains.h create mode 100644 arch/powerpc/perf/hv-gpci-requests.h create mode 100644 arch/powerpc/perf/req-gen/_begin.h create mode 100644 arch/powerpc/perf/req-gen/_clear.h create mode 100644 arch/powerpc/perf/req-gen/_end.h create mode 100644 arch/powerpc/perf/req-gen/_request-begin.h create mode 100644 arch/powerpc/perf/req-gen/_request-end.h create mode 100644 arch/powerpc/perf/req-gen/perf.h
Signature · 1 line
1.7.9.5
PATCH v3 1/10 tools/perf: support parsing parameterized events
From: Cody P Schafer <[email protected]>
Enable event specification like:
pmu/event_name,param1=0x1,param2=0x4/
Assuming that
/sys/bus/event_source/devices/pmu/events/event_name
Contains something like
param2=foo,bar=1,param1=baz
Changelog[v6]:
[Jiri Olsa] If the sysfs event file specifies 'param=val', make the usage 'hv_24x7/event,param=123/' rather than 'hv_24x7/event,val=123/'. [Sukadev Bhattiprolu] If verbose option is set, print help message if a required parameter is missing or invalid parameter is specified.
--- tools/perf/util/parse-events.h | 1 + tools/perf/util/pmu.c | 64 +++++++++++++++++++++++++++++++++------- 2 files changed, 54 insertions(+), 11 deletions(-)
tools/perf/util/parse-events.h +1 -0
@@ -59,6 +59,7 @@ struct parse_events_term {int type_val;int type_term;struct list_head list; +bool used; };struct parse_events_evlist {
tools/perf/util/pmu.c +53 -11
101 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v3 2/10 tools/perf: extend format_alias() to include event parameters
In reply to Sukadev BhattiproluFrom: Cody P Schafer <[email protected]>
This causes perf list pmu to show parameters for parameterized events like follows:
pmu/event_name,param1=?,param2=?/ [Kernel PMU event]
An example:
hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=?/ [Kernel PMU event]
Changelog[v6]
[Jir Olsa] If the parameter for an event in sysfs is 'param=val', have perf-list show the event as 'param=?' rather than 'val=?'.
--- tools/perf/util/pmu.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
tools/perf/util/pmu.c +25 -1
@@ -748,10 +748,33 @@ void perf_pmu__set_format(unsigned long *bits, long from, long to)set_bit (b, bits); } +static int sub_non_neg (int a,int b) +{ +if (b > a) +return 0 ; +return a - b; +} +static char *format_alias (char *buf,int len,struct perf_pmu *pmu,struct perf_pmu_alias *alias) { -snprintf (buf, len,"%s/%s/" , pmu->name, alias->name); +struct parse_events_term *term; +int used =snprintf (buf, len,"%s/%s" , pmu->name, alias->name); + +list_for_each_entry (term, &alias->terms, list) +if (term->type_val ==PARSE_EVENTS__TERM_TYPE_STR ) + used +=snprintf (buf + used,sub_non_neg (len, used), +",%s=?" , term->config); + +if (sub_non_neg (len, used) >0 ) { + buf[used] ='/' ; + used++; + } +if (sub_non_neg (len, used) >0 ) { + buf[used] ='\0' ; + used++; + }else + buf[len -1 ] ='\0' ;return buf; }
@@ -802,6 +825,7 @@ void print_pmu_events(const char *event_glob, bool name_only)if (is_cpu && !name_only) aliases[j] =format_alias_or (buf,sizeof (buf), pmu, alias); + aliases[j] =strdup (aliases[j]); j++; }
Signature · 1 line
1.7.9.5
PATCH v3 3/10 perf: provide sysfs_show for struct perf_pmu_events_attr
In reply to Sukadev BhattiproluFrom: Cody P Schafer <[email protected]>
(struct perf_pmu_events_attr) is defined in include/linux/perf_event.h, but the only "show" for it is in x86 and contains x86 specific stuff.
Make a generic one for those of us who are just using the event_str.
--- include/linux/perf_event.h | 3 +++ kernel/events/core.c | 8 ++++++++ 2 files changed, 11 insertions(+)
include/linux/perf_event.h +3 -0
@@ -882,6 +882,9 @@ struct perf_pmu_events_attr {const char *event_str; }; +ssize_t perf_event_sysfs_show (struct device *dev,struct device_attribute *attr, +char *page); +#define PMU_EVENT_ATTR (_name, _var, _id, _show) \ static struct perf_pmu_events_attr _var = { \ .attr = __ATTR(_name, 0444, _show, NULL), \
kernel/events/core.c +8 -0
@@ -8100,6 +8100,14 @@ void __init perf_event_init(void) != 1024); } +ssize_t perf_event_sysfs_show (struct device *dev,struct device_attribute *attr, +char *page) +{ +struct perf_pmu_events_attr *pmu_attr = + container_of(attr, struct perf_pmu_events_attr, attr); +return sprintf (page,"%s\n" , pmu_attr->event_str); +} +static int __init perf_event_sysfs_init (void ) {struct pmu *pmu;
Signature · 1 line
1.7.9.5
PATCH v3 4/10 powerpc/perf/hv-24x7: parse catalog and populate sysfs with events
In reply to Sukadev BhattiproluFrom: Cody P Schafer <[email protected]>
Retrieves and parses the 24x7 catalog on POWER systems that supply it (right now, only POWER 8). Events are exposed via sysfs in the standard fashion, and are all parameterized.
Catalog is (at the moment) only parsed on boot. It needs re-parsing when a some hypervisor events occur. At that point we'll also need to prevent old events from continuing to function (counter that is passed in via spare space in the config values?).
Changelog[v6]
[Sukadev Bhattiprolu] Use PHYS and VCPU in place of PHYSICAL and VIRTUAL_PROCESSOR to shorten the names of the domains and hence, events;
Changelog[v2]
[Joe Perches, David Laight] Use beNN_to_cpu() instead of guessing
the size from type.
Use kmem_cache_free() to free page allocated with kmem_cache_alloc().
--- arch/powerpc/perf/hv-24x7-catalog.h | 25 ++ arch/powerpc/perf/hv-24x7-domains.h | 28 ++ arch/powerpc/perf/hv-24x7.c | 787 ++++++++++++++++++++++++++++++++++- arch/powerpc/perf/hv-24x7.h | 12 +- 4 files changed, 838 insertions(+), 14 deletions(-) create mode 100644 arch/powerpc/perf/hv-24x7-domains.h
arch/powerpc/perf/hv-24x7-catalog.h +25 -0
@@ -30,4 +30,29 @@ struct hv_24x7_catalog_page_0 { __u8 reserved6[2]; } __packed; +struct hv_24x7_event_data { +__be16 length;/* in bytes, must be a multiple of 16 */ +__u8 reserved1[2 ]; +__u8 domain;/* Chip = 1, Core = 2 */ +__u8 reserved2[1 ]; +__be16 event_group_record_offs;/* in bytes, must be 8 byte aligned */ +__be16 event_group_record_len;/* in bytes */ + +/* in bytes, offset from event_group_record */ +__be16 event_counter_offs; + +/* verified_state, unverified_state, caveat_state, broken_state, ... */ +__be32 flags; + +__be16 primary_group_ix; +__be16 group_count; +__be16 event_name_len; +__u8 remainder[]; +/* __u8 event_name[event_name_len - 2]; */ +/* __be16 event_description_len; */ +/* __u8 event_desc[event_description_len - 2]; */ +/* __be16 detailed_desc_len; */ +/* __u8 detailed_desc[detailed_desc_len - 2]; */ +} __packed; +#endif
arch/powerpc/perf/hv-24x7-domains.h new file +28 -0
@@ -0,0 +1,28 @@ + +/* +* DOMAIN(name, num, index_kind, is_physical) +* +* @name: An all caps token, suitable for use in generating an enum +* member and appending to an event name in sysfs. +* +* @num: The number corresponding to the domain as given in +* documentation. We assume the catalog domain and the hcall +* domain have the same numbering (so far they do), but this +* may need to be changed in the future. +* +* @index_kind: A stringifiable token describing the meaning of the index +* within the given domain. Must fit the parsing rules of the +* perf sysfs api. +* +* @is_physical: True if the domain is physical, false otherwise (if virtual). +* +* Note: The terms PHYS_CHIP, PHYS_CORE, VCPU correspond to physical chip, +* physical core and virtual processor in 24x7 Counters specifications. +*/ + +DOMAIN(PHYS_CHIP, 0x01, chip, true) +DOMAIN(PHYS_CORE, 0x02, core, true) +DOMAIN(VCPU_HOME_CORE, 0x03, vcpu, false) +DOMAIN(VCPU_HOME_CHIP, 0x04, vcpu, false) +DOMAIN(VCPU_HOME_NODE, 0x05, vcpu, false) +DOMAIN (VCPU_REMOTE_NODE ,0x06 , vcpu, false)
arch/powerpc/perf/hv-24x7.c +779 -8
845 lines not on this page · raw message
arch/powerpc/perf/hv-24x7.h +6 -6
@@ -3,14 +3,14 @@#include <linux/types.h> +enum hv_perf_domains { +#define DOMAIN(n, v, x, c) HV_PERF_DOMAIN_##n = v, +#include "hv-24x7-domains.h" +#undef DOMAIN +}; +struct hv_24x7_request {/* PHYSICAL domains require enabling via phyp/hmc. */ -#define HV_24X7_PERF_DOMAIN_PHYSICAL_CHIP 0x01 -#define HV_24X7_PERF_DOMAIN_PHYSICAL_CORE 0x02 -#define HV_24X7_PERF_DOMAIN_VIRTUAL_PROCESSOR_HOME_CORE 0x03 -#define HV_24X7_PERF_DOMAIN_VIRTUAL_PROCESSOR_HOME_CHIP 0x04 -#define HV_24X7_PERF_DOMAIN_VIRTUAL_PROCESSOR_HOME_NODE 0x05 -#define HV_24X7_PERF_DOMAIN_VIRTUAL_PROCESSOR_REMOTE_NODE 0x06__u8 performance_domain;__u8 reserved[0x1 ];
Signature · 1 line
1.7.9.5
PATCH v3 5/10 perf: add PMU_EVENT_ATTR_STRING() helper
In reply to Sukadev BhattiproluFrom: Cody P Schafer <[email protected]>
Helper for constructing static struct perf_pmu_events_attr s.
--- include/linux/perf_event.h | 7 +++++++ 1 file changed, 7 insertions(+)
include/linux/perf_event.h +7 -0
@@ -891,6 +891,13 @@ static struct perf_pmu_events_attr _var = { \ .id = _id, \ }; +#define PMU_EVENT_ATTR_STRING (_name, _var, _value) \ +static struct perf_pmu_events_attr _var = { \ + .attr = __ATTR(_name, 0444, perf_event_sysfs_show, NULL), \ + .event_str = _value, \ +}; + +#define PMU_FORMAT_ATTR (_name, _format) \ static ssize_t \ _name##_show(struct device *dev, \
Signature · 1 line
1.7.9.5
PATCH v3 6/10 powerpc/perf/{hv-gpci,hv-common}: generate requests with counters annotated
In reply to Sukadev BhattiproluFrom: Cody P Schafer <[email protected]>
This adds (in req-gen/) a framework for defining gpci counter requests. It uses macro magic similar to ftrace.
Also convert the existing hv-gpci request structures and enum values to use the new framework (and adjust old users of the structs and enum values to cope with changes in naming).
In exchange for this macro disaster, we get autogenerated event listing for GPCI in sysfs, build time field offset checking, and zero duplication of information about GPCI requests.
--- arch/powerpc/perf/hv-common.c | 10 +- arch/powerpc/perf/hv-gpci-requests.h | 79 ++++++++++++++ arch/powerpc/perf/hv-gpci.c | 8 ++ arch/powerpc/perf/hv-gpci.h | 37 +++---- arch/powerpc/perf/req-gen/_begin.h | 13 +++ arch/powerpc/perf/req-gen/_clear.h | 5 + arch/powerpc/perf/req-gen/_end.h | 4 + arch/powerpc/perf/req-gen/_request-begin.h | 15 +++ arch/powerpc/perf/req-gen/_request-end.h | 8 ++ arch/powerpc/perf/req-gen/perf.h | 155 ++++++++++++++++++++++++++++ 10 files changed, 304 insertions(+), 30 deletions(-) create mode 100644 arch/powerpc/perf/hv-gpci-requests.h create mode 100644 arch/powerpc/perf/req-gen/_begin.h create mode 100644 arch/powerpc/perf/req-gen/_clear.h create mode 100644 arch/powerpc/perf/req-gen/_end.h create mode 100644 arch/powerpc/perf/req-gen/_request-begin.h create mode 100644 arch/powerpc/perf/req-gen/_request-end.h create mode 100644 arch/powerpc/perf/req-gen/perf.h
arch/powerpc/perf/hv-common.c +5 -5
@@ -9,13 +9,13 @@ unsigned long hv_perf_caps_get(struct hv_perf_caps *caps)unsigned long r;struct p {struct hv_get_perf_counter_info_params params; -struct cv_system_performance_capabilities caps; +struct hv_gpci_system_performance_capabilities caps; } __packed__aligned(sizeof(uint64_t)) ;struct p arg = { .params = { .counter_request =cpu_to_be32 ( -CIR_SYSTEM_PERFORMANCE_CAPABILITIES ), + HV_GPCI_system_performance_capabilities), .starting_index =cpu_to_be32 (-1 ), .counter_info_version_in =0 , }
@@ -31,9 +31,9 @@ unsigned long hv_perf_caps_get(struct hv_perf_caps *caps) caps->version = arg.params.counter_info_version_out; caps->collect_privileged = !!arg.caps.perf_collect_privileged; - caps->ga = !!(arg.caps.capability_mask &CV_CM_GA ); - caps->expanded = !!(arg.caps.capability_mask &CV_CM_EXPANDED ); - caps->lab = !!(arg.caps.capability_mask &CV_CM_LAB ); + caps->ga = !!(arg.caps.capability_mask &HV_GPCI_CM_GA ); + caps->expanded = !!(arg.caps.capability_mask &HV_GPCI_CM_EXPANDED ); + caps->lab = !!(arg.caps.capability_mask &HV_GPCI_CM_LAB );return r; }
arch/powerpc/perf/hv-gpci-requests.h new file +79 -0
79 lines not on this page · raw message
arch/powerpc/perf/hv-gpci.c +8 -0
@@ -57,6 +57,11 @@ static struct attribute_group format_group = { .attrs = format_attrs, }; +static struct attribute_group event_group = { + .name ="events" , + .attrs = hv_gpci_event_attrs, +}; +#define HV_CAPS_ATTR (_name, _format) \ static ssize_t _name##_show(struct device *dev, \ struct device_attribute *attr, \
@@ -102,6 +107,7 @@ static struct attribute_group interface_group = {static const struct attribute_group *attr_groups[] = { &format_group, + &event_group, &interface_group,NULL , };
@@ -271,6 +277,8 @@ static int hv_gpci_init(void)unsigned long hret;struct hv_perf_caps caps; +hv_gpci_assert_offsets_correct (); +if (!firmware_has_feature (FW_FEATURE_LPAR )) {pr_debug ("not a virtualized system, not enabling\n" );return -ENODEV ;
arch/powerpc/perf/hv-gpci.h +12 -25
@@ -42,32 +42,19 @@ struct hv_get_perf_counter_info_params {*/ #define COUNTER_INFO_VERSION_CURRENT 0x8 -/* -* These determine the counter_value[] layout and the meaning of starting_index -* and secondary_index. -* -* Unless otherwise noted, @secondary_index is unused and ignored. -*/ -enum counter_info_requests { - -/* GENERAL */ - -/* @starting_index: must be -1 (to refer to the current partition) -*/ -CIR_SYSTEM_PERFORMANCE_CAPABILITIES =0X40 , +/* capability mask masks. */ +enum { +HV_GPCI_CM_GA = (1 <<7 ), +HV_GPCI_CM_EXPANDED = (1 <<6 ), +HV_GPCI_CM_LAB = (1 <<5 ) }; -struct cv_system_performance_capabilities { -/* If != 0, allowed to collect data from other partitions */ -__u8 perf_collect_privileged; - -/* These following are only valid if counter_info_version >= 0x3 */ -#define CV_CM_GA (1 << 7) -#define CV_CM_EXPANDED (1 << 6) -#define CV_CM_LAB (1 << 5) -/* remaining bits are reserved */ -__u8 capability_mask; -__u8 reserved[0xE ]; -} __packed; +#define REQUEST_FILE "../hv-gpci-requests.h" +#define NAME_LOWER hv_gpci +#define NAME_UPPER HV_GPCI +#include "req-gen/perf.h" +#undef REQUEST_FILE +#undef NAME_LOWER +#undef NAME_UPPER#endif
arch/powerpc/perf/req-gen/_begin.h new file +13 -0
@@ -0,0 +1,13 @@ +/* Include paths to be used in interface defining headers */ +#ifndef POWERPC_PERF_REQ_GEN_H_ +#define POWERPC_PERF_REQ_GEN_H_ + +#define CAT2_STR_ (t, s) __stringify(t/s) +#define CAT2_STR (t, s) CAT2_STR_(t, s) +#define I (...) __VA_ARGS__ + +#endif + +#define REQ_GEN_PREFIX req-gen +#define REQUEST_BEGIN CAT2_STR(REQ_GEN_PREFIX, _request-begin.h) +#define REQUEST_END CAT2_STR(REQ_GEN_PREFIX, _request-end.h)
arch/powerpc/perf/req-gen/_clear.h new file +5 -0
@@ -0,0 +1,5 @@ + +#undef __field_ +#undef __count_ +#undef __array_ +#undef REQUEST_
arch/powerpc/perf/req-gen/_end.h new file +4 -0
@@ -0,0 +1,4 @@ + +#undef REQ_GEN_PREFIX +#undef REQUEST_BEGIN +#undef REQUEST_END
arch/powerpc/perf/req-gen/_request-begin.h new file +15 -0
@@ -0,0 +1,15 @@ + +#define REQUEST (r_contents) \ + REQUEST_(REQUEST_NAME, REQUEST_NUM, REQUEST_IDX_KIND, I(r_contents)) + +#define __field (f_offset, f_bytes, f_name) \ + __field_(REQUEST_NAME, REQUEST_NUM, REQUEST_IDX_KIND, \ + f_offset, f_bytes, f_name) + +#define __array (f_offset, f_bytes, f_name) \ + __array_(REQUEST_NAME, REQUEST_NUM, REQUEST_IDX_KIND, \ + f_offset, f_bytes, f_name) + +#define __count (f_offset, f_bytes, f_name) \ + __count_(REQUEST_NAME, REQUEST_NUM, REQUEST_IDX_KIND, \ + f_offset, f_bytes, f_name)
arch/powerpc/perf/req-gen/_request-end.h new file +8 -0
@@ -0,0 +1,8 @@ +#undef REQUEST +#undef __field +#undef __array +#undef __count + +#undef REQUEST_NAME +#undef REQUEST_NUM +#undef REQUEST_IDX_KIND
arch/powerpc/perf/req-gen/perf.h new file +155 -0
155 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v3 7/10 powerpc/perf/hv-gpci: add the remaining gpci requests
In reply to Sukadev BhattiproluFrom: Cody P Schafer <[email protected]>
Add the remaining gpci requests that contain counters suitable for use by perf. Omit those that don't contain any counters (but note their ommision).
--- arch/powerpc/perf/hv-gpci-requests.h | 183 ++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+)
arch/powerpc/perf/hv-gpci-requests.h +183 -0
@@ -65,6 +65,33 @@ REQUEST(__count(0, 8, processor_time_in_timebase_cycles) )#include I (REQUEST_END ) +#define REQUEST_NAME entitled_capped_uncapped_donated_idle_timebase_by_partition +#define REQUEST_NUM 0x20 +#define REQUEST_IDX_KIND sibling_part_id +#include I (REQUEST_BEGIN ) +REQUEST(__field(0, 8, partition_id) + __count(0x8, 8, entitled_cycles) + __count(0x10, 8, consumed_capped_cycles) + __count(0x18, 8, consumed_uncapped_cycles) + __count(0x20, 8, cycles_donated) +__count (0x28 ,8 , purr_idle_cycles) +) +#include I (REQUEST_END ) + +/* +* Not avaliable for counter_info_version >= 0x8, use +* run_instruction_cycles_by_partition(0x100) instead. +*/ +#define REQUEST_NAME run_instructions_run_cycles_by_partition +#define REQUEST_NUM 0x30 +#define REQUEST_IDX_KIND sibling_part_id +#include I (REQUEST_BEGIN ) +REQUEST(__field(0, 8, partition_id) + __count(0x8, 8, instructions_completed) +__count (0x10 ,8 , cycles) +) +#include I (REQUEST_END ) +#define REQUEST_NAME system_performance_capabilities#define REQUEST_NUM 0x40#define REQUEST_IDX_KIND M1
@@ -75,5 +102,161 @@ REQUEST(__field(0, 1, perf_collect_privileged) )#include I (REQUEST_END ) +#define REQUEST_NAME processor_bus_utilization_abc_links +#define REQUEST_NUM 0x50 +#define REQUEST_IDX_KIND hw_chip_id +#include I (REQUEST_BEGIN ) +REQUEST(__field(0, 4, hw_chip_id) + __array(0x4, 0xC, reserved1) + __count(0x10, 8, total_link_cycles) + __count(0x18, 8, idle_cycles_for_a_link) + __count(0x20, 8, idle_cycles_for_b_link) + __count(0x28, 8, idle_cycles_for_c_link) +__array (0x30 ,0x20 , reserved2) +) +#include I (REQUEST_END ) + +#define REQUEST_NAME processor_bus_utilization_wxyz_links +#define REQUEST_NUM 0x60 +#define REQUEST_IDX_KIND hw_chip_id +#include I (REQUEST_BEGIN ) +REQUEST(__field(0, 4, hw_chip_id) + __array(0x4, 0xC, reserved1) + __count(0x10, 8, total_link_cycles) + __count(0x18, 8, idle_cycles_for_w_link) + __count(0x20, 8, idle_cycles_for_x_link) + __count(0x28, 8, idle_cycles_for_y_link) + __count(0x30, 8, idle_cycles_for_z_link) +__array (0x38 ,0x28 , reserved2) +) +#include I (REQUEST_END ) + +#define REQUEST_NAME processor_bus_utilization_gx_links +#define REQUEST_NUM 0x70 +#define REQUEST_IDX_KIND hw_chip_id +#include I (REQUEST_BEGIN ) +REQUEST(__field(0, 4, hw_chip_id) + __array(0x4, 0xC, reserved1) + __count(0x10, 8, gx0_in_address_cycles) + __count(0x18, 8, gx0_in_data_cycles) + __count(0x20, 8, gx0_in_retries) + __count(0x28, 8, gx0_in_bus_cycles) + __count(0x30, 8, gx0_in_cycles_total) + __count(0x38, 8, gx0_out_address_cycles) + __count(0x40, 8, gx0_out_data_cycles) + __count(0x48, 8, gx0_out_retries) + __count(0x50, 8, gx0_out_bus_cycles) + __count(0x58, 8, gx0_out_cycles_total) + __count(0x60, 8, gx1_in_address_cycles) + __count(0x68, 8, gx1_in_data_cycles) + __count(0x70, 8, gx1_in_retries) + __count(0x78, 8, gx1_in_bus_cycles) + __count(0x80, 8, gx1_in_cycles_total) + __count(0x88, 8, gx1_out_address_cycles) + __count(0x90, 8, gx1_out_data_cycles) + __count(0x98, 8, gx1_out_retries) + __count(0xA0, 8, gx1_out_bus_cycles) +__count (0xA8 ,8 , gx1_out_cycles_total) +) +#include I (REQUEST_END ) + +#define REQUEST_NAME processor_bus_utilization_mc_links +#define REQUEST_NUM 0x80 +#define REQUEST_IDX_KIND hw_chip_id +#include I (REQUEST_BEGIN ) +REQUEST(__field(0, 4, hw_chip_id) + __array(0x4, 0xC, reserved1) + __count(0x10, 8, mc0_frames) + __count(0x18, 8, mc0_reads) + __count(0x20, 8, mc0_write) + __count(0x28, 8, mc0_total_cycles) + __count(0x30, 8, mc1_frames) + __count(0x38, 8, mc1_reads) + __count(0x40, 8, mc1_writes) +__count (0x48 ,8 , mc1_total_cycles) +) +#include I (REQUEST_END ) + +/* Processor_config (0x90) skipped, no counters */ +/* Current_processor_frequency (0x91) skipped, no counters */ + +#define REQUEST_NAME processor_core_utilization +#define REQUEST_NUM 0x94 +#define REQUEST_IDX_KIND phys_processor_idx +#include I (REQUEST_BEGIN ) +REQUEST(__field(0, 4, phys_processor_idx) + __field(0x4, 4, hw_processor_id) + __count(0x8, 8, cycles_across_any_thread) + __count(0x10, 8, timebase_at_collection) + __count(0x18, 8, purr_cycles) + __count(0x20, 8, sum_of_cycles_across_all_threads) +__count (0x28 ,8 , instructions_completed) +) +#include I (REQUEST_END ) + +/* Processor_core_power_mode (0x95) skipped, no counters */ +/* Affinity_domain_information_by_virtual_processor (0xA0) skipped, +* no counters */ +/* Affinity_domain_information_by_domain (0xB0) skipped, no counters */ +/* Affinity_domain_information_by_partition (0xB1) skipped, no counters */ +/* Physical_memory_info (0xC0) skipped, no counters */ +/* Processor_bus_topology (0xD0) skipped, no counters */ + +#define REQUEST_NAME partition_hypervisor_queuing_times +#define REQUEST_NUM 0xE0 +#define REQUEST_IDX_KIND partition_id +#include I (REQUEST_BEGIN ) +REQUEST(__field(0, 2, partition_id) + __array(0x2, 6, reserved1) + __count(0x8, 8, time_waiting_for_entitlement) + __count(0x10, 8, times_waited_for_entitlement) + __count(0x18, 8, time_waiting_for_phys_processor) + __count(0x20, 8, times_waited_for_phys_processor) + __count(0x28, 8, dispatches_on_home_core) + __count(0x30, 8, dispatches_on_home_primary_affinity_domain) + __count(0x38, 8, dispatches_on_home_secondary_affinity_domain) + __count(0x40, 8, dispatches_off_home_secondary_affinity_domain) +__count (0x48 ,8 , dispatches_on_dedicated_processor_donating_cycles) +) +#include I (REQUEST_END ) + +#define REQUEST_NAME system_hypervisor_times +#define REQUEST_NUM 0xF0 +#define REQUEST_IDX_KIND M1 +#include I (REQUEST_BEGIN ) +REQUEST(__count(0, 8, time_spent_to_dispatch_virtual_processors) + __count(0x8, 8, time_spent_processing_virtual_processor_timers) + __count(0x10, 8, time_spent_managing_partitions_over_entitlement) +__count (0x18 ,8 , time_spent_on_system_managment) +) +#include I (REQUEST_END ) + +#define REQUEST_NAME system_tlbie_count_and_time +#define REQUEST_NUM 0xF4 +#define REQUEST_IDX_KIND M1 +#include I (REQUEST_BEGIN ) +REQUEST(__count(0, 8, tlbie_instructions_issued) +/* +* FIXME: The spec says the offset here is 0x10, which I suspect +* is wrong. +*/ +__count (0x8 ,8 , time_spent_issuing_tlbies) +) +#include I (REQUEST_END ) + +#define REQUEST_NAME partition_instruction_count_and_time +#define REQUEST_NUM 0x100 +#define REQUEST_IDX_KIND partition_id +#include I (REQUEST_BEGIN ) +REQUEST(__field(0, 2, partition_id) + __array(0x2, 0x6, reserved1) + __count(0x8, 8, instructions_performed) +__count (0x10 ,8 , time_collected) +) +#include I (REQUEST_END ) + +/* set_mmcrh (0x80001000) skipped, no counters */ +/* retrieve_hpmcx (0x80002000) skipped, no counters */ +#undef M1#include "req-gen/_end.h"
Signature · 1 line
1.7.9.5
PATCH v3 8/10 perf Documentation: add event parameters
In reply to Sukadev BhattiproluFrom: Cody P Schafer <[email protected]>
Event parameters are a basic way for partial events to be specified in sysfs with per-event names given to the fields that need to be filled in when using a particular event.
It is intended for supporting cases where the single 'cpu' parameter is insufficient. For example, POWER 8 has events for physical sockets/cores/cpus that are accessible from with virtual machines. To keep using the single 'cpu' parameter we'd need to perform a mapping between Linux's cpus and the physical machine's cpus (in this case Linux is running under a hypervisor). This isn't possible because bindings between our cpus and physical cpus may not be fixed, and we probably won't have a "cpu" on each physical cpu.
--- .../testing/sysfs-bus-event_source-devices-events | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/ABI/testing/sysfs-bus-event_source-devices-events +6 -0
@@ -52,12 +52,18 @@ Description: Per-pmu performance monitoring events specific to the running syste event=0x2abc event=0x423,inv,cmask=0x3 domain=0x1,offset=0x8,starting_index=0xffff + domain=0x1,offset=0x8,starting_index=phys_cpu Each of the assignments indicates a value to be assigned to a particular set of bits (as defined by the format file corresponding to the <term>) in the perf_event structure passed to the perf_open syscall. + In the case of the last example, a value replacing "phys_cpu" + would need to be provided by the user selecting the particular + event. This is refered to as "event parameterization". All + non-numerical values indicate an event parameter. + What: /sys/bus/event_source/devices/<pmu>/events/<event>.unit Date: 2014/02/24 Contact: Linux kernel mailing list <[email protected]>
Signature · 1 line
1.7.9.5
PATCH v3 9/10 tools/perf: Document parameterized and symbolic events
In reply to Sukadev BhattiproluFrom: Cody P Schafer <[email protected]>
Changelog[v6]:
- [Sukadev Bhattiprolu]: Update documentation of perf-list and perf-record; Added documentation for perf-stat.
--- tools/perf/Documentation/perf-list.txt | 13 +++++++++++++ tools/perf/Documentation/perf-record.txt | 12 ++++++++++++ tools/perf/Documentation/perf-stat.txt | 20 ++++++++++++++++---- 3 files changed, 41 insertions(+), 4 deletions(-)
tools/perf/Documentation/perf-list.txt +13 -0
@@ -89,6 +89,19 @@ raw encoding of 0x1A8 can be used: You should refer to the processor specific documentation for getting these details. Some of them are referenced in the SEE ALSO section below. +PARAMETERIZED EVENTS +-------------------- + +Some pmu events listed by 'perf-list' will be displayed with '?' in them. For +example: + + hv_gpci/dtbp_ptitc,starting_index=?/ + +This means that when provided as an event, a value for 'starting_index' must +also be supplied. For example: + + perf stat -C 0 -e 'hv_gpci/dtbp_ptitc,starting_index=0x2/' ... + OPTIONS -------
tools/perf/Documentation/perf-record.txt +12 -0
@@ -33,6 +33,18 @@ OPTIONS - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a hexadecimal event descriptor. + - a symbolically formed PMU event like 'pmu/param1=0x3,param2/' where + 'param1', 'param2', etc are defined as formats for the PMU in + /sys/bus/event_sources/devices/<pmu>/format/*. + + - a symbolically formed event like 'pmu/config=M,config1=N,config3=K/' + + where M, N, K are numbers (in decimal, hex, octal format). Acceptable + values for each of 'config', 'config1' and 'config2' are defined by + corresponding entries in /sys/bus/event_sources/devices/<pmu>/format/* + param1 and param2 are defined as formats for the PMU in: + /sys/bus/event_sources/devices/<pmu>/format/* + - a hardware breakpoint event in the form of '\mem:addr[:access]' where addr is the address in memory you want to break in. Access is the memory access type (read, write, execute) it can
tools/perf/Documentation/perf-stat.txt +16 -4
@@ -25,10 +25,22 @@ OPTIONS -e:: --event=:: - Select the PMU event. Selection can be a symbolic event name - (use 'perf list' to list all events) or a raw PMU - event (eventsel+umask) in the form of rNNN where NNN is a - hexadecimal event descriptor. + Select the PMU event. Selection can be: + + - a symbolic event name (use 'perf list' to list all events) + + - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a + hexadecimal event descriptor. + + - a symbolically formed event like 'pmu/param1=0x3,param2/' where + param1 and param2 are defined as formats for the PMU in + /sys/bus/event_sources/devices/<pmu>/format/* + + - a symbolically formed event like 'pmu/config=M,config1=N,config2=K/' + where M, N, K are numbers (in decimal, hex, octal format). + Acceptable values for each of 'config', 'config1' and 'config2' + parameters are defined by corresponding entries in + /sys/bus/event_sources/devices/<pmu>/format/* -i:: --no-inherit::
Signature · 1 line
1.7.9.5
PATCH v3 10/10 powerpc/perf/hv-24x7: Document sysfs event description entries
In reply to Sukadev BhattiproluFrom: Cody P Schafer <[email protected]>
--- .../testing/sysfs-bus-event_source-devices-hv_24x7 | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+)
Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_24x7 +22 -0
@@ -21,3 +21,25 @@ Contact: Cody P Schafer <[email protected]> Description: Exposes the "version" field of the 24x7 catalog. This is also extractable from the provided binary "catalog" sysfs entry. + +What: /sys/bus/event_source/devices/hv_24x7/event_descs/<event-name> +Date: February 2014 +Contact: Cody P Schafer <[email protected]> +Description: + Provides the description of a particular event as provided by + the firmware. If firmware does not provide a description, no + file will be created. + + Note that the event-name lacks the domain suffix appended for + events in the events/ dir. + +What: /sys/bus/event_source/devices/hv_24x7/event_long_descs/<event-name> +Date: February 2014 +Contact: Cody P Schafer <[email protected]> +Description: + Provides the "long" description of a particular event as + provided by the firmware. If firmware does not provide a + description, no file will be created. + + Note that the event-name lacks the domain suffix appended for + events in the events/ dir.
Signature · 1 line
1.7.9.5
On Wed, Sep 17, 2014 at 11:51:53AM -0700, Sukadev Bhattiprolu wrote:
SNIP
Quoted 6 lines
This means that when provided as an event, a value for
phys_processor_idxmust also be supplied. For example:perf stat -e 'hv_gpci/dtbp_ptitc,phys_processor_idx=0x2/' ...
Quoted 10 lines
Changelog[v3]
- [Jiri Olsa] Changed the event parameters are specified. If event file specifes 'param=val' make the usage 'param=123' rather than 'val=123'. (patch 1,2/10)
- Shortened event names using "PHYS" and "VCPU" (patch 4/10)
- Print help message if invalid parameter is specified or required parameter is missing.
- Moved 3 patches that are unrelated to parametrized events into a separate patchset.
- Reordered patches so code changes come first.
hi,
Could you please rebase to latest acme/perf/core? There were some changes in util/pmu.c conflicting with yours..
thanks,
jirka