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=fWcKkdoP=i9zZMWtHWZ=XWWR_DLKVWEZ8vfxr11j9YADA@mail.gmail.com>
Date: Mon, 16 Jun 2025 09:30:53 -0700
From: Ian Rogers <irogers@...gle.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, 
	Namhyung Kim <namhyung@...nel.org>, Mark Rutland <mark.rutland@....com>, 
	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>, 
	Michael Petlan <mpetlan@...hat.com>, Andi Kleen <ak@...ux.intel.com>, 
	Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>, Tiezhu Yang <yangtiezhu@...ngson.cn>, 
	linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/4] perf evsel: Missed close when probing hybrid core PMUs

On Mon, Jun 16, 2025 at 9:24 AM Arnaldo Carvalho de Melo
<acme@...nel.org> wrote:
>
> On Mon, Jun 16, 2025 at 09:04:41AM -0700, Ian Rogers wrote:
> > On Fri, Jun 13, 2025 at 5:41 PM Ian Rogers <irogers@...gle.com> wrote:
> > > Add missing close to avoid leaking perf events. In past perfs this
> > > mattered little as the function was just used by perf list. As the
> > > function is now used to detect hybrid PMUs leaking the perf event is
> > > somewhat more painful.
>
> > Given this leads to leaking perf events on hybrid systems it would be
> > nice to land this 1 liner in the next v6.15 rc pull request fixes if
> > possible.
>
> Sure.
>
> Just one nit: while looking at:
>
> void evsel__close(struct evsel *evsel)
> {
>         if (evsel__is_retire_lat(evsel))
>                 evsel__tpebs_close(evsel);
>         perf_evsel__close(&evsel->core);
>         perf_evsel__free_id(&evsel->core);
> }
>
> And then:
>
> void evsel__delete(struct evsel *evsel)
> {
>         if (!evsel)
>                 return;
>
>         evsel__exit(evsel);
>         free(evsel);
> }
>
> and:
>
> void evsel__exit(struct evsel *evsel)
> {
>         assert(list_empty(&evsel->core.node));
>         assert(evsel->evlist == NULL);
>         if (evsel__is_retire_lat(evsel))
>                 evsel__tpebs_close(evsel);
> <SNIP>
>
> I think that tpebs_close could be done just at evsel__close(), no?
>
> The way it works I think there is no problem with calling it now twice,
> but it fits better in evsel__close().

Agreed. It'd be nice if we could assert that it was closed given this
has been a problem. Retirement latency events are pretty unusual so
I'm not overly worried about needing this :-)

Thanks,
Ian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ