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=fX6OkyWD_nC6aruSRi44Nkt-UMLqwRKtLUcE87q_Khgcg@mail.gmail.com>
Date:   Thu, 12 Oct 2023 08:23:41 -0700
From:   Ian Rogers <irogers@...gle.com>
To:     Adrian Hunter <adrian.hunter@...el.com>
Cc:     Suzuki K Poulose <suzuki.poulose@....com>,
        Mike Leach <mike.leach@...aro.org>,
        James Clark <james.clark@....com>,
        Leo Yan <leo.yan@...aro.org>,
        John Garry <john.g.garry@...cle.com>,
        Will Deacon <will@...nel.org>,
        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>,
        Thomas Richter <tmricht@...ux.ibm.com>,
        Ravi Bangoria <ravi.bangoria@....com>,
        Kajol Jain <kjain@...ux.ibm.com>,
        Jing Zhang <renyu.zj@...ux.alibaba.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        Yang Jihong <yangjihong1@...wei.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/7] perf pmu: Rename perf_pmu__get_default_config to perf_pmu__arch_init

On Thu, Oct 12, 2023 at 4:52 AM Adrian Hunter <adrian.hunter@...el.com> wrote:
>
> On 7/10/23 05:13, Ian Rogers wrote:
> > Assign default_config as part of the
> > init. perf_pmu__get_default_config was doing more than just getting
> > the default config and so this is intended to better align with the
> > code.
> >
> > Signed-off-by: Ian Rogers <irogers@...gle.com>
>
> One cosmetic comment otherwise:
>
> Reviewed-by: Adrian Hunter <adrian.hunter@...el.com>
>
> > ---
> >  tools/perf/arch/arm/util/pmu.c  |  8 +++-----
> >  tools/perf/arch/s390/util/pmu.c |  3 +--
> >  tools/perf/arch/x86/util/pmu.c  |  5 ++---
> >  tools/perf/util/pmu.c           | 14 +++++++-------
> >  tools/perf/util/pmu.h           |  2 +-
> >  5 files changed, 14 insertions(+), 18 deletions(-)
> >
> > diff --git a/tools/perf/arch/arm/util/pmu.c b/tools/perf/arch/arm/util/pmu.c
> > index a9623b128ece..d55d2b15f2e6 100644
> > --- a/tools/perf/arch/arm/util/pmu.c
> > +++ b/tools/perf/arch/arm/util/pmu.c
> > @@ -14,22 +14,20 @@
> >  #include "../../../util/pmu.h"
> >  #include "../../../util/cs-etm.h"
> >
> > -struct perf_event_attr
> > -*perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
> > +void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused)
> >  {
> >  #ifdef HAVE_AUXTRACE_SUPPORT
> >       if (!strcmp(pmu->name, CORESIGHT_ETM_PMU_NAME)) {
> >               /* add ETM default config here */
> >               pmu->selectable = true;
> > -             return cs_etm_get_default_config(pmu);
> > +             pmu->default_config = cs_etm_get_default_config(pmu);
> >  #if defined(__aarch64__)
> >       } else if (strstarts(pmu->name, ARM_SPE_PMU_NAME)) {
> > -             return arm_spe_pmu_default_config(pmu);
> > +             pmu->default_config = arm_spe_pmu_default_config(pmu);
> >       } else if (strstarts(pmu->name, HISI_PTT_PMU_NAME)) {
> >               pmu->selectable = true;
> >  #endif
> >       }
> >
> >  #endif
> > -     return NULL;
> >  }
> > diff --git a/tools/perf/arch/s390/util/pmu.c b/tools/perf/arch/s390/util/pmu.c
> > index 11f03f32e3fd..886c30e001fa 100644
> > --- a/tools/perf/arch/s390/util/pmu.c
> > +++ b/tools/perf/arch/s390/util/pmu.c
> > @@ -13,11 +13,10 @@
> >  #define      S390_PMUPAI_EXT         "pai_ext"
> >  #define      S390_PMUCPUM_CF         "cpum_cf"
> >
> > -struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu)
> > +void perf_pmu__arch_init(struct perf_pmu *pmu)
> >  {
> >       if (!strcmp(pmu->name, S390_PMUPAI_CRYPTO) ||
> >           !strcmp(pmu->name, S390_PMUPAI_EXT) ||
> >           !strcmp(pmu->name, S390_PMUCPUM_CF))
> >               pmu->selectable = true;
> > -     return NULL;
> >  }
> > diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c
> > index 8b53ca468a50..811e2377d2d5 100644
> > --- a/tools/perf/arch/x86/util/pmu.c
> > +++ b/tools/perf/arch/x86/util/pmu.c
> > @@ -17,19 +17,18 @@
> >  #include "../../../util/pmus.h"
> >  #include "env.h"
> >
> > -struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
> > +void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused)
> >  {
> >  #ifdef HAVE_AUXTRACE_SUPPORT
> >       if (!strcmp(pmu->name, INTEL_PT_PMU_NAME)) {
> >               pmu->auxtrace = true;
> > -             return intel_pt_pmu_default_config(pmu);
> > +             pmu->default_config = intel_pt_pmu_default_config(pmu);
> >       }
> >       if (!strcmp(pmu->name, INTEL_BTS_PMU_NAME)) {
> >               pmu->auxtrace = true;
> >               pmu->selectable = true;
> >       }
> >  #endif
> > -     return NULL;
> >  }
> >
> >  int perf_pmus__num_mem_pmus(void)
> > diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> > index 6b1b7f8f00fa..6e95b3d2c2e3 100644
> > --- a/tools/perf/util/pmu.c
> > +++ b/tools/perf/util/pmu.c
> > @@ -954,12 +954,6 @@ void pmu_add_sys_aliases(struct perf_pmu *pmu)
> >       pmu_for_each_sys_event(pmu_add_sys_aliases_iter_fn, pmu);
> >  }
> >
> > -struct perf_event_attr * __weak
> > -perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
> > -{
> > -     return NULL;
> > -}
> > -
> >  static char *pmu_find_alias_name(struct perf_pmu *pmu, int dirfd)
> >  {
> >       FILE *file = perf_pmu__open_file_at(pmu, dirfd, "alias");
> > @@ -991,6 +985,12 @@ static int pmu_max_precise(int dirfd, struct perf_pmu *pmu)
> >       return max_precise;
> >  }
> >
> > +
>
> Double blank line

Thanks, will fix in v2.

Ian

> > +void __weak
> > +perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused)
> > +{
> > +}
> > +
> >  struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char *name)
> >  {
> >       struct perf_pmu *pmu;
> > @@ -1037,7 +1037,7 @@ struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char
> >       pmu_add_sys_aliases(pmu);
> >       list_add_tail(&pmu->list, pmus);
> >
> > -     pmu->default_config = perf_pmu__get_default_config(pmu);
> > +     perf_pmu__arch_init(pmu);
> >
> >       return pmu;
> >  err:
> > diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
> > index 85190d058852..588c64e38d6b 100644
> > --- a/tools/perf/util/pmu.h
> > +++ b/tools/perf/util/pmu.h
> > @@ -233,7 +233,7 @@ bool perf_pmu__file_exists(struct perf_pmu *pmu, const char *name);
> >
> >  int perf_pmu__test(void);
> >
> > -struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu);
> > +void perf_pmu__arch_init(struct perf_pmu *pmu);
> >  void pmu_add_cpu_aliases_table(struct perf_pmu *pmu,
> >                              const struct pmu_events_table *table);
> >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ