Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1217313

Re: [PATCH 07/31] perf probe: Attach trace_probe_event with perf_probe_event

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 07/31] perf probe: Attach trace_probe_event with perf_probe_event
Date 2015-09-02 06:40 +0200
Message-ID <q4801-2Sy-1@gated-at.bofh.it> (permalink)
References <q2FWa-7Rj-5@gated-at.bofh.it> <q2FWb-7Rj-55@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

On Sat, Aug 29, 2015 at 04:21:41AM +0000, Wang Nan wrote:
> This patch drops struct __event_package structure. Instead, it adds
> trace_probe_event into 'struct perf_probe_event'.
> 
> trace_probe_event information gives further patches a chance to access
> actual probe points and actual arguments. Using them, bpf_loader will
> be able to attach one bpf program to different probing points of a
> inline functions (which has multiple probing points) and glob
> functions. Moreover, by reading arguments information, bpf code for
> reading those arguments can be generated.
> 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Alexei Starovoitov <ast@plumgrid.com>
> Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: He Kuang <hekuang@huawei.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Kaixu Xia <xiakaixu@huawei.com>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Zefan Li <lizefan@huawei.com>
> Cc: pi3orama@163.com
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Link: http://lkml.kernel.org/n/1436445342-1402-22-git-send-email-wangnan0@huawei.com
> ---

[SNIP]

> +int add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
> +			  bool cleanup)
> +{
> +	int i, ret;
>  
>  	ret = init_symbol_maps(pevs->uprobes);
> -	if (ret < 0) {
> -		free(pkgs);
> +	if (ret < 0)
>  		return ret;
> -	}
>  
>  	/* Loop 1: convert all events */
>  	for (i = 0; i < npevs; i++) {
> -		pkgs[i].pev = &pevs[i];
>  		/* Init kprobe blacklist if needed */
> -		if (!pkgs[i].pev->uprobes)
> +		if (pevs[i].uprobes)

Missing '!'.

Thanks,
Namhyung


>  			kprobe_blacklist__init();
>  		/* Convert with or without debuginfo */
> -		ret  = convert_to_probe_trace_events(pkgs[i].pev,
> -						     &pkgs[i].tevs);
> -		if (ret < 0)
> +		ret  = convert_to_probe_trace_events(&pevs[i], &pevs[i].tevs);
> +		if (ret < 0) {
> +			cleanup = true;
>  			goto end;
> -		pkgs[i].ntevs = ret;
> +		}
> +		pevs[i].ntevs = ret;
>  	}
>  	/* This just release blacklist only if allocated */
>  	kprobe_blacklist__release();
>  
>  	/* Loop 2: add all events */
>  	for (i = 0; i < npevs; i++) {
> -		ret = __add_probe_trace_events(pkgs[i].pev, pkgs[i].tevs,
> -					       pkgs[i].ntevs,
> +		ret = __add_probe_trace_events(&pevs[i], pevs[i].tevs,
> +					       pevs[i].ntevs,
>  					       probe_conf.force_add);
>  		if (ret < 0)
>  			break;
>  	}
>  end:
>  	/* Loop 3: cleanup and free trace events  */
> -	for (i = 0; i < npevs; i++) {
> -		for (j = 0; j < pkgs[i].ntevs; j++)
> -			clear_probe_trace_event(&pkgs[i].tevs[j]);
> -		zfree(&pkgs[i].tevs);
> -	}
> -	free(pkgs);
> +	for (i = 0; cleanup && (i < npevs); i++)
> +		cleanup_perf_probe_event(&pevs[i]);
>  	exit_symbol_maps();
>  
>  	return ret;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 07/31] perf probe: Attach trace_probe_event with perf_probe_event Wang Nan <wangnan0@huawei.com> - 2015-08-29 06:30 +0200
  Re: [PATCH 07/31] perf probe: Attach trace_probe_event with  perf_probe_event Namhyung Kim <namhyung@kernel.org> - 2015-09-02 06:40 +0200
    Re: [PATCH 07/31] perf probe: Attach trace_probe_event with perf_probe_event "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-02 07:50 +0200

csiph-web