powerpc/perf/hv-24x7: Dont create sysfs event files for dummy events
PATCH 1/1 powerpc/perf/hv-24x7: Dont create sysfs event files for dummy events
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_ so on). These events does not have any hardware counters backing them. So patch adds a check to string compare the event names to filter out them.
--- arch/powerpc/perf/hv-24x7.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/powerpc/perf/hv-24x7.c +8 -0
@@ -894,6 +894,11 @@ static int create_events_from_catalog(struct attribute ***events_, name =event_name (event, &nl); +if (strstr (name,"FREE_" )) { +pr_info ("invalid event %zu (%.*s)\n" , event_idx, nl, 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 +960,9 @@ static int create_events_from_catalog(struct attribute ***events_,continue ; name =event_name (event, &nl); +if (strstr (name,"FREE_" )) +continue ; + nonce =event_uniq_add (&ev_uniq, name, nl, event->domain); ct =event_data_to_attrs (event_idx, events + event_attr_ct, event, nonce);
Signature · 1 line
2.26.2
Madhavan Srinivasan
maintainerQuoted 3 lines · Kajol Jain
hv_24x7performance monitoring unit creates list of supported events from the event catalog obtained via HCALL.hv_24x7catalog could also contain invalid or dummy events (with names likeFREE_orCPM_FREE_so
Can you also include " RESERVED_NEST*" as part of the check.
# ls /sys/devices/hv_24x7/events | grep RESERVED RESERVED_NEST1 RESERVED_NEST10 RESERVED_NEST11 RESERVED_NEST12 ...
Maddy
Quoted 35 lines
on). These events does not have any hardware counters backing them. So patch adds a check to string compare the event names to filter out them.
Signed-off-by Kajol Jain <[email protected]>--- arch/powerpc/perf/hv-24x7.c | 8 ++++++++ 1 file changed, 8 insertions(+)arch/powerpc/perf/hv-24x7.c +8
-0@@ -894,6 +894,11 @@ static int create_events_from_catalog(struct attribute ***events_, name =event_name (event, &nl); +if (strstr (name,"FREE_" )) { +pr_info ("invalid event %zu (%.*s)\n" , event_idx, nl, 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 +960,9 @@ static int create_events_from_catalog(struct attribute ***events_,continue ; name =event_name (event, &nl); +if (strstr (name,"FREE_" )) +continue ; + nonce =event_uniq_add (&ev_uniq, name, nl, event->domain); ct =event_data_to_attrs (event_idx, events + event_attr_ct, event, nonce);
Quoted 8 lines · Madhavan Srinivasan
Quoted 3 lines · Kajol Jain
hv_24x7performance monitoring unit creates list of supported events from the event catalog obtained via HCALL.hv_24x7catalog could also contain invalid or dummy events (with names like FREE_ orCPM_FREE_soCan you also include " RESERVED_NEST*" as part of the check.
Hi Maddy,
Sure, I will add this check.
Thanks,
Kajol Jain
Quoted 47 lines
# ls /sys/devices/hv_24x7/events | grep RESERVED RESERVED_NEST1 RESERVED_NEST10 RESERVED_NEST11 RESERVED_NEST12 ...Maddy
Quoted 35 lines
on). These events does not have any hardware counters backing them. So patch adds a check to string compare the event names to filter out them.
Signed-off-by Kajol Jain <[email protected]>---
arch/powerpc/perf/hv-24x7.c| 8 ++++++++1 file changed, 8 insertions(+)arch/powerpc/perf/hv-24x7.c +8
-0@@ -894,6 +894,11 @@ static int create_events_from_catalog(struct attribute ***events_, name = event_name(event, &nl); + if (strstr(name, "FREE_")) { + pr_info("invalid event %zu (%.*s)\n", event_idx, nl, 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 +960,9 @@ static int create_events_from_catalog(struct attribute ***events_, continue; name = event_name(event, &nl); + if (strstr(name, "FREE_")) + continue; + nonce = event_uniq_add(&ev_uniq, name, nl, event->domain); ct = event_data_to_attrs(event_idx, events + event_attr_ct, event, nonce);
Michael Ellerman
reviewerQuoted 17 lines · Kajol Jain
hv_24x7performance monitoring unit creates list of supported events from the event catalog obtained via HCALL.hv_24x7catalog could also contain invalid or dummy events (with names likeFREE_orCPM_FREE_so on). These events does not have any hardware counters backing them. So patch adds a check to string compare the event names to filter out them.Signed-off-by Kajol Jain <[email protected]>--- arch/powerpc/perf/hv-24x7.c | 8 ++++++++ 1 file changed, 8 insertions(+)arch/powerpc/perf/hv-24x7.c +0
-0
arch/powerpc/perf/hv-24x7.c static int create_events_from_catalog(struct attribute ***events_, · line 900
Quoted 7 lines
arch/powerpc/perf/hv-24x7.c +4
-0@@ -894,6 +894,11 @@ static int create_events_from_catalog(struct attribute ***events_, name =event_name (event, &nl); +if (strstr (name,"FREE_" )) { +pr_info ("invalid event %zu (%.*s)\n" , event_idx, nl, name); + junk_events++; +continue ;
I don't think we want a print for each event, just one at the end saying "Dropped %d invalid events" would be preferable I think.
arch/powerpc/perf/hv-24x7.c static int create_events_from_catalog(struct attribute ***events_, · line 964
Quoted 10 lines
arch/powerpc/perf/hv-24x7.c +3
-0+ }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 +960,9 @@ static int create_events_from_catalog(struct attribute ***events_,continue ; name =event_name (event, &nl); +if (strstr (name,"FREE_" )) +continue ;
Would be nice if the string comparison was in a single place, ie. in a helper function.
cheers
Quoted 21 lines · Michael Ellerman
Quoted 20 lines · Kajol Jain
hv_24x7performance monitoring unit creates list of supported events from the event catalog obtained via HCALL.hv_24x7catalog could also contain invalid or dummy events (with names likeFREE_orCPM_FREE_so on). These events does not have any hardware counters backing them. So patch adds a check to string compare the event names to filter out them.Signed-off-by Kajol Jain <[email protected]>--- arch/powerpc/perf/hv-24x7.c | 8 ++++++++ 1 file changed, 8 insertions(+)arch/powerpc/perf/hv-24x7.c +0
-0@@ -894,6 +894,11 @@ static int create_events_from_catalog(struct attribute ***events_, name =event_name (event, &nl);
Quoted 7 lines
arch/powerpc/perf/hv-24x7.c static int create_events_from_catalog(struct attribute ***events_, · line 900
Quoted 4 lines
arch/powerpc/perf/hv-24x7.c +4
-0+if (strstr (name,"FREE_" )) { +pr_info ("invalid event %zu (%.*s)\n" , event_idx, nl, name); + junk_events++; +continue ;I don't think we want a print for each event, just one at the end saying "Dropped %d invalid events" would be preferable I think.
Hi Michael,
Sure I will remove prints for each event. Having one print for number of dropped
events may not be useful. So I will drop that too.
Quoted 9 lines
Quoted 9 lines
arch/powerpc/perf/hv-24x7.c +1
-0+ }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 +960,9 @@ static int create_events_from_catalog(struct attribute ***events_,continue ;
Quoted 6 lines
arch/powerpc/perf/hv-24x7.c static int create_events_from_catalog(struct attribute ***events_, · line 964
Quoted 3 lines
arch/powerpc/perf/hv-24x7.c +2
-0name =event_name (event, &nl); +if (strstr (name,"FREE_" )) +continue ;Would be nice if the string comparison was in a single place, ie. in a helper function.
Sure I will make that change.
Thanks,
Kajol Jain
Quoted 3 lines
cheers