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: <CAP-5=fV5zgPs_VayVhMq-pu7C1A_QeFvbq=jtC04GBS9T4yV2w@mail.gmail.com>
Date:   Sun, 21 May 2023 22:30:40 -0700
From:   Ian Rogers <irogers@...gle.com>
To:     "Liang, Kan" <kan.liang@...ux.intel.com>
Cc:     Suzuki K Poulose <suzuki.poulose@....com>,
        Mike Leach <mike.leach@...aro.org>,
        Leo Yan <leo.yan@...aro.org>,
        John Garry <john.g.garry@...cle.com>,
        Will Deacon <will@...nel.org>,
        James Clark <james.clark@....com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Kajol Jain <kjain@...ux.ibm.com>,
        Jing Zhang <renyu.zj@...ux.alibaba.com>,
        Ravi Bangoria <ravi.bangoria@....com>,
        Madhavan Srinivasan <maddy@...ux.ibm.com>,
        Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
        Ming Wang <wangming01@...ngson.cn>,
        Huacai Chen <chenhuacai@...nel.org>,
        Sandipan Das <sandipan.das@....com>,
        Dmitrii Dolgov <9erthalion6@...il.com>,
        Sean Christopherson <seanjc@...gle.com>,
        Ali Saidi <alisaidi@...zon.com>, Rob Herring <robh@...nel.org>,
        Thomas Richter <tmricht@...ux.ibm.com>,
        Kang Minchul <tegongkang@...il.com>,
        linux-kernel@...r.kernel.org, coresight@...ts.linaro.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v1 20/23] perf pmus: Split pmus list into core and uncore

On Sun, May 21, 2023 at 1:07 PM Liang, Kan <kan.liang@...ux.intel.com> wrote:
>
> On 2023-05-17 10:58 a.m., Ian Rogers wrote:
> > Split the pmus list into core and uncore. This will later allow for
> > the core and uncore pmus to be populated separately.
>
> I think the "uncore pmus" here means the other non-core PMUs, right? If
> so, I think the "uncore pmus" is misleading, since we have a dedicated
> uncore driver/PMU. Maybe we can use "other pmus" instead.
>
> Thanks,
> Kan

I'm okay with other PMUs. I'll change it in v2.

Thanks,
Ian

> >
> > Signed-off-by: Ian Rogers <irogers@...gle.com>
> > ---
> >  tools/perf/util/pmus.c | 52 ++++++++++++++++++++++++++++++------------
> >  1 file changed, 38 insertions(+), 14 deletions(-)
> >
> > diff --git a/tools/perf/util/pmus.c b/tools/perf/util/pmus.c
> > index 2fb28e583366..dd029a810147 100644
> > --- a/tools/perf/util/pmus.c
> > +++ b/tools/perf/util/pmus.c
> > @@ -12,13 +12,19 @@
> >  #include "pmu.h"
> >  #include "print-events.h"
> >
> > -static LIST_HEAD(pmus);
> > +static LIST_HEAD(core_pmus);
> > +static LIST_HEAD(uncore_pmus);
> >
> >  void perf_pmus__destroy(void)
> >  {
> >       struct perf_pmu *pmu, *tmp;
> >
> > -     list_for_each_entry_safe(pmu, tmp, &pmus, list) {
> > +     list_for_each_entry_safe(pmu, tmp, &core_pmus, list) {
> > +             list_del(&pmu->list);
> > +
> > +             perf_pmu__delete(pmu);
> > +     }
> > +     list_for_each_entry_safe(pmu, tmp, &uncore_pmus, list) {
> >               list_del(&pmu->list);
> >
> >               perf_pmu__delete(pmu);
> > @@ -29,7 +35,12 @@ static struct perf_pmu *pmu_find(const char *name)
> >  {
> >       struct perf_pmu *pmu;
> >
> > -     list_for_each_entry(pmu, &pmus, list) {
> > +     list_for_each_entry(pmu, &core_pmus, list) {
> > +             if (!strcmp(pmu->name, name) ||
> > +                 (pmu->alias_name && !strcmp(pmu->alias_name, name)))
> > +                     return pmu;
> > +     }
> > +     list_for_each_entry(pmu, &uncore_pmus, list) {
> >               if (!strcmp(pmu->name, name) ||
> >                   (pmu->alias_name && !strcmp(pmu->alias_name, name)))
> >                       return pmu;
> > @@ -53,7 +64,7 @@ struct perf_pmu *perf_pmus__find(const char *name)
> >               return pmu;
> >
> >       dirfd = perf_pmu__event_source_devices_fd();
> > -     pmu = perf_pmu__lookup(&pmus, dirfd, name);
> > +     pmu = perf_pmu__lookup(is_pmu_core(name) ? &core_pmus : &uncore_pmus, dirfd, name);
> >       close(dirfd);
> >
> >       return pmu;
> > @@ -72,7 +83,7 @@ static struct perf_pmu *perf_pmu__find2(int dirfd, const char *name)
> >       if (pmu)
> >               return pmu;
> >
> > -     return perf_pmu__lookup(&pmus, dirfd, name);
> > +     return perf_pmu__lookup(is_pmu_core(name) ? &core_pmus : &uncore_pmus, dirfd, name);
> >  }
> >
> >  /* Add all pmus in sysfs to pmu list: */
> > @@ -93,7 +104,7 @@ static void pmu_read_sysfs(void)
> >       while ((dent = readdir(dir))) {
> >               if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
> >                       continue;
> > -             /* add to static LIST_HEAD(pmus): */
> > +             /* add to static LIST_HEAD(core_pmus) or LIST_HEAD(uncore_pmus): */
> >               perf_pmu__find2(fd, dent->d_name);
> >       }
> >
> > @@ -104,24 +115,37 @@ struct perf_pmu *perf_pmus__find_by_type(unsigned int type)
> >  {
> >       struct perf_pmu *pmu;
> >
> > -     list_for_each_entry(pmu, &pmus, list)
> > +     list_for_each_entry(pmu, &core_pmus, list) {
> >               if (pmu->type == type)
> >                       return pmu;
> > -
> > +     }
> > +     list_for_each_entry(pmu, &uncore_pmus, list) {
> > +             if (pmu->type == type)
> > +                     return pmu;
> > +     }
> >       return NULL;
> >  }
> >
> > +/*
> > + * pmu iterator: If pmu is NULL, we start at the begin, otherwise return the
> > + * next pmu. Returns NULL on end.
> > + */
> >  struct perf_pmu *perf_pmus__scan(struct perf_pmu *pmu)
> >  {
> > -     /*
> > -      * pmu iterator: If pmu is NULL, we start at the begin,
> > -      * otherwise return the next pmu. Returns NULL on end.
> > -      */
> > +     bool use_core_pmus = !pmu || pmu->is_core;
> > +
> >       if (!pmu) {
> >               pmu_read_sysfs();
> > -             pmu = list_prepare_entry(pmu, &pmus, list);
> > +             pmu = list_prepare_entry(pmu, &core_pmus, list);
> > +     }
> > +     if (use_core_pmus) {
> > +             list_for_each_entry_continue(pmu, &core_pmus, list)
> > +                     return pmu;
> > +
> > +             pmu = NULL;
> > +             pmu = list_prepare_entry(pmu, &uncore_pmus, list);
> >       }
> > -     list_for_each_entry_continue(pmu, &pmus, list)
> > +     list_for_each_entry_continue(pmu, &uncore_pmus, list)
> >               return pmu;
> >       return NULL;
> >  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ