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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 9 Jun 2023 11:18:46 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     John Garry <john.g.garry@...cle.com>,
        Will Deacon <will@...nel.org>,
        James Clark <james.clark@....com>,
        Mike Leach <mike.leach@...aro.org>,
        Leo Yan <leo.yan@...aro.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        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>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        German Gomez <german.gomez@....com>,
        Ali Saidi <alisaidi@...zon.com>,
        Jing Zhang <renyu.zj@...ux.alibaba.com>,
        Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
        Miguel Ojeda <ojeda@...nel.org>,
        ye xingchen <ye.xingchen@....com.cn>,
        Liam Howlett <liam.howlett@...cle.com>,
        Dmitrii Dolgov <9erthalion6@...il.com>,
        Yang Jihong <yangjihong1@...wei.com>,
        K Prateek Nayak <kprateek.nayak@....com>,
        Changbin Du <changbin.du@...wei.com>,
        Ravi Bangoria <ravi.bangoria@....com>,
        Sean Christopherson <seanjc@...gle.com>,
        Andi Kleen <ak@...ux.intel.com>,
        "Steinar H. Gunderson" <sesse@...gle.com>,
        Yuan Can <yuancan@...wei.com>,
        Brian Robbins <brianrob@...ux.microsoft.com>,
        liuwenyu <liuwenyu7@...wei.com>,
        Ivan Babrou <ivan@...udflare.com>,
        Fangrui Song <maskray@...gle.com>,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-perf-users@...r.kernel.org, coresight@...ts.linaro.org
Subject: Re: [PATCH v2 05/26] perf addr_location: Move to its own header

Em Thu, Jun 08, 2023 at 04:28:02PM -0700, Ian Rogers escreveu:
> addr_location is a common abstraction, move it into its own header and
> source file in preparation for wider clean up.

Thanks, applied.

- Arnaldo

 
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
>  tools/perf/util/Build           |  1 +
>  tools/perf/util/addr_location.c | 16 ++++++++++++++++
>  tools/perf/util/addr_location.h | 28 ++++++++++++++++++++++++++++
>  tools/perf/util/event.c         | 12 ------------
>  tools/perf/util/symbol.h        | 17 +----------------
>  5 files changed, 46 insertions(+), 28 deletions(-)
>  create mode 100644 tools/perf/util/addr_location.c
>  create mode 100644 tools/perf/util/addr_location.h
> 
> diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> index c449741adf30..ff2fd1a36bb8 100644
> --- a/tools/perf/util/Build
> +++ b/tools/perf/util/Build
> @@ -1,4 +1,5 @@
>  perf-y += arm64-frame-pointer-unwind-support.o
> +perf-y += addr_location.o
>  perf-y += annotate.o
>  perf-y += block-info.o
>  perf-y += block-range.o
> diff --git a/tools/perf/util/addr_location.c b/tools/perf/util/addr_location.c
> new file mode 100644
> index 000000000000..c73fc2aa236c
> --- /dev/null
> +++ b/tools/perf/util/addr_location.c
> @@ -0,0 +1,16 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#include "addr_location.h"
> +#include "map.h"
> +#include "thread.h"
> +
> +/*
> + * The preprocess_sample method will return with reference counts for the
> + * in it, when done using (and perhaps getting ref counts if needing to
> + * keep a pointer to one of those entries) it must be paired with
> + * addr_location__put(), so that the refcounts can be decremented.
> + */
> +void addr_location__put(struct addr_location *al)
> +{
> +	map__zput(al->map);
> +	thread__zput(al->thread);
> +}
> diff --git a/tools/perf/util/addr_location.h b/tools/perf/util/addr_location.h
> new file mode 100644
> index 000000000000..7dfa7417c0fe
> --- /dev/null
> +++ b/tools/perf/util/addr_location.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __PERF_ADDR_LOCATION
> +#define __PERF_ADDR_LOCATION 1
> +
> +#include <linux/types.h>
> +
> +struct thread;
> +struct maps;
> +struct map;
> +struct symbol;
> +
> +struct addr_location {
> +	struct thread *thread;
> +	struct maps   *maps;
> +	struct map    *map;
> +	struct symbol *sym;
> +	const char    *srcline;
> +	u64	      addr;
> +	char	      level;
> +	u8	      filtered;
> +	u8	      cpumode;
> +	s32	      cpu;
> +	s32	      socket;
> +};
> +
> +void addr_location__put(struct addr_location *al);
> +
> +#endif /* __PERF_ADDR_LOCATION */
> diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> index e1ce7cb5e421..6ee23145ee7e 100644
> --- a/tools/perf/util/event.c
> +++ b/tools/perf/util/event.c
> @@ -767,18 +767,6 @@ int machine__resolve(struct machine *machine, struct addr_location *al,
>  	return 0;
>  }
>  
> -/*
> - * The preprocess_sample method will return with reference counts for the
> - * in it, when done using (and perhaps getting ref counts if needing to
> - * keep a pointer to one of those entries) it must be paired with
> - * addr_location__put(), so that the refcounts can be decremented.
> - */
> -void addr_location__put(struct addr_location *al)
> -{
> -	map__zput(al->map);
> -	thread__zput(al->thread);
> -}
> -
>  bool is_bts_event(struct perf_event_attr *attr)
>  {
>  	return attr->type == PERF_TYPE_HARDWARE &&
> diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
> index 7558735543c2..5ca8665dd2c1 100644
> --- a/tools/perf/util/symbol.h
> +++ b/tools/perf/util/symbol.h
> @@ -9,6 +9,7 @@
>  #include <linux/list.h>
>  #include <linux/rbtree.h>
>  #include <stdio.h>
> +#include "addr_location.h"
>  #include "path.h"
>  #include "symbol_conf.h"
>  #include "spark.h"
> @@ -120,22 +121,6 @@ struct ref_reloc_sym {
>  	u64		unrelocated_addr;
>  };
>  
> -struct addr_location {
> -	struct thread *thread;
> -	struct maps   *maps;
> -	struct map    *map;
> -	struct symbol *sym;
> -	const char    *srcline;
> -	u64	      addr;
> -	char	      level;
> -	u8	      filtered;
> -	u8	      cpumode;
> -	s32	      cpu;
> -	s32	      socket;
> -};
> -
> -void addr_location__put(struct addr_location *al);
> -
>  int dso__load(struct dso *dso, struct map *map);
>  int dso__load_vmlinux(struct dso *dso, struct map *map,
>  		      const char *vmlinux, bool vmlinux_allocated);
> -- 
> 2.41.0.162.gfafddb0af9-goog
> 

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ