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 <wangn...@huawei.com>
> Cc: Alexei Starovoitov <a...@plumgrid.com>
> Cc: Brendan Gregg <brendan.d.gr...@gmail.com>
> Cc: Daniel Borkmann <dan...@iogearbox.net>
> Cc: David Ahern <dsah...@gmail.com>
> Cc: He Kuang <heku...@huawei.com>
> Cc: Jiri Olsa <jo...@kernel.org>
> Cc: Kaixu Xia <xiaka...@huawei.com>
> Cc: Masami Hiramatsu <masami.hiramatsu...@hitachi.com>
> Cc: Namhyung Kim <namhy...@kernel.org>
> Cc: Paul Mackerras <pau...@samba.org>
> Cc: Peter Zijlstra <a.p.zijls...@chello.nl>
> Cc: Zefan Li <lize...@huawei.com>
> Cc: pi3or...@163.com
> Cc: Arnaldo Carvalho de Melo <a...@redhat.com>
> Link: 
> http://lkml.kernel.org/n/1436445342-1402-22-git-send-email-wangn...@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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to