From: Jiri Olsa <jolsa@redhat.com>
To: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Oleg Nesterov <oleg@redhat.com>, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Linux-mm <linux-mm@kvack.org>, Andi Kleen <andi@firstfloor.org>,
Christoph Hellwig <hch@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Roland McGrath <roland@hack.frob.com>,
Thomas Gleixner <tglx@linutronix.de>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
Arnaldo Carvalho de Melo <acme@infradead.org>,
Anton Arapov <anton@redhat.com>,
Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Jim Keniston <jkenisto@linux.vnet.ibm.com>,
Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH v9 3.2 7/9] tracing: uprobes trace_event interface
Date: Mon, 16 Jan 2012 14:11:37 +0100 [thread overview]
Message-ID: <20120116131137.GB5265@m.brq.redhat.com> (raw)
In-Reply-To: <20120110114943.17610.28293.sendpatchset@srdronam.in.ibm.com>
On Tue, Jan 10, 2012 at 05:19:43PM +0530, Srikar Dronamraju wrote:
>
> Implements trace_event support for uprobes. In its current form it can
> be used to put probes at a specified offset in a file and dump the
> required registers when the code flow reaches the probed address.
>
> The following example shows how to dump the instruction pointer and %ax
> a register at the probed text address. Here we are trying to probe
> zfree in /bin/zsh
>
> # cd /sys/kernel/debug/tracing/
> # cat /proc/`pgrep zsh`/maps | grep /bin/zsh | grep r-xp
> 00400000-0048a000 r-xp 00000000 08:03 130904 /bin/zsh
> # objdump -T /bin/zsh | grep -w zfree
> 0000000000446420 g DF .text 0000000000000012 Base zfree
> # echo 'p /bin/zsh:0x46420 %ip %ax' > uprobe_events
> # cat uprobe_events
> p:uprobes/p_zsh_0x46420 /bin/zsh:0x0000000000046420
> # echo 1 > events/uprobes/enable
> # sleep 20
> # echo 0 > events/uprobes/enable
> # cat trace
> # tracer: nop
> #
> # TASK-PID CPU# TIMESTAMP FUNCTION
> # | | | | |
> zsh-24842 [006] 258544.995456: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79
> zsh-24842 [007] 258545.000270: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79
> zsh-24842 [002] 258545.043929: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79
> zsh-24842 [004] 258547.046129: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79
>
> TODO: Connect a filter to a consumer.
hi,
It looks to me the perf/trace filtering is already working
with the small fix attached.
In another email discussion I think you suggested to use
the 'filter property of uprobe consumer' for the perf/trace
filtering. The current code does the filtering in the handler
itself, and it's same for other perf/trace based events.
I discussed the 'filter property of uprobe consumer' with Oleg,
and he is not sure why it was added.. was it only for the perf/trace
filtering?
I've tested following event:
echo "p:probe_libc/free /lib64/libc-2.13.so:0x7a4f0 %ax" > ./uprobe_events
and commands like:
perf record -a -e probe_libc:free --filter "common_pid == 1127"
perf record -e probe_libc:free --filter "arg1 == 0xa" ls
got me proper results.
thanks,
jirka
---
The preemption needs to be disabled when submitting data into perf.
---
kernel/trace/trace_uprobe.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index af29368..4d3857c 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -653,9 +653,11 @@ static void uprobe_perf_func(struct trace_uprobe *tp, struct pt_regs *regs)
"profile buffer not large enough"))
return;
+ preempt_disable();
+
entry = perf_trace_buf_prepare(size, call->event.type, regs, &rctx);
if (!entry)
- return;
+ goto out;
entry->ip = get_uprobe_bkpt_addr(task_pt_regs(current));
data = (u8 *)&entry[1];
@@ -665,6 +667,8 @@ static void uprobe_perf_func(struct trace_uprobe *tp, struct pt_regs *regs)
head = this_cpu_ptr(call->perf_events);
perf_trace_buf_submit(entry, size, rctx, entry->ip, 1, regs, head);
+ out:
+ preempt_enable();
}
#endif /* CONFIG_PERF_EVENTS */
--
1.7.1
next prev parent reply other threads:[~2012-01-16 13:12 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-10 11:48 [PATCH v9 3.2 0/9] Uprobes patchset with perf probe support Srikar Dronamraju
2012-01-10 11:48 ` [PATCH v9 3.2 1/9] uprobes: Install and remove breakpoints Srikar Dronamraju
2012-01-25 14:39 ` Denys Vlasenko
2012-01-25 16:31 ` Oleg Nesterov
2012-01-25 15:13 ` Denys Vlasenko
2012-01-25 15:32 ` Denys Vlasenko
2012-01-26 14:14 ` Masami Hiramatsu
2012-01-26 18:28 ` Denys Vlasenko
2012-01-30 9:51 ` Masami Hiramatsu
2012-01-26 13:38 ` Masami Hiramatsu
2012-01-26 13:45 ` Masami Hiramatsu
2012-01-10 11:48 ` [PATCH v9 3.2 2/9] uprobes: handle breakpoint and signal step exception Srikar Dronamraju
2012-01-18 8:39 ` Anton Arapov
2012-01-18 9:02 ` Srikar Dronamraju
2012-01-18 10:18 ` Mike Frysinger
2012-01-18 10:47 ` Srikar Dronamraju
2012-01-18 11:01 ` Mike Frysinger
2012-01-20 22:57 ` Mike Frysinger
2012-01-25 8:12 ` Srikar Dronamraju
2012-01-10 11:48 ` [PATCH v9 3.2 3/9] uprobes: slot allocation Srikar Dronamraju
2012-01-10 11:49 ` [PATCH v9 3.2 4/9] uprobes: counter to optimize probe hits Srikar Dronamraju
2012-01-10 11:49 ` [PATCH v9 3.2 5/9] tracing: modify is_delete, is_return from ints to bool Srikar Dronamraju
2012-01-10 11:49 ` [PATCH v9 3.2 6/9] tracing: Extract out common code for kprobes/uprobes traceevents Srikar Dronamraju
2012-01-10 11:49 ` [PATCH v9 3.2 7/9] tracing: uprobes trace_event interface Srikar Dronamraju
2012-01-16 13:11 ` Jiri Olsa [this message]
2012-01-16 14:45 ` Srikar Dronamraju
2012-01-16 15:33 ` Jiri Olsa
2012-01-16 16:41 ` Srikar Dronamraju
2012-01-17 9:28 ` Ingo Molnar
2012-01-17 10:22 ` Srikar Dronamraju
2012-01-17 10:59 ` Ingo Molnar
2012-01-17 11:03 ` Srikar Dronamraju
2012-01-17 11:22 ` Ingo Molnar
2012-01-17 11:57 ` Srikar Dronamraju
2012-01-17 12:23 ` Ingo Molnar
2012-01-17 12:27 ` Ingo Molnar
2012-01-17 12:11 ` Ingo Molnar
2012-01-17 12:21 ` Ingo Molnar
2012-01-18 10:07 ` Srikar Dronamraju
2012-01-10 11:49 ` [PATCH v9 3.2 8/9] perf: rename target_module to target Srikar Dronamraju
2012-01-16 8:34 ` [PATCH v9 3.2 0/9] Uprobes patchset with perf probe support Ingo Molnar
2012-01-16 15:17 ` Srikar Dronamraju
2012-01-17 9:39 ` Ingo Molnar
2012-01-25 14:11 ` Peter Zijlstra
2012-01-26 11:10 ` Ingo Molnar
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=20120116131137.GB5265@m.brq.redhat.com \
--to=jolsa@redhat.com \
--cc=acme@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=ananth@in.ibm.com \
--cc=andi@firstfloor.org \
--cc=anton@redhat.com \
--cc=hch@infradead.org \
--cc=jkenisto@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=roland@hack.frob.com \
--cc=rostedt@goodmis.org \
--cc=sfr@canb.auug.org.au \
--cc=srikar@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).