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: <Zqo54HwtkDSA-IBb@x1>
Date: Wed, 31 Jul 2024 10:19:28 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ian Rogers <irogers@...gle.com>
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>,
	John Garry <john.g.garry@...cle.com>,
	Jing Zhang <renyu.zj@...ux.alibaba.com>,
	Xu Yang <xu.yang_2@....com>, Sandipan Das <sandipan.das@....com>,
	linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
	philip.li@...el.com, oliver.sang@...el.com,
	Weilin Wang <weilin.wang@...el.com>
Subject: Re: [PATCH v3 1/2] perf jevents: Use name for special find value

On Tue, Jul 30, 2024 at 12:17:43PM -0700, Ian Rogers wrote:
> -1000 was used as a special value added in Commit 3d5045492ab2 ("perf
> pmu-events: Add pmu_events_table__find_event()") to show that 1 table
> lacked a PMU/event but that didn't terminate the search in other
> tables. Add a new constant PMU_EVENTS__NOT_FOUND for this value and
> use it.

Applied this one.

- Arnaldo
 
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> Reviewed-by: John Garry <john.g.garry@...cle.com>
> ---
>  tools/perf/pmu-events/jevents.py   | 6 +++---
>  tools/perf/pmu-events/pmu-events.h | 9 +++++++++
>  2 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py
> index ac9b7ca41856..731776e29f47 100755
> --- a/tools/perf/pmu-events/jevents.py
> +++ b/tools/perf/pmu-events/jevents.py
> @@ -906,7 +906,7 @@ static int pmu_events_table__find_event_pmu(const struct pmu_events_table *table
>    do_call:
>                  return fn ? fn(&pe, table, data) : 0;
>          }
> -        return -1000;
> +        return PMU_EVENTS__NOT_FOUND;
>  }
>  
>  int pmu_events_table__for_each_event(const struct pmu_events_table *table,
> @@ -944,10 +944,10 @@ int pmu_events_table__find_event(const struct pmu_events_table *table,
>                          continue;
>  
>                  ret = pmu_events_table__find_event_pmu(table, table_pmu, name, fn, data);
> -                if (ret != -1000)
> +                if (ret != PMU_EVENTS__NOT_FOUND)
>                          return ret;
>          }
> -        return -1000;
> +        return PMU_EVENTS__NOT_FOUND;
>  }
>  
>  size_t pmu_events_table__num_events(const struct pmu_events_table *table,
> diff --git a/tools/perf/pmu-events/pmu-events.h b/tools/perf/pmu-events/pmu-events.h
> index f5aa96f1685c..5435ad92180c 100644
> --- a/tools/perf/pmu-events/pmu-events.h
> +++ b/tools/perf/pmu-events/pmu-events.h
> @@ -70,6 +70,8 @@ struct pmu_metric {
>  struct pmu_events_table;
>  struct pmu_metrics_table;
>  
> +#define PMU_EVENTS__NOT_FOUND -1000
> +
>  typedef int (*pmu_event_iter_fn)(const struct pmu_event *pe,
>  				 const struct pmu_events_table *table,
>  				 void *data);
> @@ -82,6 +84,13 @@ int pmu_events_table__for_each_event(const struct pmu_events_table *table,
>  				    struct perf_pmu *pmu,
>  				    pmu_event_iter_fn fn,
>  				    void *data);
> +/*
> + * Search for table and entry matching with pmu__name_match. Each matching event
> + * has fn called on it. 0 implies to success/continue the search while non-zero
> + * means to terminate. The special value PMU_EVENTS__NOT_FOUND is used to
> + * indicate no event was found in one of the tables which doesn't terminate the
> + * search of all tables.
> + */
>  int pmu_events_table__find_event(const struct pmu_events_table *table,
>                                   struct perf_pmu *pmu,
>                                   const char *name,
> -- 
> 2.46.0.rc2.264.g509ed76dc8-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ