[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAP-5=fU1pJ_7ewrxwCLUu_OkjZ2Z_bSzkaZxREG8uKnwop6JYw@mail.gmail.com>
Date: Thu, 30 Oct 2025 08:08:02 -0700
From: Ian Rogers <irogers@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, 
	Arnaldo Carvalho de Melo <acme@...nel.org>, Alexander Shishkin <alexander.shishkin@...ux.intel.com>, 
	Jiri Olsa <jolsa@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>, 
	Kan Liang <kan.liang@...ux.intel.com>, James Clark <james.clark@...aro.org>, 
	linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v1 1/2] perf pmu: Make pmu_alias_terms weak again
On Wed, Oct 29, 2025 at 10:47 PM Namhyung Kim <namhyung@...nel.org> wrote:
>
> Hi Ian,
>
> On Wed, Oct 29, 2025 at 03:26:37PM -0700, Ian Rogers wrote:
> > The terms for a json event should be weak so they don't override
> > command line options.
>
> Can you please give an example command line and the error?
Sure, it is also covered in the test.
Before:
```
$ perf record -vv -c 1000 -e uops_issued.any -o /dev/null true 2>&1
|grep "{ sample_period, sample_freq }"
 { sample_period, sample_freq }   200003
 { sample_period, sample_freq }   2000003
 { sample_period, sample_freq }   1000
```
After:
```
$ perf record -vv -c 1000 -e uops_issued.any -o /dev/null true 2>&1
|grep "{ sample_period, sample_freq }"
 { sample_period, sample_freq }   1000
 { sample_period, sample_freq }   1000
 { sample_period, sample_freq }   1000
```
Thanks,
Ian
> Thanks,
> Namhyung
>
> >
> > Fixes: 84bae3af20d0 ("perf pmu: Don't eagerly parse event terms")
> > Signed-off-by: Ian Rogers <irogers@...gle.com>
> > ---
> >  tools/perf/util/pmu.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> > index d597263fab4f..f14f2a12d061 100644
> > --- a/tools/perf/util/pmu.c
> > +++ b/tools/perf/util/pmu.c
> > @@ -802,6 +802,7 @@ static int pmu_aliases_parse_eager(struct perf_pmu *pmu, int sysfs_fd)
> >  static int pmu_alias_terms(struct perf_pmu_alias *alias, struct list_head *terms)
> >  {
> >       struct parse_events_terms alias_terms;
> > +     struct parse_events_term *term;
> >       int ret;
> >
> >       parse_events_terms__init(&alias_terms);
> > @@ -812,6 +813,13 @@ static int pmu_alias_terms(struct perf_pmu_alias *alias, struct list_head *terms
> >               parse_events_terms__exit(&alias_terms);
> >               return ret;
> >       }
> > +     list_for_each_entry(term, &alias_terms.terms, list) {
> > +             /*
> > +              * Weak terms don't override command line options,
> > +              * which we don't want for implicit terms in aliases.
> > +              */
> > +             term->weak = true;
> > +     }
> >       list_splice_init(&alias_terms.terms, terms);
> >       parse_events_terms__exit(&alias_terms);
> >       return 0;
> > --
> > 2.51.1.851.g4ebd6896fd-goog
> >
Powered by blists - more mailing lists
 
