diff options
author | Kajol Jain <kjain@linux.ibm.com> | 2020-12-28 11:52:04 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2021-01-30 03:39:25 +0300 |
commit | e5f9d8858612c192a4326f39ed16c91c3a9e0893 (patch) | |
tree | 6d86a476696a3275a0716fa7321a080344e18fd0 /arch/powerpc/perf | |
parent | 7613f5a66becfd0e43a0f34de8518695888f5458 (diff) | |
download | linux-e5f9d8858612c192a4326f39ed16c91c3a9e0893.tar.xz |
powerpc/perf/hv-24x7: Dont create sysfs event files for dummy events
The hv_24x7 performance monitoring unit creates a list of supported
events from the event catalog obtained via HCALL. The hv_24x7 catalog
could also contain invalid or dummy events with names like RESERVED*.
These events do not have any hardware counters backing them. Add a
check to string compare the event names to filter such events out.
Result on power9 machine:
Before this patch:
.....
hv_24x7/PM_XLINK2_OUT_ODD_CYC,chip=?/ [Kernel PMU event]
hv_24x7/PM_XLINK2_OUT_ODD_DATA_COUNT,chip=?/ [Kernel PMU event]
hv_24x7/PM_XLINK2_OUT_ODD_TOTAL_UTIL,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATR_DEMAND_CHECKOUT,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATR_DEMAND_CHECKOUT_MISS,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATSD_SENT,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATSD_TLBI_RCV,chip=?/ [Kernel PMU event]
hv_24x7/RESERVED_NEST1,chip=?/ [Kernel PMU event]
hv_24x7/RESERVED_NEST10,chip=?/ [Kernel PMU event]
hv_24x7/RESERVED_NEST11,chip=?/ [Kernel PMU event]
hv_24x7/RESERVED_NEST12,chip=?/ [Kernel PMU event]
hv_24x7/RESERVED_NEST13,chip=?/ [Kernel PMU event]
......
dmesg:
[ 0.000362] printk: console [hvc0] enabled
[ 0.815452] hv-24x7: read 1530 catalog entries, created 537 event attrs (0 failures), 275 descs
After this patch:
......
hv_24x7/PM_XLINK2_OUT_ODD_AVLBL_CYC,chip=?/ [Kernel PMU event]
hv_24x7/PM_XLINK2_OUT_ODD_CYC,chip=?/ [Kernel PMU event]
hv_24x7/PM_XLINK2_OUT_ODD_DATA_COUNT,chip=?/ [Kernel PMU event]
hv_24x7/PM_XLINK2_OUT_ODD_TOTAL_UTIL,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATR_DEMAND_CHECKOUT,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATR_DEMAND_CHECKOUT_MISS,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATSD_SENT,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATSD_TLBI_RCV,chip=?/ [Kernel PMU event]
hv_24x7/TOD,chip=?/ [Kernel PMU event]
......
dmesg:
[ 0.000357] printk: console [hvc0] enabled
[ 0.808592] hv-24x7: read 1530 catalog entries, created 509 event attrs (0 failures), 275 descs
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
[mpe: Simplify ignore_event(), minor change log formatting]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201228085204.18026-1-kjain@linux.ibm.com
Diffstat (limited to 'arch/powerpc/perf')
-rw-r--r-- | arch/powerpc/perf/hv-24x7.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 6e7e820508df..e5eb33255066 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -764,6 +764,14 @@ static ssize_t catalog_event_len_validate(struct hv_24x7_event_data *event, return ev_len; } +/* + * Return true incase of invalid or dummy events with names like RESERVED* + */ +static bool ignore_event(const char *name) +{ + return strncmp(name, "RESERVED", 8) == 0; +} + #define MAX_4K (SIZE_MAX / 4096) static int create_events_from_catalog(struct attribute ***events_, @@ -894,6 +902,10 @@ static int create_events_from_catalog(struct attribute ***events_, name = event_name(event, &nl); + if (ignore_event(name)) { + junk_events++; + continue; + } if (event->event_group_record_len == 0) { pr_devel("invalid event %zu (%.*s): group_record_len == 0, skipping\n", event_idx, nl, name); @@ -955,6 +967,9 @@ static int create_events_from_catalog(struct attribute ***events_, continue; name = event_name(event, &nl); + if (ignore_event(name)) + continue; + nonce = event_uniq_add(&ev_uniq, name, nl, event->domain); ct = event_data_to_attrs(event_idx, events + event_attr_ct, event, nonce); |