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=fUhHJOiWCKZVKNpRYMvM-6c=xAaqwwSz=bpZSk=X-QKeQ@mail.gmail.com>
Date: Wed, 14 Jan 2026 08:52:05 -0800
From: Ian Rogers <irogers@...gle.com>
To: James Clark <james.clark@...aro.org>
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>, 
	Adrian Hunter <adrian.hunter@...el.com>, Suzuki K Poulose <suzuki.poulose@....com>, 
	Mike Leach <mike.leach@...aro.org>, John Garry <john.g.garry@...cle.com>, 
	Will Deacon <will@...nel.org>, Leo Yan <leo.yan@...ux.dev>, linux-perf-users@...r.kernel.org, 
	linux-kernel@...r.kernel.org, coresight@...ts.linaro.org, 
	linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v5 03/14] perf evsel: Move evsel__* functions to evsel.c

On Wed, Jan 14, 2026 at 7:57 AM James Clark <james.clark@...aro.org> wrote:
>
> At least one of these were put here to avoid a Python binding linking
> issue which is no longer present. Put them back in their correct
> location to avoid confusion about which file to add a new evsel__*
> function to later.
>
> Link: https://lore.kernel.org/all/ZEbAS2yx2fguW60w@kernel.org/
> Signed-off-by: James Clark <james.clark@...aro.org>

Reviewed-by: Ian Rogers <irogers@...gle.com>

Thanks,
Ian

> ---
>  tools/perf/util/evsel.c | 40 ++++++++++++++++++++++++++++++++++++++++
>  tools/perf/util/pmu.c   | 40 ----------------------------------------
>  2 files changed, 40 insertions(+), 40 deletions(-)
>
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index ec6552a6f667..21878e9bd029 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -1314,6 +1314,35 @@ struct evsel_config_term *__evsel__get_config_term(struct evsel *evsel, enum evs
>         return found_term;
>  }
>
> +/*
> + * Set @config_name to @val as long as the user hasn't already set or cleared it
> + * by passing a config term on the command line.
> + *
> + * @val is the value to put into the bits specified by @config_name rather than
> + * the bit pattern. It is shifted into position by this function, so to set
> + * something to true, pass 1 for val rather than a pre shifted value.
> + */
> +#define field_prep(_mask, _val) (((_val) << (ffsll(_mask) - 1)) & (_mask))
> +void evsel__set_config_if_unset(struct evsel *evsel, const char *config_name,
> +                               u64 val)
> +{
> +       u64 user_bits = 0, bits;
> +       struct evsel_config_term *term = evsel__get_config_term(evsel, CFG_CHG);
> +
> +       if (term)
> +               user_bits = term->val.cfg_chg;
> +
> +       bits = perf_pmu__format_bits(evsel->pmu, config_name);
> +
> +       /* Do nothing if the user changed the value */
> +       if (bits & user_bits)
> +               return;
> +
> +       /* Otherwise replace it */
> +       evsel->core.attr.config &= ~bits;
> +       evsel->core.attr.config |= field_prep(bits, val);
> +}
> +
>  void __weak arch_evsel__set_sample_weight(struct evsel *evsel)
>  {
>         evsel__set_sample_bit(evsel, WEIGHT);
> @@ -4098,6 +4127,17 @@ void evsel__set_leader(struct evsel *evsel, struct evsel *leader)
>         evsel->core.leader = &leader->core;
>  }
>
> +bool evsel__is_aux_event(const struct evsel *evsel)
> +{
> +       struct perf_pmu *pmu;
> +
> +       if (evsel->needs_auxtrace_mmap)
> +               return true;
> +
> +       pmu = evsel__find_pmu(evsel);
> +       return pmu && pmu->auxtrace;
> +}
> +
>  int evsel__source_count(const struct evsel *evsel)
>  {
>         struct evsel *pos;
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index e87c12946d71..e3a1f26213ec 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -1362,46 +1362,6 @@ void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu)
>         }
>  }
>
> -bool evsel__is_aux_event(const struct evsel *evsel)
> -{
> -       struct perf_pmu *pmu;
> -
> -       if (evsel->needs_auxtrace_mmap)
> -               return true;
> -
> -       pmu = evsel__find_pmu(evsel);
> -       return pmu && pmu->auxtrace;
> -}
> -
> -/*
> - * Set @config_name to @val as long as the user hasn't already set or cleared it
> - * by passing a config term on the command line.
> - *
> - * @val is the value to put into the bits specified by @config_name rather than
> - * the bit pattern. It is shifted into position by this function, so to set
> - * something to true, pass 1 for val rather than a pre shifted value.
> - */
> -#define field_prep(_mask, _val) (((_val) << (ffsll(_mask) - 1)) & (_mask))
> -void evsel__set_config_if_unset(struct evsel *evsel, const char *config_name,
> -                               u64 val)
> -{
> -       u64 user_bits = 0, bits;
> -       struct evsel_config_term *term = evsel__get_config_term(evsel, CFG_CHG);
> -
> -       if (term)
> -               user_bits = term->val.cfg_chg;
> -
> -       bits = perf_pmu__format_bits(evsel->pmu, config_name);
> -
> -       /* Do nothing if the user changed the value */
> -       if (bits & user_bits)
> -               return;
> -
> -       /* Otherwise replace it */
> -       evsel->core.attr.config &= ~bits;
> -       evsel->core.attr.config |= field_prep(bits, val);
> -}
> -
>  static struct perf_pmu_format *
>  pmu_find_format(const struct list_head *formats, const char *name)
>  {
>
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ