From: Alexei Starovoitov <ast@plumgrid.com>
To: He Kuang <hekuang@huawei.com>,
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
Date: Mon, 18 May 2015 12:43:04 -0700 [thread overview]
Message-ID: <555A40C8.50007@plumgrid.com> (raw)
In-Reply-To: <1431927047-35144-3-git-send-email-hekuang@huawei.com>
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 <hekuang@huawei.com>
> ---
> 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.
next prev parent reply other threads:[~2015-05-18 19:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-18 5:30 [RFC PATCH 0/5] Fetching local variables for bpf prog He Kuang
2015-05-18 5:30 ` [RFC PATCH 1/5] perf bpf: Add -k option for testing convenience He Kuang
2015-05-18 5:30 ` [RFC PATCH 2/5] bpf: Pass trace_probe to bpf_prog for variable fetching He Kuang
2015-05-18 19:43 ` Alexei Starovoitov [this message]
2015-05-18 5:30 ` [RFC PATCH 3/5] bpf: Add helper function for fetching variables at probe point He Kuang
2015-05-18 19:53 ` Alexei Starovoitov
2015-05-18 5:30 ` [RFC PATCH 4/5] samples/bpf: Add proper prefix to objects in Makefile He Kuang
2015-05-18 19:59 ` Alexei Starovoitov
2015-05-18 5:30 ` [RFC PATCH 5/5] samples/bpf: Add sample for testing bpf fetch args He Kuang
2015-05-18 23:08 ` [RFC PATCH 0/5] Fetching local variables for bpf prog Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=555A40C8.50007@plumgrid.com \
--to=ast@plumgrid.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=brendan.d.gregg@gmail.com \
--cc=daniel@iogearbox.net \
--cc=dsahern@gmail.com \
--cc=hekuang@huawei.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=pi3orama@163.com \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox