From: Namhyung Kim <namhyung@kernel.org>
To: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: acme@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com,
mpetlan@redhat.com, tmricht@linux.ibm.com, maddy@linux.ibm.com,
irogers@google.com, linux-perf-users@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, hbathini@linux.vnet.ibm.com,
Tejas.Manhas1@ibm.com, Tanushree.Shah@ibm.com,
shivani@linux.ibm.com
Subject: Re: [PATCH V4 1/2] tools/perf: Fix the check for parameterized field in event term
Date: Thu, 4 Jun 2026 14:52:27 -0700 [thread overview]
Message-ID: <aiHzm5SJskW1FbSs@google.com> (raw)
In-Reply-To: <20260504154205.21394-1-atrajeev@linux.ibm.com>
On Mon, May 04, 2026 at 09:12:04PM +0530, Athira Rajeev wrote:
> The format_alias() function in util/pmu.c has a check to
> detect whether the event has parameterized field ( =? ).
> The string alias->terms contains the event and if the event
> has user configurable parameter, there will be presence of
> sub string "=?" in the alias->terms.
>
> Snippet of code:
>
> /* Paramemterized events have the parameters shown. */
> if (strstr(alias->terms, "=?")) {
> /* No parameters. */
> snprintf(buf, len, "%.*s/%s/", (int)pmu_name_len, pmu->name, alias->name);
>
> if "strstr" contains the substring, it returns a pointer
> and hence enters the above check which is not the expected
> check. And hence "perf list" doesn't have the parameterized
> fields in the result.
>
> Fix this check to use:
>
> if (!strstr(alias->terms, "=?")) {
>
> With this change, perf list shows the events correctly with
> the strings showing parameters.
>
> Before the fix:
>
> # ./perf list|grep -w PM_PAU_CYC
> hv_24x7/PM_PAU_CYC/ [Kernel PMU event]
>
> With this fix:
>
> # ./perf list|grep -w PM_PAU_CYC
> hv_24x7/PM_PAU_CYC,chip=?/ [Kernel PMU event]
>
> Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
> ---
> Changelog:
> v3 -> v4:
> Updated commit message to show real example
> addressing review comment from Namhyung.
>
> v2 -> v3:
> Split the strstr correction in a single patch
>
> tools/perf/util/pmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 23337d2fa281..0b8d58543f17 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -2117,7 +2117,7 @@ static char *format_alias(char *buf, int len, const struct perf_pmu *pmu,
> skip_duplicate_pmus);
>
> /* Paramemterized events have the parameters shown. */
> - if (strstr(alias->terms, "=?")) {
> + if (!strstr(alias->terms, "=?")) {
> /* No parameters. */
> snprintf(buf, len, "%.*s/%s/", (int)pmu_name_len, pmu->name, alias->name);
> return buf;
> --
> 2.47.3
>
prev parent reply other threads:[~2026-06-04 21:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-04 15:42 [PATCH V4 1/2] tools/perf: Fix the check for parameterized field in event term Athira Rajeev
2026-05-04 15:42 ` [PATCH V4 2/2] tools/perf: Use scnprintf in buffer offset calculations Athira Rajeev
2026-05-13 1:02 ` Ian Rogers
2026-06-04 22:02 ` Namhyung Kim
2026-05-12 8:52 ` [PATCH V4 1/2] tools/perf: Fix the check for parameterized field in event term Venkat
2026-05-13 0:57 ` Ian Rogers
2026-05-21 6:37 ` Athira Rajeev
2026-06-04 15:12 ` Athira Rajeev
2026-06-04 21:52 ` Namhyung Kim [this message]
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=aiHzm5SJskW1FbSs@google.com \
--to=namhyung@kernel.org \
--cc=Tanushree.Shah@ibm.com \
--cc=Tejas.Manhas1@ibm.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=atrajeev@linux.ibm.com \
--cc=hbathini@linux.vnet.ibm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpetlan@redhat.com \
--cc=shivani@linux.ibm.com \
--cc=tmricht@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.