From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11120 invoked by alias); 10 Sep 2009 23:51:14 -0000 Received: (qmail 11001 invoked by uid 22791); 10 Sep 2009 23:51:13 -0000 X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_110,J_CHICKENPOX_17,J_CHICKENPOX_21,J_CHICKENPOX_22,J_CHICKENPOX_44,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1-old.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 10 Sep 2009 23:51:08 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com ([10.11.47.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8ANp5iC014176 for ; Thu, 10 Sep 2009 19:51:06 -0400 Received: from dhcp-100-2-132.bos.redhat.com (dhcp-100-2-132.bos.redhat.com [10.16.2.132]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8ANp3j8014007; Thu, 10 Sep 2009 19:51:03 -0400 From: Masami Hiramatsu Subject: [PATCH tracing/kprobes 0/7] tracing/kprobes: kprobe-based event tracer update and perf support To: Frederic Weisbecker , Steven Rostedt , Ingo Molnar , lkml Cc: Ananth N Mavinakayanahalli , Andi Kleen , Christoph Hellwig , "Frank Ch. Eigler" , "H. Peter Anvin" , Jason Baron , Jim Keniston , "K.Prasad" , Lai Jiangshan , Li Zefan , Peter Zijlstra , Srikar Dronamraju , Tom Zanussi , systemtap, DLE Date: Thu, 10 Sep 2009 23:51:00 -0000 Message-ID: <20090910235258.22412.29317.stgit@dhcp-100-2-132.bos.redhat.com> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q3/txt/msg00655.txt.bz2 Hi Frederic, This series fixes bugs and upgrades kprobe-based event tracer as a dynamic event tracer on ftrace/perf tools. This also enhances tracer output format to show each argument name and event name on each entry. With this series, users can add trace events dynamically on ftrace and use those events with perf tools as below. (Step.1) Define new events under new group $ echo p:mygroup/myprobe do_sys_open dfd=a0 filename=a1 flags=a2 mode=a3 \ > /debug/tracing/kprobes_events $ echo r:mygroup/myretprobe do_sys_open rv >> /debug/tracing/kprobes_events $ cat /debug/tracing/kprobes_events p:myprobe do_sys_open+0 dfd=a0 filename=a1 flags=a2 mode=a3 r:myretprobe do_sys_open+0 rv=rv (You can see that each argument has its name.) (Step.2) Perf shows new events $ perf list ... mygroup:myretprobe [Tracepoint event] mygroup:myprobe [Tracepoint event] ... (Step.3) Record events with perf $ perf record -f -e mygroup:myprobe:record -F 1 -a ls ... [ perf record: Captured and wrote 0.081 MB perf.data (~3544 samples) ] (Step.4) Perf trace shows the result $ perf trace version = 0.5 perf-1405 [000] 0.000000: myprobe: (c04b0a5c) dfd=ffffff9c filename=810d3f7 flags=98800 mode=1 perf-1405 [000] 0.000000: myprobe: (c04b0a5c) dfd=ffffff9c filename=bff7650c flags=8000 mode=1b6 perf-1405 [000] 0.000000: myprobe: (c04b0a5c) dfd=ffffff9c filename=bff7650c flags=98800 mode=bff7450c perf-1405 [000] 0.000000: myprobe: (c04b0a5c) dfd=ffffff9c filename=bff7650c flags=8000 mode=1b6 (Step.5) You can also use return probes. $ perf record -f -e mygroup:myretprobe:record -F 1 -a ls ... [ perf record: Captured and wrote 0.081 MB perf.data (~3544 samples) ] $ perf trace version = 0.5 perf-1408 [000] 0.000000: myretprobe: (c04b0a5c <- c04b0b7d) rv=b perf-1408 [000] 0.000000: myretprobe: (c04b0a5c <- c04b0b7d) rv=c perf-1408 [000] 0.000000: myretprobe: (c04b0a5c <- c04b0b7d) rv=d perf-1408 [000] 0.000000: myretprobe: (c04b0a5c <- c04b0b7d) rv=c TODO: - Implement perf kprobe command to help defining new probes. Thank you, --- Masami Hiramatsu (7): tracing/kprobes: Support custom subsystem for each kprobe event tracing/kprobes: Show event name in trace output tracing/kprobes: Add argument name support tracing/kprobes: Add event profiling support tracing/kprobes: Cleanup kprobe tracer code. tracing/kprobes: Fix probe offset to be unsigned x86/ptrace: Fix regs_get_argument_nth() to add correct offset Documentation/trace/kprobetrace.txt | 65 +++--- arch/x86/kernel/ptrace.c | 2 kernel/trace/trace_kprobe.c | 369 +++++++++++++++++++++++------------ 3 files changed, 274 insertions(+), 162 deletions(-) -- Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: mhiramat@redhat.com