> On 21 May 2026, at 12:07 PM, Athira Rajeev <[email protected]> wrote:
>
>
>
>> On 4 May 2026, at 9:12 PM, Athira Rajeev <[email protected]> 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 <[email protected]>
>
> Hi,
>
> Can we please have this pulled in, if the changes looks fine.
>
> Thanks
> Athira
Hi,
Looking for any further review comments on this patchset. Please suggest if any
changes needs to be addressed.
Thanks
Athira
>> ---
>> 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