From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Namhyung Kim <namhyung@kernel.org>, Steven Rostedt <rostedt@goodmis.org>
Cc: Namhyung Kim <namhyung.kim@lge.com>,
Hyeoncheol Lee <cheol.lee@lge.com>,
Hemant Kumar <hkshaw@linux.vnet.ibm.com>,
LKML <linux-kernel@vger.kernel.org>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
Oleg Nesterov <oleg@redhat.com>,
"zhangwei(Jovi)" <jovi.zhangwei@huawei.com>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Subject: Re: [PATCHSET 00/13] tracing/uprobes: Add support for more fetch methods (v6)
Date: Wed, 30 Oct 2013 19:36:02 +0900 [thread overview]
Message-ID: <5270E112.3020107@hitachi.com> (raw)
In-Reply-To: <1383029621-7384-1-git-send-email-namhyung@kernel.org>
(2013/10/29 15:53), Namhyung Kim wrote:
> Hello,
>
> This patchset implements memory (address), stack[N], deference,
> bitfield and retval (it needs uretprobe tho) fetch methods for
> uprobes. It's based on the previous work [1] done by Hyeoncheol Lee.
>
> Now kprobes and uprobes have their own fetch_type_tables and, in turn,
> memory and stack access methods. Other fetch methods are shared.
>
> For the dereference method, I added a new argument to fetch functions.
> It's because for uprobes it needs to know whether the given address is
> a file offset or a virtual address in an user process. For instance,
> in case of fetching from a memory directly (like @offset) it should
> convert the address (offset) to a virtual address of the process, but
> if it's a dereferencing, the given address already has the virtual
> address.
>
> To determine this in a fetch function, I passed a pointer to
> trace_uprobe for direct fetch, and passed NULL for dereference.
>
> The patch 1-2 are bug fixes and can be applied independently.
You'd better add [BUGFIX] and send those separately. ;)
But anyway, I'm OK to pull those first two (and others too).
> Please look at patch 10 that uses per-cpu buffer for accessing user
> memory as suggested by Steven. While I tried hard not to mess things
> up there might be a chance I did something horrible. It'd be great if
> you guys take a look and give comments.
>
>
> * v6 changes:
> - add more Ack's from Masami
> - fix ref count of uprobe_cpu_buffer (thanks to Jovi)
>
> * v5 changes:
> - use user_stack_pointer() instead of GET_USP()
> - fix a bug in 'stack' fetch method of uprobes
>
> * v4 changes:
> - add Ack's from Masami
> - rearrange patches to make it easy for simple fixes to be applied
> - update documentation
> - use per-cpu buffer for storing args (thanks to Steve!)
>
>
> [1] https://lkml.org/lkml/2012/11/14/84
>
> A simple example:
>
> # cat foo.c
> int glob = -1;
> char str[] = "hello uprobe.";
>
> struct foo {
> unsigned int unused: 2;
> unsigned int foo: 20;
> unsigned int bar: 10;
> } foo = {
> .foo = 5,
> };
>
> int main(int argc, char *argv[])
> {
> long local = 0x1234;
>
> return 127;
> }
>
> # gcc -o foo -g foo.c
>
> # objdump -d foo | grep -A9 -F '<main>'
> 00000000004004b0 <main>:
> 4004b0: 55 push %rbp
> 4004b1: 48 89 e5 mov %rsp,%rbp
> 4004b4: 89 7d ec mov %edi,-0x14(%rbp)
> 4004b7: 48 89 75 e0 mov %rsi,-0x20(%rbp)
> 4004bb: 48 c7 45 f8 34 12 00 movq $0x1234,-0x8(%rbp)
> 4004c2: 00
> 4004c3: b8 7f 00 00 00 mov $0x7f,%eax
> 4004c8: 5d pop %rbp
> 4004c9: c3 retq
>
> # nm foo | grep -e glob$ -e str -e foo
> 00000000006008bc D foo
> 00000000006008a8 D glob
> 00000000006008ac D str
>
> # perf probe -x /home/namhyung/tmp/foo -a 'foo=main+0x13 glob=@0x8a8:s32 \
> > str=@0x8ac:string bit=@0x8bc:b10@2/32 argc=%di local=-0x8(%bp)'
> Added new event:
> probe_foo:foo (on 0x4c3 with glob=@0x8a8:s32 str=@0x8ac:string
> bit=@0x8bc:b10@2/32 argc=%di local=-0x8(%bp))
>
> You can now use it in all perf tools, such as:
>
> perf record -e probe_foo:foo -aR sleep 1
>
> # perf record -e probe_foo:foo ./foo
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.001 MB perf.data (~33 samples) ]
>
> # perf script | grep -v ^#
> foo 2008 [002 2199.867154: probe_foo:foo (4004c3)
> glob=-1 str="hello uprobe." bit=5 argc=1 local=1234
Nice ! :)
Thank you,
--
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
next prev parent reply other threads:[~2013-10-30 10:36 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-29 6:53 Namhyung Kim
2013-10-29 6:53 ` [PATCH 01/13] tracing/uprobes: Fix documentation of uprobe registration syntax Namhyung Kim
2013-10-29 6:53 ` [PATCH 02/13] tracing/probes: Fix basic print type functions Namhyung Kim
2013-10-29 6:53 ` [PATCH 03/13] tracing/kprobes: Move fetch functions to trace_kprobe.c Namhyung Kim
2013-10-29 6:53 ` [PATCH 04/13] tracing/kprobes: Add fetch{,_size} member into deref fetch method Namhyung Kim
2013-10-29 6:53 ` [PATCH 05/13] tracing/kprobes: Staticize stack and memory fetch functions Namhyung Kim
2013-10-29 6:53 ` [PATCH 06/13] tracing/kprobes: Factor out struct trace_probe Namhyung Kim
2013-10-29 6:53 ` [PATCH 07/13] tracing/uprobes: Convert to " Namhyung Kim
2013-10-29 6:53 ` [PATCH 08/13] tracing/kprobes: Move common functions to trace_probe.h Namhyung Kim
2013-10-29 6:53 ` [PATCH 09/13] tracing/kprobes: Integrate duplicate set_print_fmt() Namhyung Kim
2013-10-29 6:53 ` [PATCH 10/13] tracing/uprobes: Fetch args before reserving a ring buffer Namhyung Kim
2013-10-31 18:16 ` Oleg Nesterov
2013-11-01 9:00 ` Namhyung Kim
2013-11-04 8:06 ` Namhyung Kim
2013-11-04 14:35 ` Oleg Nesterov
2013-11-05 1:12 ` Namhyung Kim
2013-11-01 15:09 ` Oleg Nesterov
2013-11-01 15:22 ` Oleg Nesterov
2013-11-03 20:20 ` Oleg Nesterov
2013-11-04 8:11 ` Namhyung Kim
2013-11-04 14:38 ` Oleg Nesterov
2013-11-05 1:17 ` Namhyung Kim
2013-10-29 6:53 ` [PATCH 11/13] tracing/kprobes: Add priv argument to fetch functions Namhyung Kim
2013-11-04 16:09 ` Oleg Nesterov
2013-11-05 2:10 ` Namhyung Kim
2013-10-29 6:53 ` [PATCH 12/13] tracing/uprobes: Add more " Namhyung Kim
2013-10-31 18:22 ` Oleg Nesterov
2013-11-04 8:50 ` Namhyung Kim
2013-11-04 16:44 ` Oleg Nesterov
2013-11-04 17:17 ` Steven Rostedt
2013-11-05 2:19 ` Namhyung Kim
2013-11-05 2:17 ` Namhyung Kim
2013-11-01 17:53 ` Oleg Nesterov
2013-10-29 6:53 ` [PATCH 13/13] tracing/uprobes: Add support for full argument access methods Namhyung Kim
2013-10-30 10:36 ` Masami Hiramatsu [this message]
2013-11-02 15:54 ` [PATCHSET 00/13] tracing/uprobes: Add support for more fetch methods (v6) Oleg Nesterov
2013-11-04 8:46 ` Namhyung Kim
2013-11-04 8:59 ` Namhyung Kim
2013-11-04 15:51 ` Oleg Nesterov
2013-11-04 16:22 ` Oleg Nesterov
2013-11-04 18:47 ` Oleg Nesterov
2013-11-04 18:57 ` Oleg Nesterov
2013-11-05 2:51 ` Namhyung Kim
2013-11-05 16:41 ` Oleg Nesterov
2013-11-06 8:37 ` Namhyung Kim
2013-11-05 2:49 ` Namhyung Kim
2013-11-05 6:58 ` Namhyung Kim
2013-11-05 17:45 ` Oleg Nesterov
2013-11-05 19:24 ` Oleg Nesterov
2013-11-06 8:57 ` Namhyung Kim
2013-11-06 17:37 ` Oleg Nesterov
2013-11-06 18:24 ` Oleg Nesterov
2013-11-07 9:00 ` Namhyung Kim
2013-11-08 17:00 ` Oleg Nesterov
2013-11-12 7:49 ` Namhyung Kim
2013-11-07 8:48 ` Namhyung Kim
2013-11-09 3:18 ` Masami Hiramatsu
2013-11-09 15:23 ` Oleg Nesterov
2013-11-12 8:00 ` Namhyung Kim
2013-11-12 18:44 ` Oleg Nesterov
2013-11-25 6:59 ` Namhyung Kim
2013-11-25 14:12 ` [PATCH] uprobes: Allocate ->utask before handler_chain() for tracing handlers Oleg Nesterov
2013-11-06 8:48 ` [PATCHSET 00/13] tracing/uprobes: Add support for more fetch methods (v6) Namhyung Kim
2013-11-06 16:28 ` Oleg Nesterov
2013-11-07 7:33 ` Namhyung Kim
2013-11-08 16:52 ` Oleg Nesterov
2013-11-05 2:15 ` Namhyung Kim
2013-11-05 16:33 ` Oleg Nesterov
2013-11-06 8:34 ` Namhyung Kim
2013-11-05 1:59 ` Namhyung Kim
2013-11-04 15:01 ` Oleg Nesterov
2013-11-05 1:53 ` Namhyung Kim
2013-11-05 16:28 ` Oleg Nesterov
2013-11-06 8:31 ` Namhyung Kim
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=5270E112.3020107@hitachi.com \
--to=masami.hiramatsu.pt@hitachi.com \
--cc=acme@ghostprotocols.net \
--cc=cheol.lee@lge.com \
--cc=hkshaw@linux.vnet.ibm.com \
--cc=jovi.zhangwei@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung.kim@lge.com \
--cc=namhyung@kernel.org \
--cc=oleg@redhat.com \
--cc=rostedt@goodmis.org \
--cc=srikar@linux.vnet.ibm.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
Powered by JetHome