Kajol Jain <kj...@linux.ibm.com> writes: > hv_24x7 performance monitoring unit creates list of supported events > from the event catalog obtained via HCALL. hv_24x7 catalog could also > contain invalid or dummy events (with names like FREE_* or CPM_FREE_* > and RESERVED*). These events do not have any hardware counters > backing them. So patch adds a check to string compare the event names > to filter out them. > > Result in 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] > ...... > > Demsg: > [ 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 <kj...@linux.ibm.com> > --- > arch/powerpc/perf/hv-24x7.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > --- > Changelog > v1 -> v2 > - Include "RESERVED*" as part of the invalid event check as > suggested by Madhavan Srinivasan > - Add new helper function "ignore_event" to check invalid/dummy > events as suggested by Michael Ellerman > - Remove pr_info to print each invalid event as suggested by > Michael Ellerman > --- > diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c > index 6e7e820508df..1a6004d88f98 100644 > --- a/arch/powerpc/perf/hv-24x7.c > +++ b/arch/powerpc/perf/hv-24x7.c > @@ -764,6 +764,16 @@ 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 FREE_* or > CPM_FREE_* > + * and RESERVED* > + */ > +static bool ignore_event(const char *name) > +{ > + return (strstr(name, "FREE_") || !strncmp(name, "RESERVED", 8)) ? > + true : false;
That's FREE_ anywhere in the string, which seems a bit loose. Do we have any documentation or anything that tells us that any event with "FREE_" in the name will always be invalid? cheers