perf/x86/amd/core: Rename branch-brs event to not break the parser
Subsystems (2)
PATCH 1/1 perf/x86/amd/core: Rename branch-brs event to not break the parser
The problem is described in detail in 146edff3d7ed ("perf test: Parse events workaround for dash/minus"). In short, although perf-list offers "branch-brs" event to be used, when used with "-e" switch, the parser does not accept it and needs to be enclosed to "cpu//", such as:
```
$ perf stat -e branch-brs true
event syntax error: 'branch-brs'
\___ parser error
$ perf stat -e cpu/branch-brs/ true
Performance counter stats for 'true':
46,179 cpu/branch-brs/
```This is confusing for the users.
Rename the event using underscore instead of dash to avoid the problem.
--- arch/x86/events/amd/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/amd/core.c +1 -1
@@ -1286,21 +1286,21 @@ amd_branches_is_visible(struct kobject *kobj, struct attribute *attr, int i) }static struct attribute_group group_caps_amd_branches = { .name ="caps" , .attrs = amd_pmu_branches_attrs, .is_visible = amd_branches_is_visible, };#ifdef CONFIG_PERF_EVENTS_AMD_BRS -EVENT_ATTR_STR (branch-brs, amd_branch_brs, +EVENT_ATTR_STR (branch_brs, amd_branch_brs, "event=" __stringify(AMD_FAM19H_BRS_EVENT)"\n");static struct attribute *amd_brs_events_attrs[] = {EVENT_PTR (amd_branch_brs),NULL , };static umode_t amd_brs_is_visible (struct kobject *kobj,struct attribute *attr,int i) {
Signature · 1 line
2.18.4
Ian Rogers
reviewerQuoted 18 lines · Michael Petlan
The problem is described in detail in
146edff3d7ed("perf test: Parse events workaround for dash/minus"). In short, although perf-list offers "branch-brs" event to be used, when used with "-e" switch, the parser does not accept it and needs to be enclosed to "cpu//", such as:``` $ perf stat -e branch-brs true event syntax error: 'branch-brs' \___ parser error $ perf stat -e cpu/branch-brs/ true Performance counter stats for 'true': 46,179 cpu/branch-brs/ ```
Quoted 5 lines
This is confusing for the users.
Rename the event using underscore instead of dash to avoid the problem.
Signed-off-by Michael Petlan <[email protected]>
I rewrote the event parsing and this was fixed in 70c90e4a6b2f ("perf
parse-events: Avoid scanning PMUs before parsing"):
https://lore.kernel.org/r/[email protected]
which was included in the perf tool in Linux 6.5.
Thanks,
Ian
Quoted 34 lines
--- arch/x86/events/amd/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/events/amd/core.c +1
-2@@ -1286,21 +1286,21 @@ amd_branches_is_visible(struct kobject *kobj, struct attribute *attr, int i) }static struct attribute_group group_caps_amd_branches = { .name ="caps" , .attrs = amd_pmu_branches_attrs, .is_visible = amd_branches_is_visible, };#ifdef CONFIG_PERF_EVENTS_AMD_BRS -EVENT_ATTR_STR (branch-brs, amd_branch_brs, +EVENT_ATTR_STR (branch_brs, amd_branch_brs, "event=" __stringify(AMD_FAM19H_BRS_EVENT)"\n");static struct attribute *amd_brs_events_attrs[] = {EVENT_PTR (amd_branch_brs),NULL , };static umode_t amd_brs_is_visible (struct kobject *kobj,struct attribute *attr,int i) { --2.18.4
Quoted 25 lines · Ian Rogers
Quoted 18 lines · Michael Petlan
The problem is described in detail in
146edff3d7ed("perf test: Parse events workaround for dash/minus"). In short, although perf-list offers "branch-brs" event to be used, when used with "-e" switch, the parser does not accept it and needs to be enclosed to "cpu//", such as:``` $ perf stat -e branch-brs true event syntax error: 'branch-brs' \___ parser error $ perf stat -e cpu/branch-brs/ true Performance counter stats for 'true': 46,179 cpu/branch-brs/ ```Quoted 5 lines
This is confusing for the users.
Rename the event using underscore instead of dash to avoid the problem.
Signed-off-by Michael Petlan <[email protected]>
Quoted 7 lines
I rewrote the event parsing and this was fixed in
70c90e4a6b2f("perf
parse-events: Avoid scanning PMUs before parsing"):
https://lore.kernel.org/r/[email protected]
which was included in the perf tool in Linux 6.5.Thanks,
Ian
OK, great to know, thanks!
Michael
Quoted 37 lines
Quoted 35 lines
--- arch/x86/events/amd/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/events/amd/core.c +1
-2@@ -1286,21 +1286,21 @@ amd_branches_is_visible(struct kobject *kobj, struct attribute *attr, int i) }static struct attribute_group group_caps_amd_branches = { .name ="caps" , .attrs = amd_pmu_branches_attrs, .is_visible = amd_branches_is_visible, };#ifdef CONFIG_PERF_EVENTS_AMD_BRS -EVENT_ATTR_STR (branch-brs, amd_branch_brs, +EVENT_ATTR_STR (branch_brs, amd_branch_brs, "event=" __stringify(AMD_FAM19H_BRS_EVENT)"\n");static struct attribute *amd_brs_events_attrs[] = {EVENT_PTR (amd_branch_brs),NULL , };static umode_t amd_brs_is_visible (struct kobject *kobj,struct attribute *attr,int i) { --2.18.4