linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Petlan <mpetlan@redhat.com>
To: linux-perf-users@vger.kernel.org, acme@redhat.com, ravi.bangoria@amd.com
Cc: peterz@infradead.org, namhyung@kernel.org, sandipan.das@amd.com
Subject: [PATCH] perf/x86/amd/core: Rename branch-brs event to not break the parser
Date: Tue, 12 Sep 2023 15:33:18 +0200	[thread overview]
Message-ID: <20230912133318.18103-1-mpetlan@redhat.com> (raw)

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.

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
---
 arch/x86/events/amd/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index abadd5f23425..f4c5d4100035 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -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


             reply	other threads:[~2023-09-12 13:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 13:33 Michael Petlan [this message]
2023-09-12 17:53 ` [PATCH] perf/x86/amd/core: Rename branch-brs event to not break the parser Ian Rogers
2023-09-14  9:36   ` Michael Petlan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230912133318.18103-1-mpetlan@redhat.com \
    --to=mpetlan@redhat.com \
    --cc=acme@redhat.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@amd.com \
    --cc=sandipan.das@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).