linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v7 3.2-rc2 0/30] uprobes patchset with perf probe support
@ 2011-11-18 11:06 Srikar Dronamraju
  2011-11-18 11:06 ` [PATCH v7 3.2-rc2 1/30] uprobes: Auxillary routines to insert, find, delete uprobes Srikar Dronamraju
                   ` (31 more replies)
  0 siblings, 32 replies; 106+ messages in thread
From: Srikar Dronamraju @ 2011-11-18 11:06 UTC (permalink / raw)
  To: Peter Zijlstra, Linus Torvalds
  Cc: Oleg Nesterov, Andrew Morton, LKML, Linux-mm, Ingo Molnar,
	Andi Kleen, Christoph Hellwig, Steven Rostedt, Roland McGrath,
	Thomas Gleixner, Masami Hiramatsu, Arnaldo Carvalho de Melo,
	Anton Arapov, Ananth N Mavinakayanahalli, Jim Keniston,
	Stephen Wilson


This patchset implements Uprobes which enables you to dynamically probe
any routine in a user space application and collect information
non-disruptively.

This patchset resolves most of the comments on the previous posting
(https://lkml.org/lkml/2011/11/10/408) patchset applies on top of
commit cfcfc9eca2b

This patchset depends on bulkref patch from Paul McKenney
https://lkml.org/lkml/2011/11/2/365 and enable interrupts before
calling do_notify_resume on i686 patch
https://lkml.org/lkml/2011/10/25/265.

uprobes git is hosted at git://github.com/srikard/linux.git
with branch inode_uprobes_v32rc2.
(The previous patchset posted to lkml has been rebased to 3.2-rc2 is also
available at branch inode_uprobes_v32rc2_prev. This is to help the
reviewers of the previous patchsets to quickly identify the changes.)

Uprobes Patches
This patchset implements inode based uprobes which are specified as
<file>:<offset> where offset is the offset from start of the map.

When a uprobe is registered, Uprobes makes a copy of the probed
instruction, replaces the first byte(s) of the probed instruction with a
breakpoint instruction. (Uprobes uses background page replacement
mechanism and ensures that the breakpoint affects only that process.)

When a CPU hits the breakpoint instruction, Uprobes gets notified of
trap and finds the associated uprobe. It then executes the associated
handler. Uprobes single-steps its copy of the probed instruction and
resumes execution of the probed process at the instruction following the
probepoint. Instruction copies to be single-stepped are stored in a
per-mm "execution out of line (XOL) area". Currently XOL area is
allocated as one page vma.

For previous postings: please refer: https://lkml.org/lkml/2011/9/20/123
https://lkml.org/lkml/2011/6/7/232 https://lkml.org/lkml/2011/4/1/176
http://lkml.org/lkml/2011/3/14/171/ http://lkml.org/lkml/2010/12/16/65
http://lkml.org/lkml/2010/8/25/165 http://lkml.org/lkml/2010/7/27/121
http://lkml.org/lkml/2010/7/12/67 http://lkml.org/lkml/2010/7/8/239
http://lkml.org/lkml/2010/6/29/299 http://lkml.org/lkml/2010/6/14/41
http://lkml.org/lkml/2010/3/20/107 and http://lkml.org/lkml/2010/5/18/307

This patchset is a rework based on suggestions from discussions on lkml
in September, March and January 2010 (http://lkml.org/lkml/2010/1/11/92,
http://lkml.org/lkml/2010/1/27/19, http://lkml.org/lkml/2010/3/20/107
and http://lkml.org/lkml/2010/3/31/199 ). This implementation of uprobes
doesnt depend on utrace.

Advantages of uprobes over conventional debugging include:

1. Non-disruptive.
Unlike current ptrace based mechanisms, uprobes tracing wouldnt
involve signals, stopping threads and context switching between the
tracer and tracee.

2. Much better handling of multithreaded programs because of XOL.
Current ptrace based mechanisms use single stepping inline, i.e they
copy back the original instruction on hitting a breakpoint.  In such
mechanisms tracers have to stop all the threads on a breakpoint hit or
tracers will not be able to handle all hits to the location of
interest. Uprobes uses execution out of line, where the instruction to
be traced is analysed at the time of breakpoint insertion and a copy
of instruction is stored at a different location.  On breakpoint hit,
uprobes jumps to that copied location and singlesteps the same
instruction and does the necessary fixups post singlestepping.

3. Multiple tracers for an application.
Multiple uprobes based tracer could work in unison to trace an
application. There could one tracer that could be interested in
generic events for a particular set of process. While there could be
another tracer that is just interested in one specific event of a
particular process thats part of the previous set of process.

4. Corelating events from kernels and userspace.
Uprobes could be used with other tools like kprobes, tracepoints or as
part of higher level tools like perf to give a consolidated set of
events from kernel and userspace.  In future we could look at a single
backtrace showing application, library and kernel calls.

Changes from last patchset:
- Rebased to Linus's 3.2-rc2 (cfcfc9eca2b)
- abort_xol does arch specific cleanups.
- added nop optimization.

Here is the list of TODO Items.

- Prefiltering (i.e filtering at the time of probe insertion)
- Return probes.
- Support for other architectures.
- Uprobes booster.
- replace macro W with bits in inat table.

Please refer "[PATCH 3.2-rc2 21/30] tracing: uprobes trace_event interface".

Please refer "[PATCH 3.2-rc2 23/30] perf: perf interface for uprobes".

Please do provide your valuable comments.

Thanks in advance.
Srikar

Srikar Dronamraju (30)
 0: Uprobes patchset with perf probe support
 1: uprobes: Auxillary routines to insert, find, delete uprobes
 2: Uprobes: Allow multiple consumers for an uprobe.
 3: Uprobes: register/unregister probes.
 4: uprobes: Define hooks for mmap/munmap.
 5: Uprobes: copy of the original instruction.
 6: Uprobes: define fixups.
 7: Uprobes: uprobes arch info
 8: x86: analyze instruction and determine fixups.
 9: Uprobes: Background page replacement.
10: x86: Set instruction pointer.
11: x86: Introduce TIF_UPROBE FLAG.
12: Uprobes: Handle breakpoint and Singlestep
13: x86: define a x86 specific exception notifier.
14: uprobe: register exception notifier
15: x86: Define x86_64 specific uprobe_task_arch_info structure
16: uprobes: Introduce uprobe_task_arch_info structure.
17: x86: arch specific hooks for pre/post singlestep handling.
18: uprobes: slot allocation.
19: tracing: modify is_delete, is_return from ints to bool.
20: tracing: Extract out common code for kprobes/uprobes traceevents.
21: tracing: uprobes trace_event interface
22: perf: rename target_module to target
23: perf: perf interface for uprobes
24: perf: show possible probes in a given executable file or library.
25: uprobes: call post_xol() unconditionally
26: uprobes: introduce uprobe_deny_signal()
27: uprobes: x86: introduce xol_was_trapped()
28: uprobes: introduce UTASK_SSTEP_TRAPPED logic
29: uprobes: Introduce uprobe flags
30: x86: skip singlestep where possible


 Documentation/trace/uprobetracer.txt    |   93 ++
 arch/Kconfig                            |    3 +
 arch/x86/Kconfig                        |    5 +-
 arch/x86/include/asm/thread_info.h      |    2 +
 arch/x86/include/asm/uprobes.h          |   59 ++
 arch/x86/kernel/Makefile                |    1 +
 arch/x86/kernel/signal.c                |    6 +
 arch/x86/kernel/uprobes.c               |  648 +++++++++++++
 include/linux/mm_types.h                |    5 +
 include/linux/sched.h                   |    4 +
 include/linux/uprobes.h                 |  178 ++++
 kernel/Makefile                         |    1 +
 kernel/fork.c                           |   15 +
 kernel/signal.c                         |    3 +
 kernel/trace/Kconfig                    |   20 +
 kernel/trace/Makefile                   |    2 +
 kernel/trace/trace.h                    |    5 +
 kernel/trace/trace_kprobe.c             |  899 +------------------
 kernel/trace/trace_probe.c              |  785 ++++++++++++++++
 kernel/trace/trace_probe.h              |  161 ++++
 kernel/trace/trace_uprobe.c             |  768 ++++++++++++++++
 kernel/uprobes.c                        | 1500 +++++++++++++++++++++++++++++++
 mm/mmap.c                               |   33 +-
 tools/perf/Documentation/perf-probe.txt |   14 +
 tools/perf/builtin-probe.c              |   49 +-
 tools/perf/util/probe-event.c           |  411 +++++++--
 tools/perf/util/probe-event.h           |   12 +-
 tools/perf/util/symbol.c                |    8 +
 tools/perf/util/symbol.h                |    1 +
 29 files changed, 4710 insertions(+), 981 deletions(-)


^ permalink raw reply	[flat|nested] 106+ messages in thread

end of thread, other threads:[~2011-12-12 17:36 UTC | newest]

Thread overview: 106+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-18 11:06 [PATCH v7 3.2-rc2 0/30] uprobes patchset with perf probe support Srikar Dronamraju
2011-11-18 11:06 ` [PATCH v7 3.2-rc2 1/30] uprobes: Auxillary routines to insert, find, delete uprobes Srikar Dronamraju
2011-11-23 18:23   ` Peter Zijlstra
2011-11-18 11:07 ` [PATCH v7 3.2-rc2 2/30] uprobes: Allow multiple consumers for an uprobe Srikar Dronamraju
2011-11-18 11:07 ` [PATCH v7 3.2-rc2 3/30] uprobes: register/unregister probes Srikar Dronamraju
2011-11-23 16:09   ` Peter Zijlstra
2011-11-23 16:11     ` Peter Zijlstra
2011-11-24 14:39     ` Srikar Dronamraju
2011-11-23 16:22   ` Peter Zijlstra
2011-11-23 16:27   ` Peter Zijlstra
2011-11-23 16:35   ` Peter Zijlstra
2011-11-28 15:29   ` Peter Zijlstra
2011-11-29  7:48     ` Srikar Dronamraju
2011-11-29 10:52       ` Peter Zijlstra
2011-12-01 13:41         ` Srikar Dronamraju
2011-12-01 13:20   ` Peter Zijlstra
2011-11-18 11:07 ` [PATCH v7 3.2-rc2 4/30] uprobes: Define hooks for mmap/munmap Srikar Dronamraju
2011-11-23 17:13   ` Peter Zijlstra
2011-11-23 18:10   ` Peter Zijlstra
2011-11-24 13:47     ` Srikar Dronamraju
2011-11-24 14:13       ` Peter Zijlstra
2011-11-24 14:25         ` Srikar Dronamraju
2011-11-28 14:59       ` Peter Zijlstra
2011-11-29  8:33         ` Srikar Dronamraju
2011-11-29 11:48           ` Peter Zijlstra
2011-11-29 15:05             ` Peter Zijlstra
2011-11-30  5:50               ` Srikar Dronamraju
2011-11-29 16:22             ` Srikar Dronamraju
2011-11-30 12:25               ` Peter Zijlstra
2011-12-01  5:40                 ` Srikar Dronamraju
2011-12-01 11:36                   ` Peter Zijlstra
2011-12-01 13:24                     ` Srikar Dronamraju
2011-11-30  5:30           ` Srikar Dronamraju
2011-11-23 18:15   ` Peter Zijlstra
2011-11-23 19:50     ` Steven Rostedt
2011-11-24 13:37     ` Srikar Dronamraju
2011-11-24 13:47       ` Peter Zijlstra
2011-11-18 11:07 ` [PATCH v7 3.2-rc2 5/30] uprobes: copy of the original instruction Srikar Dronamraju
2011-11-23 18:26   ` Peter Zijlstra
2011-11-23 18:40   ` Peter Zijlstra
2011-11-23 19:49     ` Steven Rostedt
2011-11-23 20:52       ` Peter Zijlstra
2011-11-24 12:50     ` Srikar Dronamraju
2011-11-28 14:23   ` Peter Zijlstra
2011-11-18 11:07 ` [PATCH v7 3.2-rc2 6/30] uprobes: define fixups Srikar Dronamraju
2011-11-18 11:07 ` [PATCH v7 3.2-rc2 7/30] uprobes: uprobes arch info Srikar Dronamraju
2011-11-18 11:08 ` [PATCH v7 3.2-rc2 8/30] x86: analyze instruction and determine fixups Srikar Dronamraju
2011-11-30 18:57   ` Oleg Nesterov
2011-12-01  5:52     ` Srikar Dronamraju
2011-11-18 11:08 ` [PATCH v7 3.2-rc2 9/30] uprobes: Background page replacement Srikar Dronamraju
2011-11-25 14:29   ` Peter Zijlstra
2011-11-25 14:54   ` Peter Zijlstra
2011-11-26  2:25     ` Srikar Dronamraju
2011-11-28 14:13   ` Peter Zijlstra
2011-11-29  7:49     ` Srikar Dronamraju
2011-11-28 15:01   ` Peter Zijlstra
2011-11-18 11:08 ` [PATCH v7 3.2-rc2 10/30] x86: Set instruction pointer Srikar Dronamraju
2011-11-18 11:08 ` [PATCH v7 3.2-rc2 11/30] x86: Introduce TIF_UPROBE FLAG Srikar Dronamraju
2011-11-18 11:09 ` [PATCH v7 3.2-rc2 12/30] uprobes: Handle breakpoint and Singlestep Srikar Dronamraju
2011-11-25 15:24   ` Peter Zijlstra
2011-11-26  2:22     ` Srikar Dronamraju
2011-11-18 11:09 ` [PATCH v7 3.2-rc2 13/30] x86: define a x86 specific exception notifier Srikar Dronamraju
2011-11-18 11:09 ` [PATCH v7 3.2-rc2 14/30] uprobe: register " Srikar Dronamraju
2011-11-18 11:09 ` [PATCH v7 3.2-rc2 15/30] x86: Define x86_64 specific uprobe_task_arch_info structure Srikar Dronamraju
2011-11-18 11:09 ` [PATCH v7 3.2-rc2 16/30] uprobes: Introduce " Srikar Dronamraju
2011-11-18 11:09 ` [PATCH v7 3.2-rc2 17/30] x86: arch specific hooks for pre/post singlestep handling Srikar Dronamraju
2011-11-18 11:10 ` [PATCH v7 3.2-rc2 18/30] uprobes: slot allocation Srikar Dronamraju
2011-11-18 11:10 ` [PATCH v7 3.2-rc2 19/30] tracing: modify is_delete, is_return from ints to bool Srikar Dronamraju
2011-11-23 19:24   ` Steven Rostedt
2011-11-18 11:10 ` [PATCH v7 3.2-rc2 20/30] tracing: Extract out common code for kprobes/uprobes traceevents Srikar Dronamraju
2011-11-23 19:32   ` Steven Rostedt
2011-11-24 13:12     ` Srikar Dronamraju
2011-11-18 11:10 ` [PATCH v7 3.2-rc2 21/30] tracing: uprobes trace_event interface Srikar Dronamraju
2011-11-18 11:10 ` [PATCH v7 3.2-rc2 22/30] perf: rename target_module to target Srikar Dronamraju
2011-11-18 11:11 ` [PATCH v7 3.2-rc2 23/30] perf: perf interface for uprobes Srikar Dronamraju
2011-11-18 11:11 ` [PATCH v7 3.2-rc2 24/30] perf: show possible probes in a given executable file or library Srikar Dronamraju
2011-11-18 11:11 ` [PATCH v7 3.2-rc2 25/30] uprobes: call post_xol() unconditionally Srikar Dronamraju
2011-11-18 11:11 ` [PATCH v7 3.2-rc2 26/30] uprobes: introduce uprobe_deny_signal() Srikar Dronamraju
2011-11-18 11:12 ` [PATCH v7 3.2-rc2 27/30] uprobes: x86: introduce xol_was_trapped() Srikar Dronamraju
2011-11-18 11:12 ` [PATCH v7 3.2-rc2 28/30] uprobes: introduce UTASK_SSTEP_TRAPPED logic Srikar Dronamraju
2011-11-18 11:12 ` [PATCH v7 3.2-rc2 29/30] uprobes: Introduce uprobe flags Srikar Dronamraju
2011-11-18 11:12 ` [PATCH v7 3.2-rc2 30/30] x86: skip singlestep where possible Srikar Dronamraju
2011-11-22  5:03 ` [PATCH v7 3.2-rc2 0/30] uprobes patchset with perf probe support Srikar Dronamraju
2011-11-22 14:49   ` Stephen Rothwell
2011-11-23 13:20     ` Srikar Dronamraju
2011-11-23 13:38       ` Stephen Rothwell
2011-11-28 19:06 ` [PATCH RFC 0/5] uprobes: kill xol vma Oleg Nesterov
2011-11-28 19:06   ` [PATCH 1/5] uprobes: kill pre_ssout(), introduce set_xol_ip() Oleg Nesterov
2011-11-28 19:06   ` [PATCH 2/5] uprobes: introduce uprobe_switch_to() Oleg Nesterov
2011-11-28 19:53     ` Peter Zijlstra
2011-11-29 17:18       ` Oleg Nesterov
2011-11-30 12:11         ` Peter Zijlstra
2011-11-30 17:10           ` Oleg Nesterov
2011-11-28 19:07   ` [PATCH 3/5] uprobes: introduce uprobe_xol_slots[NR_CPUS] Oleg Nesterov
2011-11-28 19:48     ` Peter Zijlstra
2011-11-28 19:52       ` Peter Zijlstra
2011-11-29 18:24     ` Oleg Nesterov
2011-11-28 19:07   ` [PATCH 4/5] uprobes: teach set_xol_ip() to use uprobe_xol_slots[] Oleg Nesterov
2011-11-28 19:07   ` [PATCH 5/5] uprobes: remove the uprobes_xol_area code Oleg Nesterov
2011-11-28 19:57   ` [PATCH RFC 0/5] uprobes: kill xol vma Peter Zijlstra
2011-11-29 10:30   ` Srikar Dronamraju
2011-11-29 18:26     ` Oleg Nesterov
2011-11-30 16:15       ` Andi Kleen
2011-11-30 16:20         ` Peter Zijlstra
2011-11-30 18:47           ` Oleg Nesterov
2011-12-12 17:30   ` Oleg Nesterov

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).