lkml.org 
[lkml]   [2015]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/31] perf probe: Attach trace_probe_event with perf_probe_event
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;


\
 
 \ /
  Last update: 2015-09-02 07:21    [W:0.241 / U:3.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site