From: Wang Nan <wangnan0@huawei.com>
To: Alexei Starovoitov <ast@plumgrid.com>,
He Kuang <hekuang@huawei.com>, <davem@davemloft.net>,
<acme@kernel.org>, <mingo@redhat.com>, <a.p.zijlstra@chello.nl>,
<masami.hiramatsu.pt@hitachi.com>, <jolsa@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <pi3orama@163.com>
Subject: Re: [RFC PATCH 0/6] perf bpf: Probing with local variable
Date: Wed, 6 May 2015 11:58:07 +0800 [thread overview]
Message-ID: <5549914F.9070808@huawei.com> (raw)
In-Reply-To: <554944C1.3060705@plumgrid.com>
On 2015/5/6 6:31, Alexei Starovoitov wrote:
> On 5/5/15 3:10 AM, He Kuang wrote:
>> This patch set is based on https://lkml.org/lkml/2015/4/30/264
>>
>> By using bpf 'config' section like this:
>>
>> char _config2[] SEC("config") = "generic_perform_write=generic_perform_write+122 file->f_mapping->a_ops bytes offset";
>> SEC("generic_perform_write")
>> int NODE_generic_perform_write (struct pt_regs *ctx, void *a_ops, void *bytes, void* offset) {
>> char fmt[] = "NODE_generic_perform_write, a_ops=%p, bytes=%p, offset=%p\n";
>> bpf_trace_printk(fmt, sizeof(fmt), a_ops, bytes, offset);
>> return 1;
>> }
>>
>> In this example, 'bytes' and 'offset' are local variables, a_ops is in
>> the structure field of file parameter, and we probe in the body of the
>> generic_perform_write() function.
>>
>> Perf can fetch and convert all the arguments and then we translate them
>> into bpf bytecode as a prologue before calling bpf body functions. In
>> the prologue, we fetch arguments from bpf context register and place
>> them according to bpf calling conventions so the body function can
>> access them as formal parameters.
>
> great idea! Like it a lot.
> Looking at current implementation I think the limit is <=3 arguments,
> which I think is perfectly fine for now. Just worth mentioning in
> the doc.
>
> Two high level comments:
> - can you collapse SEC("config") with SEC("func_name") ?
> It seems that "func_name" is only used as reference inside "config".
> I understand that you're proposing one "config" section where multiple
> descriptions are strcat together, but why? Something like:
> SEC("kprobe/generic_perform_write+122(file->f_mapping->a_ops, bytes, offset)")
> int func(...) { ... }
> should be enough and more concise.
>
Is it possible to use such a long section name? I introduce 'config' section
since it contains C strings so I can put things to it freely. By using macro trick,
we can still use not very complex code to describe probing position like this:
#define PROBE(name, config) \
SEC("config") char name##_config[] = #name config ; \
SEC(#name)
PROBE(generic_perform_write, "kprobe: +122(file->f_mapping->a_ops, bytes, offset)")
next prev parent reply other threads:[~2015-05-06 3:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-05 10:10 [RFC PATCH 0/6] perf bpf: Probing with local variable He Kuang
2015-05-05 10:10 ` [RFC PATCH 1/6] perf bpf: Add headers for generate bpf bytecode He Kuang
2015-05-05 22:38 ` Alexei Starovoitov
2015-05-05 10:10 ` [RFC PATCH 2/6] perf bpf: Add pt_regs convert table for x86 He Kuang
2015-05-05 22:44 ` Alexei Starovoitov
2015-05-08 8:02 ` Masami Hiramatsu
2015-05-05 10:10 ` [RFC PATCH 3/6] perf bpf: Save pt_regs info from debuginfo He Kuang
2015-05-05 10:10 ` [RFC PATCH 4/6] perf bpf: Convert arglist to bpf prologue He Kuang
2015-05-05 22:54 ` Alexei Starovoitov
2015-05-05 10:10 ` [RFC PATCH 5/6] perf bpf: Process debuginfo for generating " He Kuang
2015-05-05 10:10 ` [RFC PATCH 6/6] perf bpf: Generate bpf prologue for arguments He Kuang
2015-05-05 22:31 ` [RFC PATCH 0/6] perf bpf: Probing with local variable Alexei Starovoitov
2015-05-06 3:58 ` Wang Nan [this message]
2015-05-06 4:10 ` Alexei Starovoitov
2015-05-06 4:41 ` Wang Nan
2015-05-06 1:37 ` Masami Hiramatsu
2015-05-06 1:44 ` Arnaldo Carvalho de Melo
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=5549914F.9070808@huawei.com \
--to=wangnan0@huawei.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=ast@plumgrid.com \
--cc=davem@davemloft.net \
--cc=hekuang@huawei.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@redhat.com \
--cc=pi3orama@163.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.