lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAP-5=fVK6w3Ck_F0gEPrSt6-UuAVUruLmnutJa=LbMO+MxazNg@mail.gmail.com>
Date: Wed, 26 Jun 2024 10:54:07 -0700
From: Ian Rogers <irogers@...gle.com>
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, 
	Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>, 
	Mark Rutland <mark.rutland@....com>, 
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, 
	Kan Liang <kan.liang@...ux.intel.com>, John Garry <john.g.garry@...cle.com>, 
	Will Deacon <will@...nel.org>, James Clark <james.clark@....com>, 
	Mike Leach <mike.leach@...aro.org>, Leo Yan <leo.yan@...ux.dev>, 
	Suzuki K Poulose <suzuki.poulose@....com>, Yicong Yang <yangyicong@...ilicon.com>, 
	Jonathan Cameron <jonathan.cameron@...wei.com>, Nick Terrell <terrelln@...com>, 
	Nick Desaulniers <ndesaulniers@...gle.com>, Oliver Upton <oliver.upton@...ux.dev>, 
	Anshuman Khandual <anshuman.khandual@....com>, Song Liu <song@...nel.org>, 
	Ilkka Koskinen <ilkka@...amperecomputing.com>, Huacai Chen <chenhuacai@...nel.org>, 
	Yanteng Si <siyanteng@...ngson.cn>, Sun Haiyong <sunhaiyong@...ngson.cn>, 
	linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org, 
	linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v1 22/26] perf auxevent: Add explicit dummy tool initialization

On Tue, Jun 25, 2024 at 11:59 PM Adrian Hunter <adrian.hunter@...el.com> wrote:
>
> On 25/06/24 20:25, Ian Rogers wrote:
> > Ensure tool is initialized to avoid lazy initialization pattern so
> > that more uses of struct perf_tool can be made const.
>
> This does not look necessary.
>
> The dummy tool is not used, and is not subject to lazy initialization,
> so the existing initialization to zero is fine.

Thanks, I wonder if we should try to save space in this case with
something like:

```
struct intel_pt_synth {
  struct perf_session *session;
  struct perf_tool dummy_tool[0];
};
```

I'll play around while dropping the initialization calls.

Thanks,
Ian

> >
> > Signed-off-by: Ian Rogers <irogers@...gle.com>
> > ---
> >  tools/perf/util/arm-spe.c     | 1 +
> >  tools/perf/util/cs-etm.c      | 1 +
> >  tools/perf/util/intel-bts.c   | 1 +
> >  tools/perf/util/intel-pt.c    | 2 +-
> >  tools/perf/util/s390-cpumsf.c | 1 -
> >  5 files changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
> > index 70bad18c4a0d..06a198b2f483 100644
> > --- a/tools/perf/util/arm-spe.c
> > +++ b/tools/perf/util/arm-spe.c
> > @@ -1097,6 +1097,7 @@ static int arm_spe_synth_event(struct perf_session *session,
> >
> >       memset(&arm_spe_synth, 0, sizeof(struct arm_spe_synth));
> >       arm_spe_synth.session = session;
> > +     perf_tool__init(&arm_spe_synth.dummy_tool, /*ordered_events=*/false);
> >
> >       return perf_event__synthesize_attr(&arm_spe_synth.dummy_tool, attr, 1,
> >                                          &id, arm_spe_event_synth);
> > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> > index 231cd833c012..02eb5b3eed14 100644
> > --- a/tools/perf/util/cs-etm.c
> > +++ b/tools/perf/util/cs-etm.c
> > @@ -1619,6 +1619,7 @@ static int cs_etm__synth_event(struct perf_session *session,
> >
> >       memset(&cs_etm_synth, 0, sizeof(struct cs_etm_synth));
> >       cs_etm_synth.session = session;
> > +     perf_tool__init(&cs_etm_synth.dummy_tool, /*ordered_events=*/false);
> >
> >       return perf_event__synthesize_attr(&cs_etm_synth.dummy_tool, attr, 1,
> >                                          &id, cs_etm__event_synth);
> > diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
> > index 779982c478e0..ae97109542be 100644
> > --- a/tools/perf/util/intel-bts.c
> > +++ b/tools/perf/util/intel-bts.c
> > @@ -761,6 +761,7 @@ static int intel_bts_synth_event(struct perf_session *session,
> >
> >       memset(&intel_bts_synth, 0, sizeof(struct intel_bts_synth));
> >       intel_bts_synth.session = session;
> > +     perf_tool__init(&intel_bts_synth.dummy_tool, /*ordered_events=*/false);
> >
> >       return perf_event__synthesize_attr(&intel_bts_synth.dummy_tool, attr, 1,
> >                                          &id, intel_bts_event_synth);
> > diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
> > index bed35029e1f6..48ed60e521ed 100644
> > --- a/tools/perf/util/intel-pt.c
> > +++ b/tools/perf/util/intel-pt.c
> > @@ -3687,7 +3687,7 @@ static int intel_pt_synth_event(struct perf_session *session, const char *name,
> >
> >       memset(&intel_pt_synth, 0, sizeof(struct intel_pt_synth));
> >       intel_pt_synth.session = session;
> > -
> > +     perf_tool__init(&intel_pt_synth.dummy_tool, /*ordered_events=*/false);
> >       err = perf_event__synthesize_attr(&intel_pt_synth.dummy_tool, attr, 1,
> >                                         &id, intel_pt_event_synth);
> >       if (err)
> > diff --git a/tools/perf/util/s390-cpumsf.c b/tools/perf/util/s390-cpumsf.c
> > index 5834bad6ac0f..eb835e531cd6 100644
> > --- a/tools/perf/util/s390-cpumsf.c
> > +++ b/tools/perf/util/s390-cpumsf.c
> > @@ -953,7 +953,6 @@ s390_cpumsf_process_event(struct perf_session *session,
> >  }
> >
> >  struct s390_cpumsf_synth {
> > -     struct perf_tool cpumsf_tool;
> >       struct perf_session *session;
> >  };
> >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ