From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751065AbbIBFoT (ORCPT ); Wed, 2 Sep 2015 01:44:19 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:1462 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750743AbbIBFoR (ORCPT ); Wed, 2 Sep 2015 01:44:17 -0400 Message-ID: <55E68BCF.4070609@huawei.com> Date: Wed, 2 Sep 2015 13:40:31 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Namhyung Kim CC: , , , , , , Brendan Gregg , Daniel Borkmann , David Ahern , He Kuang , Jiri Olsa , Kaixu Xia , Masami Hiramatsu , Paul Mackerras , Peter Zijlstra Subject: Re: [PATCH 07/31] perf probe: Attach trace_probe_event with perf_probe_event References: <1440822125-52691-1-git-send-email-wangnan0@huawei.com> <1440822125-52691-8-git-send-email-wangnan0@huawei.com> <20150902043223.GC30190@danjae.kornet> In-Reply-To: <20150902043223.GC30190@danjae.kornet> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.55E68BE2.00E3,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: cd77e34e6d7c056a4e79a29eae88347d Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/9/2 12:32, Namhyung Kim wrote: > 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 >> Cc: Alexei Starovoitov >> Cc: Brendan Gregg >> Cc: Daniel Borkmann >> Cc: David Ahern >> Cc: He Kuang >> Cc: Jiri Olsa >> Cc: Kaixu Xia >> Cc: Masami Hiramatsu >> Cc: Namhyung Kim >> Cc: Paul Mackerras >> Cc: Peter Zijlstra >> Cc: Zefan Li >> Cc: pi3orama@163.com >> Cc: Arnaldo Carvalho de Melo >> 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 '!'. It's my fault. Already fixed in my local tree. Thank you for your review! > 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;