linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 3.1.0-rc4-tip 0/26]   Uprobes patchset with perf probe support
@ 2011-09-20 11:59 Srikar Dronamraju
  2011-09-20 11:59 ` [PATCH v5 3.1.0-rc4-tip 1/26] uprobes: Auxillary routines to insert, find, delete uprobes Srikar Dronamraju
                   ` (27 more replies)
  0 siblings, 28 replies; 160+ messages in thread
From: Srikar Dronamraju @ 2011-09-20 11:59 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar
  Cc: Steven Rostedt, Srikar Dronamraju, Linux-mm,
	Arnaldo Carvalho de Melo, Linus Torvalds, Jonathan Corbet,
	Masami Hiramatsu, Hugh Dickins, Christoph Hellwig,
	Ananth N Mavinakayanahalli, Thomas Gleixner, Andi Kleen,
	Oleg Nesterov, Andrew Morton, Jim Keniston, Roland McGrath, LKML


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 on the previous posting
(https://lkml.org/lkml/2011/6/7/232) patchset applies on top of tip
commit e467f18f945c83e66

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/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:
- mmap_uprobe doesnt drop mmap_sem anymore
- Introduced uprobes_mmap_mutex to serialize mmap_uprobes.
- Uses i_mutex instead of uprobes_mutex.
- Introduces munmap_uprobes
- Change in perf probe interface as recommended by Masami.
- Doesnt depend on get_user_pages to do the COW.
- Slot allocation changed from per-task to shared slot allocation mechanism.

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 "[RFC] [PATCH 3.1-rc4-tip 21/26] tracing: tracing: Uprobe
tracer documentation" on how to use uprobe_tracer.

Please refer "[RFC] [PATCH 3.1-rc4-tip 25/26] perf: Documentation for perf
uprobes" on how to use uprobe_tracer.

Please do provide your valuable comments.

Thanks in advance.
Srikar
---
 0 files changed, 0 insertions(+), 0 deletions(-)


Srikar Dronamraju (26)
 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: Extract out common code for kprobes/uprobes traceevents.
20: tracing: uprobes trace_event interface
21: tracing: uprobes Documentation
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: perf: Documentation for perf uprobes
26: uprobes: queue signals while thread is singlestepping.


 Documentation/trace/uprobetracer.txt    |   94 ++
 arch/Kconfig                            |    4 +
 arch/x86/Kconfig                        |    3 +
 arch/x86/include/asm/thread_info.h      |    2 +
 arch/x86/include/asm/uprobes.h          |   54 ++
 arch/x86/kernel/Makefile                |    1 +
 arch/x86/kernel/signal.c                |   14 +
 arch/x86/kernel/uprobes.c               |  562 ++++++++++++
 include/linux/mm_types.h                |    5 +
 include/linux/sched.h                   |    3 +
 include/linux/uprobes.h                 |  165 ++++
 kernel/Makefile                         |    1 +
 kernel/fork.c                           |   11 +
 kernel/signal.c                         |   22 +-
 kernel/trace/Kconfig                    |   20 +
 kernel/trace/Makefile                   |    2 +
 kernel/trace/trace.h                    |    5 +
 kernel/trace/trace_kprobe.c             |  894 +------------------
 kernel/trace/trace_probe.c              |  784 ++++++++++++++++
 kernel/trace/trace_probe.h              |  162 ++++
 kernel/trace/trace_uprobe.c             |  770 ++++++++++++++++
 kernel/uprobes.c                        | 1475 +++++++++++++++++++++++++++++++
 mm/memory.c                             |    4 +
 mm/mmap.c                               |    6 +
 tools/perf/Documentation/perf-probe.txt |   14 +
 tools/perf/builtin-probe.c              |   49 +-
 tools/perf/util/probe-event.c           |  410 +++++++--
 tools/perf/util/probe-event.h           |   12 +-
 tools/perf/util/symbol.c                |   10 +-
 tools/perf/util/symbol.h                |    1 +
 30 files changed, 4581 insertions(+), 978 deletions(-)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2011-10-25 15:53 UTC | newest]

Thread overview: 160+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-20 11:59 [PATCH v5 3.1.0-rc4-tip 0/26] Uprobes patchset with perf probe support Srikar Dronamraju
2011-09-20 11:59 ` [PATCH v5 3.1.0-rc4-tip 1/26] uprobes: Auxillary routines to insert, find, delete uprobes Srikar Dronamraju
2011-09-20 15:42   ` Stefan Hajnoczi
2011-09-26 11:18     ` Peter Zijlstra
2011-09-26 11:59       ` Srikar Dronamraju
2011-09-26 11:18   ` Peter Zijlstra
2011-09-26 12:02     ` Srikar Dronamraju
2011-09-26 13:35   ` Peter Zijlstra
2011-09-26 16:19     ` Srikar Dronamraju
2011-09-20 12:00 ` [PATCH v5 3.1.0-rc4-tip 2/26] Uprobes: Allow multiple consumers for an uprobe Srikar Dronamraju
2011-09-26 12:29   ` Peter Zijlstra
2011-09-20 12:00 ` [PATCH v5 3.1.0-rc4-tip 3/26] Uprobes: register/unregister probes Srikar Dronamraju
2011-09-20 16:50   ` Stefan Hajnoczi
2011-09-21  4:07     ` Srikar Dronamraju
2011-09-26 13:15   ` Peter Zijlstra
2011-09-26 13:23     ` Srikar Dronamraju
2011-10-03 12:46   ` Oleg Nesterov
2011-10-05 17:04     ` Srikar Dronamraju
2011-10-05 18:50       ` Oleg Nesterov
2011-10-06  6:51         ` Srikar Dronamraju
2011-10-07 17:03           ` Oleg Nesterov
2011-09-20 12:00 ` [PATCH v5 3.1.0-rc4-tip 4/26] uprobes: Define hooks for mmap/munmap Srikar Dronamraju
2011-09-20 17:03   ` Stefan Hajnoczi
2011-09-21  4:03     ` Srikar Dronamraju
2011-09-26 13:53   ` Peter Zijlstra
2011-09-26 15:44     ` Srikar Dronamraju
2011-09-27 11:37       ` Peter Zijlstra
2011-09-27 13:08         ` Srikar Dronamraju
2011-09-27 11:41       ` Peter Zijlstra
2011-09-27 12:59         ` Srikar Dronamraju
2011-09-27 11:42       ` Peter Zijlstra
2011-10-03 13:37   ` Oleg Nesterov
2011-10-06 11:05     ` Srikar Dronamraju
2011-10-07 17:36       ` Oleg Nesterov
2011-10-10 12:31         ` Srikar Dronamraju
2011-09-20 12:00 ` [PATCH v5 3.1.0-rc4-tip 5/26] Uprobes: copy of the original instruction Srikar Dronamraju
2011-10-03 16:29   ` Oleg Nesterov
2011-10-05 10:52     ` Srikar Dronamraju
2011-10-05 15:11       ` Oleg Nesterov
2011-10-05 16:09     ` Srikar Dronamraju
2011-10-05 17:53       ` Oleg Nesterov
2011-09-20 12:01 ` [PATCH v5 3.1.0-rc4-tip 6/26] Uprobes: define fixups Srikar Dronamraju
2011-09-20 12:01 ` [PATCH v5 3.1.0-rc4-tip 7/26] Uprobes: uprobes arch info Srikar Dronamraju
2011-09-20 12:01 ` [PATCH v5 3.1.0-rc4-tip 8/26] x86: analyze instruction and determine fixups Srikar Dronamraju
2011-09-20 17:13   ` Stefan Hajnoczi
2011-09-20 18:12     ` Christoph Hellwig
2011-09-20 20:53       ` Stefan Hajnoczi
2011-09-23 11:53         ` Masami Hiramatsu
2011-09-23 16:51           ` Stefan Hajnoczi
2011-09-26 19:59             ` Josh Stone
2011-09-27  1:32               ` Masami Hiramatsu
2011-09-27  2:59                 ` Josh Stone
2011-09-27  7:08               ` Stefan Hajnoczi
2011-09-22  1:05   ` Josh Stone
2011-10-05 15:48   ` Oleg Nesterov
2011-10-05 16:12     ` Srikar Dronamraju
2011-09-20 12:01 ` [PATCH v5 3.1.0-rc4-tip 9/26] Uprobes: Background page replacement Srikar Dronamraju
2011-10-05 16:19   ` Oleg Nesterov
2011-10-06  6:53     ` Srikar Dronamraju
2011-09-20 12:01 ` [PATCH v5 3.1.0-rc4-tip 10/26] x86: Set instruction pointer Srikar Dronamraju
2011-10-05 16:29   ` Oleg Nesterov
2011-09-20 12:02 ` [PATCH v5 3.1.0-rc4-tip 11/26] x86: Introduce TIF_UPROBE FLAG Srikar Dronamraju
2011-09-20 12:02 ` [PATCH v5 3.1.0-rc4-tip 12/26] Uprobes: Handle breakpoint and Singlestep Srikar Dronamraju
2011-09-26 13:59   ` Peter Zijlstra
2011-09-26 16:01     ` Srikar Dronamraju
2011-09-26 16:25       ` Peter Zijlstra
2011-10-05 17:48         ` Oleg Nesterov
2011-09-26 14:02   ` Peter Zijlstra
2011-10-07 18:28   ` Oleg Nesterov
2011-10-09 13:31     ` Oleg Nesterov
2011-09-20 12:02 ` [PATCH v5 3.1.0-rc4-tip 13/26] x86: define a x86 specific exception notifier Srikar Dronamraju
2011-09-26 14:19   ` Peter Zijlstra
2011-09-26 15:52     ` Srikar Dronamraju
2011-09-27 11:46       ` Peter Zijlstra
2011-10-07 18:31   ` Oleg Nesterov
2011-09-20 12:02 ` [PATCH v5 3.1.0-rc4-tip 14/26] uprobe: register " Srikar Dronamraju
2011-09-20 12:03 ` [PATCH v5 3.1.0-rc4-tip 15/26] x86: Define x86_64 specific uprobe_task_arch_info structure Srikar Dronamraju
2011-09-20 12:03 ` [PATCH v5 3.1.0-rc4-tip 16/26] uprobes: Introduce " Srikar Dronamraju
2011-09-20 12:03 ` [PATCH v5 3.1.0-rc4-tip 17/26] x86: arch specific hooks for pre/post singlestep handling Srikar Dronamraju
2011-09-26 14:23   ` Peter Zijlstra
2011-09-26 16:34     ` Srikar Dronamraju
2011-09-27 11:44       ` Peter Zijlstra
2011-09-20 12:03 ` [PATCH v5 3.1.0-rc4-tip 18/26] uprobes: slot allocation Srikar Dronamraju
2011-09-27 11:49   ` Peter Zijlstra
2011-09-27 12:32     ` Srikar Dronamraju
2011-09-27 12:59       ` Peter Zijlstra
2011-09-27 12:18   ` Peter Zijlstra
2011-09-27 12:45     ` Srikar Dronamraju
2011-09-27 12:36   ` Peter Zijlstra
2011-09-27 12:37   ` Peter Zijlstra
2011-09-27 12:50     ` Srikar Dronamraju
2011-09-27 12:50   ` Peter Zijlstra
2011-09-27 12:55   ` Peter Zijlstra
2011-10-07 18:37   ` Oleg Nesterov
2011-10-09 11:47     ` Srikar Dronamraju
2011-09-20 12:03 ` [PATCH v5 3.1.0-rc4-tip 19/26] tracing: Extract out common code for kprobes/uprobes traceevents Srikar Dronamraju
2011-09-28  5:04   ` Masami Hiramatsu
2011-09-20 12:04 ` [PATCH v5 3.1.0-rc4-tip 20/26] tracing: uprobes trace_event interface Srikar Dronamraju
2011-09-20 12:04 ` [PATCH v5 3.1.0-rc4-tip 21/26] tracing: uprobes Documentation Srikar Dronamraju
2011-09-20 12:04 ` [PATCH v5 3.1.0-rc4-tip 22/26] perf: rename target_module to target Srikar Dronamraju
2011-09-20 12:04 ` [PATCH v5 3.1.0-rc4-tip 23/26] perf: perf interface for uprobes Srikar Dronamraju
2011-09-20 12:04 ` [PATCH v5 3.1.0-rc4-tip 24/26] perf: show possible probes in a given executable file or library Srikar Dronamraju
2011-09-20 12:05 ` [PATCH v5 3.1.0-rc4-tip 25/26] perf: Documentation for perf uprobes Srikar Dronamraju
2011-09-28  9:20   ` Masami Hiramatsu
2011-09-20 12:05 ` [PATCH v5 3.1.0-rc4-tip 26/26] uprobes: queue signals while thread is singlestepping Srikar Dronamraju
2011-09-27 13:03   ` Peter Zijlstra
2011-09-27 13:12     ` Srikar Dronamraju
2011-10-05 18:01       ` Oleg Nesterov
2011-10-06  5:47         ` Srikar Dronamraju
2011-10-07 16:58           ` Oleg Nesterov
2011-10-10 12:25             ` Srikar Dronamraju
2011-10-10 18:25               ` Oleg Nesterov
2011-10-11 17:24                 ` Oleg Nesterov
2011-10-11 17:38                   ` Srikar Dronamraju
2011-10-11 17:26                 ` Srikar Dronamraju
2011-10-11 18:56                   ` Oleg Nesterov
2011-10-12 12:01                     ` Srikar Dronamraju
2011-10-12 19:34                       ` Oleg Nesterov
2011-10-12 19:59                   ` Oleg Nesterov
2011-09-20 13:34 ` [PATCH v5 3.1.0-rc4-tip 0/26] Uprobes patchset with perf probe support Christoph Hellwig
2011-09-20 14:12   ` Srikar Dronamraju
2011-09-20 14:28     ` Christoph Hellwig
2011-09-20 15:19       ` Srikar Dronamraju
2011-10-15 19:00 ` [PATCH 0/X] (Was: Uprobes patchset with perf probe support) Oleg Nesterov
2011-10-15 19:00   ` [PATCH 1/X] uprobes: write_opcode: the new page needs PG_uptodate Oleg Nesterov
2011-10-17 10:59     ` Srikar Dronamraju
2011-10-15 19:00   ` [PATCH 2/X] uprobes: write_opcode() needs put_page(new_page) unconditionally Oleg Nesterov
2011-10-18 16:47     ` Srikar Dronamraju
2011-10-15 19:01   ` [PATCH 3/X] uprobes: xol_add_vma: fix ->uprobes_xol_area initialization Oleg Nesterov
2011-10-15 19:01   ` [PATCH 4/X] uprobes: xol_add_vma: misc cleanups Oleg Nesterov
2011-10-15 19:01   ` [PATCH 5/X] uprobes: xol_alloc_area() needs memory barriers Oleg Nesterov
2011-10-16 16:13   ` [PATCH 6/X] uprobes: reimplement xol_add_vma() via install_special_mapping() Oleg Nesterov
2011-10-17 10:50     ` Srikar Dronamraju
2011-10-17 13:34       ` Stephen Smalley
2011-10-17 18:55         ` Oleg Nesterov
2011-10-16 16:14   ` [PATCH 7/X] uprobes: xol_add_vma: simply use TASK_SIZE as a hint Oleg Nesterov
2011-10-19 21:51   ` [PATCH 8-14/X] (Was: Uprobes patchset with perf probe support) Oleg Nesterov
2011-10-19 21:52     ` [PATCH 8/X] uprobes: kill sstep_complete() Oleg Nesterov
2011-10-19 21:52     ` [PATCH 9/X] uprobes: introduce UTASK_SSTEP_ACK state Oleg Nesterov
2011-10-19 21:52     ` [PATCH 10/X] uprobes: introduce uprobe_deny_signal() Oleg Nesterov
2011-10-19 21:53     ` [PATCH 11/X] uprobes: x86: introduce xol_was_trapped() Oleg Nesterov
2011-10-24 14:55       ` Srikar Dronamraju
2011-10-24 16:07         ` Oleg Nesterov
2011-10-19 21:53     ` [PATCH 12/X] uprobes: x86: introduce abort_xol() Oleg Nesterov
2011-10-21 14:42       ` Srikar Dronamraju
2011-10-21 16:22         ` Oleg Nesterov
2011-10-21 16:26         ` Ananth N Mavinakayanahalli
2011-10-21 16:42           ` Oleg Nesterov
2011-10-21 17:59             ` test-case (Was: [PATCH 12/X] uprobes: x86: introduce abort_xol()) Oleg Nesterov
2011-10-25 14:06               ` Srikar Dronamraju
2011-10-25 15:49                 ` Oleg Nesterov
2011-10-22  7:09             ` [PATCH 12/X] uprobes: x86: introduce abort_xol() Ananth N Mavinakayanahalli
2011-10-19 21:53     ` [PATCH 13/X] uprobes: introduce UTASK_SSTEP_TRAPPED logic Oleg Nesterov
2011-10-22  7:20       ` Ananth N Mavinakayanahalli
2011-10-24 14:41         ` Oleg Nesterov
2011-10-24 15:16           ` Ananth N Mavinakayanahalli
2011-10-24 16:13             ` Oleg Nesterov
2011-10-25  6:01               ` Ananth N Mavinakayanahalli
2011-10-25 14:30                 ` Oleg Nesterov
2011-10-19 21:54     ` [PATCH 14/X] uprobes: uprobe_deny_signal: check __fatal_signal_pending() 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).