mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] perf pmu: Recognize default_core as a core PMU in more places
@ 2026-06-12  1:24 Ian Rogers
  2026-06-22  9:11 ` Qinxin Xia
  2026-07-01 17:43 ` Namhyung Kim
  0 siblings, 2 replies; 6+ messages in thread
From: Ian Rogers @ 2026-06-12  1:24 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Jiri Olsa, Ian Rogers, Adrian Hunter, James Clark,
	Dapeng Mi, Athira Rajeev, Thomas Falcon, Qinxin Xia,
	linux-perf-users, linux-kernel

The python metrics code used in places like ilist.py passes a
pmu-filter of "default_core" on non-hybrid x86/ARM/.. systems. As a
PMU like "cpu" isn't a literal name match then no PMU matches
"default_core" and the events fail to parse for the metric. Fix the
name matching and PMU lookup for "default_core" and check that it
fixes ilist.py.

Fixes: 74e2dbe7be50 ("perf tools: Add --pmu-filter option for filtering PMUs")
Signed-off-by: Ian Rogers <irogers@google.com>
---
Note: this bug is in 7.1 but it is a little too late to send for the
      release. It should get picked up via the fixes tag.
---
 tools/perf/util/pmu.c  | 6 +++++-
 tools/perf/util/pmus.c | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index a550f030b85d..836e3b5615cd 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -2660,8 +2660,12 @@ bool perf_pmu__wildcard_match(const struct perf_pmu *pmu, const char *wildcard_t
 		pmu->name,
 		pmu->alias_name,
 	};
-	bool need_fnmatch = strisglob(wildcard_to_match);
+	bool need_fnmatch;
 
+	if (pmu->is_core && !strcmp(wildcard_to_match, "default_core"))
+		return true;
+
+	need_fnmatch = strisglob(wildcard_to_match);
 	if (!strncmp(wildcard_to_match, "uncore_", 7))
 		wildcard_to_match += 7;
 
diff --git a/tools/perf/util/pmus.c b/tools/perf/util/pmus.c
index 5e3f571450fe..e0a4cb2428ca 100644
--- a/tools/perf/util/pmus.c
+++ b/tools/perf/util/pmus.c
@@ -150,6 +150,8 @@ struct perf_pmu *perf_pmus__find(const char *name)
 	bool core_pmu;
 	unsigned int to_read_pmus = 0;
 
+	if (!strcmp(name, "default_core"))
+		return perf_pmus__find_core_pmu();
 	/*
 	 * Once PMU is loaded it stays in the list,
 	 * so we keep us from multiple reading/parsing
-- 
2.54.0.1136.gdb2ca164c4-goog


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] perf pmu: Recognize default_core as a core PMU in more places
  2026-06-12  1:24 [PATCH v1] perf pmu: Recognize default_core as a core PMU in more places Ian Rogers
@ 2026-06-22  9:11 ` Qinxin Xia
  2026-06-22 17:53   ` Ian Rogers
  2026-07-01 17:43 ` Namhyung Kim
  1 sibling, 1 reply; 6+ messages in thread
From: Qinxin Xia @ 2026-06-22  9:11 UTC (permalink / raw)
  To: Ian Rogers, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Adrian Hunter,
	James Clark, Dapeng Mi, Athira Rajeev, Thomas Falcon,
	linux-perf-users, linux-kernel



On 2026/6/12 09:24:13, Ian Rogers <irogers@google.com> wrote:
> The python metrics code used in places like ilist.py passes a
> pmu-filter of "default_core" on non-hybrid x86/ARM/.. systems. As a
> PMU like "cpu" isn't a literal name match then no PMU matches
> "default_core" and the events fail to parse for the metric. Fix the
> name matching and PMU lookup for "default_core" and check that it
> fixes ilist.py.
> 
> Fixes: 74e2dbe7be50 ("perf tools: Add --pmu-filter option for filtering PMUs")
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> Note: this bug is in 7.1 but it is a little too late to send for the
>        release. It should get picked up via the fixes tag.
> ---
>   tools/perf/util/pmu.c  | 6 +++++-
>   tools/perf/util/pmus.c | 2 ++
>   2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index a550f030b85d..836e3b5615cd 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -2660,8 +2660,12 @@ bool perf_pmu__wildcard_match(const struct perf_pmu *pmu, const char *wildcard_t
>   		pmu->name,
>   		pmu->alias_name,
>   	};
> -	bool need_fnmatch = strisglob(wildcard_to_match);
> +	bool need_fnmatch;
>   
> +	if (pmu->is_core && !strcmp(wildcard_to_match, "default_core"))
> +		return true;
> +
> +	need_fnmatch = strisglob(wildcard_to_match);
>   	if (!strncmp(wildcard_to_match, "uncore_", 7))
>   		wildcard_to_match += 7;
>   
> diff --git a/tools/perf/util/pmus.c b/tools/perf/util/pmus.c
> index 5e3f571450fe..e0a4cb2428ca 100644
> --- a/tools/perf/util/pmus.c
> +++ b/tools/perf/util/pmus.c
> @@ -150,6 +150,8 @@ struct perf_pmu *perf_pmus__find(const char *name)
>   	bool core_pmu;
>   	unsigned int to_read_pmus = 0;
>   
> +	if (!strcmp(name, "default_core"))
> +		return perf_pmus__find_core_pmu();
>   	/*
>   	 * Once PMU is loaded it stays in the list,
>   	 * so we keep us from multiple reading/parsing

Thank you for the fix, Ian.
In the previous patch, I overlooked the handling of the "default_core"
alias. Also, perhaps we can leave need_fnmatch as-is, since it doesn't
seem to affect anything here.

-- 
Thanks,
Qinxin


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] perf pmu: Recognize default_core as a core PMU in more places
  2026-06-22  9:11 ` Qinxin Xia
@ 2026-06-22 17:53   ` Ian Rogers
  2026-06-23  6:22     ` Qinxin Xia
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Rogers @ 2026-06-22 17:53 UTC (permalink / raw)
  To: Qinxin Xia
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Jiri Olsa, Adrian Hunter, James Clark, Dapeng Mi,
	Athira Rajeev, Thomas Falcon, linux-perf-users, linux-kernel

On Mon, Jun 22, 2026 at 2:11 AM Qinxin Xia <xiaqinxin@huawei.com> wrote:
>
>
>
> On 2026/6/12 09:24:13, Ian Rogers <irogers@google.com> wrote:
> > The python metrics code used in places like ilist.py passes a
> > pmu-filter of "default_core" on non-hybrid x86/ARM/.. systems. As a
> > PMU like "cpu" isn't a literal name match then no PMU matches
> > "default_core" and the events fail to parse for the metric. Fix the
> > name matching and PMU lookup for "default_core" and check that it
> > fixes ilist.py.
> >
> > Fixes: 74e2dbe7be50 ("perf tools: Add --pmu-filter option for filtering PMUs")
> > Signed-off-by: Ian Rogers <irogers@google.com>
> > ---
> > Note: this bug is in 7.1 but it is a little too late to send for the
> >        release. It should get picked up via the fixes tag.
> > ---
> >   tools/perf/util/pmu.c  | 6 +++++-
> >   tools/perf/util/pmus.c | 2 ++
> >   2 files changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> > index a550f030b85d..836e3b5615cd 100644
> > --- a/tools/perf/util/pmu.c
> > +++ b/tools/perf/util/pmu.c
> > @@ -2660,8 +2660,12 @@ bool perf_pmu__wildcard_match(const struct perf_pmu *pmu, const char *wildcard_t
> >               pmu->name,
> >               pmu->alias_name,
> >       };
> > -     bool need_fnmatch = strisglob(wildcard_to_match);
> > +     bool need_fnmatch;
> >
> > +     if (pmu->is_core && !strcmp(wildcard_to_match, "default_core"))
> > +             return true;
> > +
> > +     need_fnmatch = strisglob(wildcard_to_match);
> >       if (!strncmp(wildcard_to_match, "uncore_", 7))
> >               wildcard_to_match += 7;
> >
> > diff --git a/tools/perf/util/pmus.c b/tools/perf/util/pmus.c
> > index 5e3f571450fe..e0a4cb2428ca 100644
> > --- a/tools/perf/util/pmus.c
> > +++ b/tools/perf/util/pmus.c
> > @@ -150,6 +150,8 @@ struct perf_pmu *perf_pmus__find(const char *name)
> >       bool core_pmu;
> >       unsigned int to_read_pmus = 0;
> >
> > +     if (!strcmp(name, "default_core"))
> > +             return perf_pmus__find_core_pmu();
> >       /*
> >        * Once PMU is loaded it stays in the list,
> >        * so we keep us from multiple reading/parsing
>
> Thank you for the fix, Ian.
> In the previous patch, I overlooked the handling of the "default_core"
> alias. Also, perhaps we can leave need_fnmatch as-is, since it doesn't
> seem to affect anything here.

Thanks. I moved need_fnmatch's initialization just to save some work
in the "default_core" case where the value is unused. While leaving it
in place would reduce the diff, I think the optimization is worth it
as we would otherwise call strisglob when say iterating all metrics.

Would it be okay to supply a Reviewed-by tag? I notice this fix is
missing from perf-tools-next.

Thanks!
Ian

> --
> Thanks,
> Qinxin
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] perf pmu: Recognize default_core as a core PMU in more places
  2026-06-22 17:53   ` Ian Rogers
@ 2026-06-23  6:22     ` Qinxin Xia
  2026-06-27  1:49       ` Ian Rogers
  0 siblings, 1 reply; 6+ messages in thread
From: Qinxin Xia @ 2026-06-23  6:22 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Jiri Olsa, Adrian Hunter, James Clark, Dapeng Mi,
	Athira Rajeev, Thomas Falcon, linux-perf-users, linux-kernel



On 2026/6/23 01:53:52, Ian Rogers <irogers@google.com> wrote:
> On Mon, Jun 22, 2026 at 2:11 AM Qinxin Xia<xiaqinxin@huawei.com> wrote:
>>
>>
>> On 2026/6/12 09:24:13, Ian Rogers<irogers@google.com> wrote:
>>> The python metrics code used in places like ilist.py passes a
>>> pmu-filter of "default_core" on non-hybrid x86/ARM/.. systems. As a
>>> PMU like "cpu" isn't a literal name match then no PMU matches
>>> "default_core" and the events fail to parse for the metric. Fix the
>>> name matching and PMU lookup for "default_core" and check that it
>>> fixes ilist.py.
>>>
>>> Fixes: 74e2dbe7be50 ("perf tools: Add --pmu-filter option for filtering PMUs")
>>> Signed-off-by: Ian Rogers<irogers@google.com>
>>> ---
>>> Note: this bug is in 7.1 but it is a little too late to send for the
>>>         release. It should get picked up via the fixes tag.
>>> ---
>>>    tools/perf/util/pmu.c  | 6 +++++-
>>>    tools/perf/util/pmus.c | 2 ++
>>>    2 files changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
>>> index a550f030b85d..836e3b5615cd 100644
>>> --- a/tools/perf/util/pmu.c
>>> +++ b/tools/perf/util/pmu.c
>>> @@ -2660,8 +2660,12 @@ bool perf_pmu__wildcard_match(const struct perf_pmu *pmu, const char *wildcard_t
>>>                pmu->name,
>>>                pmu->alias_name,
>>>        };
>>> -     bool need_fnmatch = strisglob(wildcard_to_match);
>>> +     bool need_fnmatch;
>>>
>>> +     if (pmu->is_core && !strcmp(wildcard_to_match, "default_core"))
>>> +             return true;
>>> +
>>> +     need_fnmatch = strisglob(wildcard_to_match);
>>>        if (!strncmp(wildcard_to_match, "uncore_", 7))
>>>                wildcard_to_match += 7;
>>>
>>> diff --git a/tools/perf/util/pmus.c b/tools/perf/util/pmus.c
>>> index 5e3f571450fe..e0a4cb2428ca 100644
>>> --- a/tools/perf/util/pmus.c
>>> +++ b/tools/perf/util/pmus.c
>>> @@ -150,6 +150,8 @@ struct perf_pmu *perf_pmus__find(const char *name)
>>>        bool core_pmu;
>>>        unsigned int to_read_pmus = 0;
>>>
>>> +     if (!strcmp(name, "default_core"))
>>> +             return perf_pmus__find_core_pmu();
>>>        /*
>>>         * Once PMU is loaded it stays in the list,
>>>         * so we keep us from multiple reading/parsing
>> Thank you for the fix, Ian.
>> In the previous patch, I overlooked the handling of the "default_core"
>> alias. Also, perhaps we can leave need_fnmatch as-is, since it doesn't
>> seem to affect anything here.
> Thanks. I moved need_fnmatch's initialization just to save some work
> in the "default_core" case where the value is unused. While leaving it
> in place would reduce the diff, I think the optimization is worth it
> as we would otherwise call strisglob when say iterating all metrics.
> 
Perhaps we can do it this way:
	if (pmu->is_core && !strcmp(wildcard_to_match, "default_core"))
              	return true;

	bool need_fnmatch = strisglob(wildcard_to_match);
> Would it be okay to supply a Reviewed-by tag? I notice this fix is
> missing from perf-tools-next.
> 
Sure, add my Reviewed‑by.:-)

> Thanks!
> Ian
> 
>> --
>> Thanks,
>> Qinxin

-- 
Thanks,
Qinxin


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] perf pmu: Recognize default_core as a core PMU in more places
  2026-06-23  6:22     ` Qinxin Xia
@ 2026-06-27  1:49       ` Ian Rogers
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Rogers @ 2026-06-27  1:49 UTC (permalink / raw)
  To: Qinxin Xia
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Jiri Olsa, Adrian Hunter, James Clark, Dapeng Mi,
	Athira Rajeev, Thomas Falcon, linux-perf-users, linux-kernel

On Mon, Jun 22, 2026 at 11:22 PM Qinxin Xia <xiaqinxin@huawei.com> wrote:
>
>
>
> On 2026/6/23 01:53:52, Ian Rogers <irogers@google.com> wrote:
> > On Mon, Jun 22, 2026 at 2:11 AM Qinxin Xia<xiaqinxin@huawei.com> wrote:
> >>
> >>
> >> On 2026/6/12 09:24:13, Ian Rogers<irogers@google.com> wrote:
> >>> The python metrics code used in places like ilist.py passes a
> >>> pmu-filter of "default_core" on non-hybrid x86/ARM/.. systems. As a
> >>> PMU like "cpu" isn't a literal name match then no PMU matches
> >>> "default_core" and the events fail to parse for the metric. Fix the
> >>> name matching and PMU lookup for "default_core" and check that it
> >>> fixes ilist.py.
> >>>
> >>> Fixes: 74e2dbe7be50 ("perf tools: Add --pmu-filter option for filtering PMUs")
> >>> Signed-off-by: Ian Rogers<irogers@google.com>
> >>> ---
> >>> Note: this bug is in 7.1 but it is a little too late to send for the
> >>>         release. It should get picked up via the fixes tag.
> >>> ---
> >>>    tools/perf/util/pmu.c  | 6 +++++-
> >>>    tools/perf/util/pmus.c | 2 ++
> >>>    2 files changed, 7 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> >>> index a550f030b85d..836e3b5615cd 100644
> >>> --- a/tools/perf/util/pmu.c
> >>> +++ b/tools/perf/util/pmu.c
> >>> @@ -2660,8 +2660,12 @@ bool perf_pmu__wildcard_match(const struct perf_pmu *pmu, const char *wildcard_t
> >>>                pmu->name,
> >>>                pmu->alias_name,
> >>>        };
> >>> -     bool need_fnmatch = strisglob(wildcard_to_match);
> >>> +     bool need_fnmatch;
> >>>
> >>> +     if (pmu->is_core && !strcmp(wildcard_to_match, "default_core"))
> >>> +             return true;
> >>> +
> >>> +     need_fnmatch = strisglob(wildcard_to_match);
> >>>        if (!strncmp(wildcard_to_match, "uncore_", 7))
> >>>                wildcard_to_match += 7;
> >>>
> >>> diff --git a/tools/perf/util/pmus.c b/tools/perf/util/pmus.c
> >>> index 5e3f571450fe..e0a4cb2428ca 100644
> >>> --- a/tools/perf/util/pmus.c
> >>> +++ b/tools/perf/util/pmus.c
> >>> @@ -150,6 +150,8 @@ struct perf_pmu *perf_pmus__find(const char *name)
> >>>        bool core_pmu;
> >>>        unsigned int to_read_pmus = 0;
> >>>
> >>> +     if (!strcmp(name, "default_core"))
> >>> +             return perf_pmus__find_core_pmu();
> >>>        /*
> >>>         * Once PMU is loaded it stays in the list,
> >>>         * so we keep us from multiple reading/parsing
> >> Thank you for the fix, Ian.
> >> In the previous patch, I overlooked the handling of the "default_core"
> >> alias. Also, perhaps we can leave need_fnmatch as-is, since it doesn't
> >> seem to affect anything here.
> > Thanks. I moved need_fnmatch's initialization just to save some work
> > in the "default_core" case where the value is unused. While leaving it
> > in place would reduce the diff, I think the optimization is worth it
> > as we would otherwise call strisglob when say iterating all metrics.
> >
> Perhaps we can do it this way:
>         if (pmu->is_core && !strcmp(wildcard_to_match, "default_core"))
>                 return true;
>
>         bool need_fnmatch = strisglob(wildcard_to_match);

Unfortunately we require variables to be declared at the top of
blocks/functions.

> > Would it be okay to supply a Reviewed-by tag? I notice this fix is
> > missing from perf-tools-next.
> >
> Sure, add my Reviewed‑by.:-)

Thanks,
Ian

>
> > Thanks!
> > Ian
> >
> >> --
> >> Thanks,
> >> Qinxin
>
> --
> Thanks,
> Qinxin
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] perf pmu: Recognize default_core as a core PMU in more places
  2026-06-12  1:24 [PATCH v1] perf pmu: Recognize default_core as a core PMU in more places Ian Rogers
  2026-06-22  9:11 ` Qinxin Xia
@ 2026-07-01 17:43 ` Namhyung Kim
  1 sibling, 0 replies; 6+ messages in thread
From: Namhyung Kim @ 2026-07-01 17:43 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Jiri Olsa,
	Adrian Hunter, James Clark, Dapeng Mi, Athira Rajeev,
	Thomas Falcon, Qinxin Xia, linux-perf-users, linux-kernel,
	Ian Rogers

On Thu, 11 Jun 2026 18:24:13 -0700, Ian Rogers wrote:
> The python metrics code used in places like ilist.py passes a
> pmu-filter of "default_core" on non-hybrid x86/ARM/.. systems. As a
> PMU like "cpu" isn't a literal name match then no PMU matches
> "default_core" and the events fail to parse for the metric. Fix the
> name matching and PMU lookup for "default_core" and check that it
> fixes ilist.py.
> 
> [...]
Applied to perf-tools-next, thanks!

Best regards,
Namhyung



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-01 17:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-12  1:24 [PATCH v1] perf pmu: Recognize default_core as a core PMU in more places Ian Rogers
2026-06-22  9:11 ` Qinxin Xia
2026-06-22 17:53   ` Ian Rogers
2026-06-23  6:22     ` Qinxin Xia
2026-06-27  1:49       ` Ian Rogers
2026-07-01 17:43 ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox