All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 2.6.38-rc8-tip 0/20]  0: Inode based uprobes
@ 2011-03-14 13:34 ` Srikar Dronamraju
  0 siblings, 0 replies; 200+ messages in thread
From: Srikar Dronamraju @ 2011-03-14 13:34 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar
  Cc: Steven Rostedt, Srikar Dronamraju, Linux-mm,
	Arnaldo Carvalho de Melo, Linus Torvalds, Masami Hiramatsu,
	Christoph Hellwig, Ananth N Mavinakayanahalli, Andi Kleen,
	Oleg Nesterov, Andrew Morton, Jim Keniston, Roland McGrath,
	SystemTap, LKML, Paul E. McKenney


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

This patchset resolves most of the comments from Peter on the previous
posting https://lkml.org/lkml/2010/12/16/65.

Uprobes Patches
This patchset implements inode based uprobes which are specified as
<file>:<offset> where offset is the offset from start of the map.
The probehit overhead is around 3X times the overhead from pid based
patchset.

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 posting: please refer: 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.

Here is the list of TODO Items.

- Integrating perf probe with this patchset.
- Breakpoint handling should co-exist with singlestep/blockstep from
  another tracer/debugger.
- Queue and dequeue signals delivered from the singlestep till
  completion of postprocessing.
- 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.

To try please fetch using
git fetch \
git://git.kernel.org/pub/scm/linux/kernel/git/srikar/linux-uprobes.git \
tip_inode_uprobes_140311:tip_inode_uprobes

Please refer "[RFC] [PATCH 2.6.37-rc5-tip 20/20] 20: tracing: uprobes
trace_event infrastructure" on how to use uprobe_tracer.

Please do provide your valuable comments.

Thanks in advance.
Srikar

 Srikar Dronamraju(20)
 0: Inode based uprobes
 1: mm: Move replace_page() to mm/memory.c
 2: X86 specific breakpoint definitions.
 3: uprobes: Breakground page replacement.
 4: uprobes: Adding and remove a uprobe in a rb tree.
 5: Uprobes: register/unregister probes.
 6: x86: analyze instruction and determine fixups.
 7: uprobes: store/restore original instruction.
 8: uprobes: mmap and fork hooks.
 9: x86: architecture specific task information.
10: uprobes: task specific information.
11: uprobes: slot allocation for uprobes
12: uprobes: get the breakpoint address.
13: x86: x86 specific probe handling
14: uprobes: Handing int3 and singlestep exception.
15: x86: uprobes exception notifier for x86.
16: uprobes: register a notifier for uprobes.
17: uprobes: filter chain
18: uprobes: commonly used filters.
19: tracing: Extract out common code for kprobes/uprobes traceevents.
20: tracing: uprobes trace_event interface

 arch/Kconfig                       |    4 +
 arch/x86/Kconfig                   |    3 +
 arch/x86/include/asm/thread_info.h |    2 +
 arch/x86/include/asm/uprobes.h     |   58 ++
 arch/x86/kernel/Makefile           |    1 +
 arch/x86/kernel/signal.c           |   14 +
 arch/x86/kernel/uprobes.c          |  600 ++++++++++++++++
 include/linux/mm.h                 |    2 +
 include/linux/mm_types.h           |    9 +
 include/linux/sched.h              |    3 +
 include/linux/uprobes.h            |  183 +++++
 kernel/Makefile                    |    1 +
 kernel/fork.c                      |   10 +
 kernel/trace/Kconfig               |   20 +
 kernel/trace/Makefile              |    2 +
 kernel/trace/trace.h               |    5 +
 kernel/trace/trace_kprobe.c        |  861 +-----------------------
 kernel/trace/trace_probe.c         |  753 ++++++++++++++++++++
 kernel/trace/trace_probe.h         |  160 +++++
 kernel/trace/trace_uprobe.c        |  800 ++++++++++++++++++++++
 kernel/uprobes.c                   | 1331 ++++++++++++++++++++++++++++++++++++
 mm/ksm.c                           |   62 --
 mm/memory.c                        |   62 ++
 mm/mmap.c                          |    2 +
 24 files changed, 4044 insertions(+), 904 deletions(-)

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

end of thread, other threads:[~2011-03-18 22:11 UTC | newest]

Thread overview: 200+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-14 13:34 [PATCH v2 2.6.38-rc8-tip 0/20] 0: Inode based uprobes Srikar Dronamraju
2011-03-14 13:34 ` Srikar Dronamraju
2011-03-14 13:34 ` [PATCH v2 2.6.38-rc8-tip 1/20] 1: mm: Move replace_page() to mm/memory.c Srikar Dronamraju
2011-03-14 13:34   ` Srikar Dronamraju
2011-03-14 14:16   ` Steven Rostedt
2011-03-14 14:16     ` Steven Rostedt
2011-03-14 17:02     ` Srikar Dronamraju
2011-03-14 17:02       ` Srikar Dronamraju
2011-03-14 17:13       ` Steven Rostedt
2011-03-14 17:13         ` Steven Rostedt
2011-03-14 17:29         ` Srikar Dronamraju
2011-03-14 17:29           ` Srikar Dronamraju
2011-03-14 13:34 ` [PATCH v2 2.6.38-rc8-tip 2/20] 2: X86 specific breakpoint definitions Srikar Dronamraju
2011-03-14 13:34   ` Srikar Dronamraju
2011-03-14 13:34 ` [PATCH v2 2.6.38-rc8-tip 3/20] 3: uprobes: Breakground page replacement Srikar Dronamraju
2011-03-14 13:34   ` Srikar Dronamraju
2011-03-14 15:29   ` Steven Rostedt
2011-03-14 15:29     ` Steven Rostedt
2011-03-14 15:38   ` Steven Rostedt
2011-03-14 15:38     ` Steven Rostedt
2011-03-14 17:24     ` Srikar Dronamraju
2011-03-14 17:24       ` Srikar Dronamraju
2011-03-14 18:21       ` Steven Rostedt
2011-03-14 18:21         ` Steven Rostedt
2011-03-14 18:22       ` Steven Rostedt
2011-03-14 18:22         ` Steven Rostedt
2011-03-14 16:58   ` Stephen Wilson
2011-03-14 16:58     ` Stephen Wilson
2011-03-14 17:30     ` Srikar Dronamraju
2011-03-14 17:30       ` Srikar Dronamraju
2011-03-15 13:22   ` Thomas Gleixner
2011-03-15 13:22     ` Thomas Gleixner
2011-03-15 17:51     ` Srikar Dronamraju
2011-03-15 17:51       ` Srikar Dronamraju
2011-03-15 18:03       ` Thomas Gleixner
2011-03-15 18:03         ` Thomas Gleixner
2011-03-15 18:07         ` Srikar Dronamraju
2011-03-15 18:07           ` Srikar Dronamraju
2011-03-14 13:34 ` [PATCH v2 2.6.38-rc8-tip 4/20] 4: uprobes: Adding and remove a uprobe in a rb tree Srikar Dronamraju
2011-03-14 13:34   ` Srikar Dronamraju
2011-03-15 13:38   ` Thomas Gleixner
2011-03-15 13:38     ` Thomas Gleixner
2011-03-15 13:43     ` Steven Rostedt
2011-03-15 13:43       ` Steven Rostedt
2011-03-15 17:30     ` Srikar Dronamraju
2011-03-15 17:30       ` Srikar Dronamraju
2011-03-15 19:22       ` Thomas Gleixner
2011-03-15 19:22         ` Thomas Gleixner
2011-03-15 19:48         ` Peter Zijlstra
2011-03-15 19:48           ` Peter Zijlstra
2011-03-15 22:42           ` Eric Dumazet
2011-03-15 22:42             ` Eric Dumazet
2011-03-16  7:54             ` Peter Zijlstra
2011-03-16  7:54               ` Peter Zijlstra
2011-03-14 13:34 ` [PATCH v2 2.6.38-rc8-tip 5/20] 5: Uprobes: register/unregister probes Srikar Dronamraju
2011-03-14 13:34   ` Srikar Dronamraju
2011-03-14 16:00   ` Steven Rostedt
2011-03-14 16:00     ` Steven Rostedt
2011-03-14 17:32     ` Srikar Dronamraju
2011-03-14 17:32       ` Srikar Dronamraju
2011-03-15 14:28   ` Thomas Gleixner
2011-03-15 14:28     ` Thomas Gleixner
2011-03-15 17:15     ` Srikar Dronamraju
2011-03-15 17:15       ` Srikar Dronamraju
2011-03-15 17:47       ` Steven Rostedt
2011-03-15 17:47         ` Steven Rostedt
2011-03-15 17:50         ` Peter Zijlstra
2011-03-15 17:50           ` Peter Zijlstra
2011-03-15 18:04           ` Srikar Dronamraju
2011-03-15 18:04             ` Srikar Dronamraju
2011-03-15 18:15             ` Peter Zijlstra
2011-03-15 18:15               ` Peter Zijlstra
2011-03-18 18:53               ` Srikar Dronamraju
2011-03-18 18:53                 ` Srikar Dronamraju
2011-03-15 18:15       ` Thomas Gleixner
2011-03-15 18:15         ` Thomas Gleixner
2011-03-14 13:35 ` [PATCH v2 2.6.38-rc8-tip 6/20] 6: x86: analyze instruction and determine fixups Srikar Dronamraju
2011-03-14 13:35   ` Srikar Dronamraju
2011-03-15 14:36   ` Thomas Gleixner
2011-03-15 14:36     ` Thomas Gleixner
2011-03-18 18:24     ` Srikar Dronamraju
2011-03-18 18:24       ` Srikar Dronamraju
2011-03-18 18:36       ` Roland McGrath
2011-03-18 18:36         ` Roland McGrath
2011-03-18 18:49         ` Srikar Dronamraju
2011-03-18 18:49           ` Srikar Dronamraju
2011-03-18 19:07           ` Srikar Dronamraju
2011-03-18 19:07             ` Srikar Dronamraju
2011-03-18 19:10           ` Roland McGrath
2011-03-18 19:10             ` Roland McGrath
2011-03-14 13:35 ` [PATCH v2 2.6.38-rc8-tip 7/20] 7: uprobes: store/restore original instruction Srikar Dronamraju
2011-03-14 13:35   ` Srikar Dronamraju
2011-03-14 18:09   ` Stephen Wilson
2011-03-14 18:09     ` Stephen Wilson
2011-03-15  9:22     ` Srikar Dronamraju
2011-03-15  9:22       ` Srikar Dronamraju
2011-03-15 13:47       ` Steven Rostedt
2011-03-15 13:47         ` Steven Rostedt
2011-03-15 16:15         ` Stephen Wilson
2011-03-15 16:15           ` Stephen Wilson
2011-03-15 16:17           ` Srikar Dronamraju
2011-03-15 16:17             ` Srikar Dronamraju
2011-03-15 16:21           ` Steven Rostedt
2011-03-15 16:21             ` Steven Rostedt
2011-03-15 17:57       ` Peter Zijlstra
2011-03-15 17:57         ` Peter Zijlstra
2011-03-15 18:58         ` Balbir Singh
2011-03-15 18:58           ` Balbir Singh
2011-03-15 19:30           ` Peter Zijlstra
2011-03-15 19:30             ` Peter Zijlstra
2011-03-15 19:32             ` Steven Rostedt
2011-03-15 19:32               ` Steven Rostedt
2011-03-16  5:51               ` Balbir Singh
2011-03-16  5:51                 ` Balbir Singh
2011-03-16 17:40                 ` Steven Rostedt
2011-03-16 17:40                   ` Steven Rostedt
2011-03-15 14:41   ` Thomas Gleixner
2011-03-15 14:41     ` Thomas Gleixner
2011-03-15 16:25     ` Srikar Dronamraju
2011-03-15 16:25       ` Srikar Dronamraju
2011-03-14 13:35 ` [PATCH v2 2.6.38-rc8-tip 8/20] 8: uprobes: mmap and fork hooks Srikar Dronamraju
2011-03-14 13:35   ` Srikar Dronamraju
2011-03-14 13:35 ` [PATCH v2 2.6.38-rc8-tip 9/20] 9: x86: architecture specific task information Srikar Dronamraju
2011-03-14 13:35   ` Srikar Dronamraju
2011-03-14 13:36 ` [PATCH v2 2.6.38-rc8-tip 10/20] 10: uprobes: task specific information Srikar Dronamraju
2011-03-14 13:36   ` Srikar Dronamraju
2011-03-14 13:36 ` [PATCH v2 2.6.38-rc8-tip 11/20] 11: uprobes: slot allocation for uprobes Srikar Dronamraju
2011-03-14 13:36   ` Srikar Dronamraju
2011-03-15 19:10   ` Jonathan Corbet
2011-03-15 19:10     ` Jonathan Corbet
2011-03-16  4:58     ` Srikar Dronamraju
2011-03-16  4:58       ` Srikar Dronamraju
2011-03-15 20:31   ` Stephen Wilson
2011-03-15 20:31     ` Stephen Wilson
2011-03-16  4:50     ` Srikar Dronamraju
2011-03-16  4:50       ` Srikar Dronamraju
2011-03-14 13:36 ` [PATCH v2 2.6.38-rc8-tip 12/20] 12: uprobes: get the breakpoint address Srikar Dronamraju
2011-03-14 13:36   ` Srikar Dronamraju
2011-03-14 13:36 ` [PATCH v2 2.6.38-rc8-tip 13/20] 13: x86: x86 specific probe handling Srikar Dronamraju
2011-03-14 13:36   ` Srikar Dronamraju
2011-03-14 13:36 ` [PATCH v2 2.6.38-rc8-tip 14/20] 14: uprobes: Handing int3 and singlestep exception Srikar Dronamraju
2011-03-14 13:36   ` Srikar Dronamraju
2011-03-14 13:36 ` [PATCH v2 2.6.38-rc8-tip 15/20] 15: x86: uprobes exception notifier for x86 Srikar Dronamraju
2011-03-14 13:36   ` Srikar Dronamraju
2011-03-14 13:37 ` [PATCH v2 2.6.38-rc8-tip 16/20] 16: uprobes: register a notifier for uprobes Srikar Dronamraju
2011-03-14 13:37   ` Srikar Dronamraju
2011-03-15 19:56   ` Stephen Wilson
2011-03-15 19:56     ` Stephen Wilson
2011-03-18 19:28     ` Srikar Dronamraju
2011-03-18 19:28       ` Srikar Dronamraju
2011-03-14 13:37 ` [PATCH v2 2.6.38-rc8-tip 17/20] 17: uprobes: filter chain Srikar Dronamraju
2011-03-14 13:37   ` Srikar Dronamraju
2011-03-15 19:49   ` Stephen Wilson
2011-03-15 19:49     ` Stephen Wilson
2011-03-18 19:16     ` Srikar Dronamraju
2011-03-18 19:16       ` Srikar Dronamraju
2011-03-18 22:10       ` Stephen Wilson
2011-03-18 22:10         ` Stephen Wilson
2011-03-14 13:37 ` [PATCH v2 2.6.38-rc8-tip 18/20] 18: uprobes: commonly used filters Srikar Dronamraju
2011-03-14 13:37   ` Srikar Dronamraju
2011-03-14 13:37 ` [PATCH v2 2.6.38-rc8-tip 19/20] 19: tracing: Extract out common code for kprobes/uprobes traceevents Srikar Dronamraju
2011-03-14 13:37   ` Srikar Dronamraju
2011-03-14 13:37 ` [PATCH v2 2.6.38-rc8-tip 20/20] 20: tracing: uprobes trace_event interface Srikar Dronamraju
2011-03-14 13:37   ` Srikar Dronamraju
2011-03-14 23:30 ` [PATCH v2 2.6.38-rc8-tip 0/20] 0: Inode based uprobes Andrew Morton
2011-03-14 23:30   ` Andrew Morton
2011-03-14 23:47   ` Andi Kleen
2011-03-14 23:47     ` Andi Kleen
2011-03-15  0:22     ` Thomas Gleixner
2011-03-15  0:22       ` Thomas Gleixner
2011-03-15 18:06       ` Andi Kleen
2011-03-15 18:06         ` Andi Kleen
2011-03-15 19:43         ` Thomas Gleixner
2011-03-15 19:43           ` Thomas Gleixner
2011-03-15 20:01           ` Steven Rostedt
2011-03-15 20:01             ` Steven Rostedt
2011-03-15 20:09             ` Thomas Gleixner
2011-03-15 20:09               ` Thomas Gleixner
2011-03-15 20:44               ` Steven Rostedt
2011-03-15 20:44                 ` Steven Rostedt
2011-03-16 17:32                 ` Tom Tromey
2011-03-16 17:32                   ` Tom Tromey
2011-03-16 17:44                   ` Steven Rostedt
2011-03-16 17:44                     ` Steven Rostedt
2011-03-16 17:27               ` Tom Tromey
2011-03-16 17:27                 ` Tom Tromey
2011-03-15  1:13   ` Frank Ch. Eigler
2011-03-15  1:13     ` Frank Ch. Eigler
2011-03-15  1:35     ` Thomas Gleixner
2011-03-15  1:35       ` Thomas Gleixner
2011-03-15  5:21       ` Srikar Dronamraju
2011-03-15  5:21         ` Srikar Dronamraju
2011-03-15 11:02         ` Thomas Gleixner
2011-03-15 11:02           ` Thomas Gleixner
2011-03-15 11:37           ` Srikar Dronamraju
2011-03-15 11:37             ` Srikar Dronamraju
2011-03-15  1:57   ` Srikar Dronamraju
2011-03-15  1:57     ` Srikar Dronamraju
2011-03-15  2:52   ` Steven Rostedt
2011-03-15  2:52     ` Steven Rostedt

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.