Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932673AbbERTnK (ORCPT ); Mon, 18 May 2015 15:43:10 -0400 Received: from mail-ig0-f180.google.com ([209.85.213.180]:38394 "EHLO mail-ig0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932180AbbERTnH (ORCPT ); Mon, 18 May 2015 15:43:07 -0400 Message-ID: <555A40C8.50007@plumgrid.com> Date: Mon, 18 May 2015 12:43:04 -0700 From: Alexei Starovoitov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: He Kuang , paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, jolsa@kernel.org, dsahern@gmail.com, daniel@iogearbox.net, brendan.d.gregg@gmail.com, masami.hiramatsu.pt@hitachi.com CC: wangnan0@huawei.com, lizefan@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [RFC PATCH 2/5] bpf: Pass trace_probe to bpf_prog for variable fetching References: <1431927047-35144-1-git-send-email-hekuang@huawei.com> <1431927047-35144-3-git-send-email-hekuang@huawei.com> In-Reply-To: <1431927047-35144-3-git-send-email-hekuang@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1345 Lines: 41 On 5/17/15 10:30 PM, He Kuang wrote: > Add new structure bpf_pt_regs, which contains both original > 'ctx'(pt_regs) and trabe_probe pointer, and pass this new pointer to bpf > prog for variable fetching. > > Signed-off-by: He Kuang > --- > kernel/trace/trace_kprobe.c | 11 +++++++++-- > kernel/trace/trace_probe.h | 5 +++++ > 2 files changed, 14 insertions(+), 2 deletions(-) > > diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c > index d0ce590..cee0b28 100644 > --- a/kernel/trace/trace_kprobe.c > +++ b/kernel/trace/trace_kprobe.c > @@ -1141,8 +1141,15 @@ kprobe_perf_func(struct trace_kprobe *tk, struct pt_regs *regs) > int size, __size, dsize; > int rctx; > > - if (prog && !trace_call_bpf(prog, regs)) > - return; > + if (prog) { > + struct bpf_pt_regs bpf_pt_regs; > + > + bpf_pt_regs.pt_regs = *regs; > + bpf_pt_regs.tp = &tk->tp; ... > +struct bpf_pt_regs { > + struct pt_regs pt_regs; > + struct trace_probe *tp; > +}; that is a massive overhead. On x64 it means copying 168 bytes for every call. imo that's a wrong trade off. -- 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/