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] [thread-next>] [day] [month] [year] [list]
Message-ID: <e6973788-625c-4be3-8bbe-3d8fcb1256c9@arm.com>
Date: Mon, 22 Jul 2024 22:11:33 +0100
From: Leo Yan <leo.yan@....com>
To: Ian Rogers <irogers@...gle.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
 Namhyung Kim <namhyung@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>,
 James Clark <james.clark@...aro.org>,
 Suzuki K Poulose <suzuki.poulose@....com>, Mike Leach
 <mike.leach@...aro.org>, John Garry <john.g.garry@...cle.com>,
 Will Deacon <will@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
 Mark Rutland <mark.rutland@....com>, coresight@...ts.linaro.org,
 linux-arm-kernel@...ts.infradead.org, linux-perf-users@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/6] perf pmu: Directly use evsel's PMU pointer

On 7/22/2024 5:16 PM, Ian Rogers wrote:
> On Sun, Jul 21, 2024 at 1:21 PM Leo Yan <leo.yan@....com> wrote:
>>
>> Rather than iterating the whole PMU list for finding the associated PMU
>> device for an evsel, this commit optimizes to directly use evsel's 'pmu'
>> pointer for accessing PMU device.
> 
> The code doesn't do that:
> ```
> struct perf_pmu *evsel__find_pmu(const struct evsel *evsel)
> {
>        struct perf_pmu *pmu = evsel->pmu;
> 
>        if (!pmu) {
>                pmu = perf_pmus__find_by_type(evsel->core.attr.type);
>                ((struct evsel *)evsel)->pmu = pmu;
>        }
>        return pmu;
> }
> ```
> That is, if the evsel->pmu is not NULL then just return it, otherwise
> find the pmu using the type from the attribute. Any linear such should
> happen at most once unless the pmu is NULL from event parsing or
> perf_pmus__find_by_type.

So evsel__find_pmu() is good enough.

> The PMU may be NULL for legacy events and if
> sysfs isn't mounted. If you are encountering that then maybe we need a
> flag to say don't find the PMU for this evsel as it is known NULL.

I don't see a case of the PMU pointer is NULL. So don't need this flag.

My bad for misreading the code :\  Thanks a lot for pointing out.

Leo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ