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]
Message-ID: <50399556C9727B4D88A595C8584AAB375250BD14@GSjpTKYDCembx32.service.hitachi.net>
Date:	Fri, 4 Sep 2015 02:11:49 +0000
From:	平松雅巳 / HIRAMATU,MASAMI 
	<masami.hiramatsu.pt@...achi.com>
To:	"'Namhyung Kim'" <namhyung@...nel.org>,
	Arnaldo Carvalho de Melo <acme@...nel.org>
CC:	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Jiri Olsa <jolsa@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Wang Nan <wangnan0@...wei.com>
Subject: RE: [RFC/PATCH 1/3] perf probe: Split add_perf_probe_events()

> From: Namhyung Kim [mailto:namhyung@...il.com] On Behalf Of Namhyung Kim
> 
> The add_perf_probe_events() does 3 things:
> 
>  1. convert all perf events to trace events
>  2. add all trace events to kernel
>  3. cleanup all trace events
> 
> But sometimes we need to do something with the trace events.  So split
> the funtion into two, so that it can access intermediate trace events
> via struct __event_package if needed.

Yeah, this is good to me.

Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>

Thanks Namhyung!

> 
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> ---
>  tools/perf/util/probe-event.c | 30 ++++++++++++++++++++++++++----
>  1 file changed, 26 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index eb5f18b75402..8eaa03428d72 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -2765,9 +2765,10 @@ struct __event_package {
>  	int				ntevs;
>  };
> 
> -int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)
> +static int __add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
> +				   struct __event_package **ppkgs)
>  {
> -	int i, j, ret;
> +	int i, ret;
>  	struct __event_package *pkgs;
> 
>  	ret = 0;
> @@ -2792,7 +2793,7 @@ int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)
>  		ret  = convert_to_probe_trace_events(pkgs[i].pev,
>  						     &pkgs[i].tevs);
>  		if (ret < 0)
> -			goto end;
> +			return ret;
>  		pkgs[i].ntevs = ret;
>  	}
>  	/* This just release blacklist only if allocated */
> @@ -2806,7 +2807,19 @@ int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)
>  		if (ret < 0)
>  			break;
>  	}
> -end:
> +
> +	*ppkgs = pkgs;
> +
> +	return 0;
> +}
> +
> +static void cleanup_perf_probe_events(struct __event_package *pkgs, int npevs)
> +{
> +	int i, j;
> +
> +	if (pkgs == NULL)
> +		return;
> +
>  	/* Loop 3: cleanup and free trace events  */
>  	for (i = 0; i < npevs; i++) {
>  		for (j = 0; j < pkgs[i].ntevs; j++)
> @@ -2815,6 +2828,15 @@ end:
>  	}
>  	free(pkgs);
>  	exit_symbol_maps();
> +}
> +
> +int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)
> +{
> +	int ret;
> +	struct __event_package *pkgs = NULL;
> +
> +	ret = __add_perf_probe_events(pevs, npevs, &pkgs);
> +	cleanup_perf_probe_events(pkgs, npevs);
> 
>  	return ret;
>  }
> --
> 2.5.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ