linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] [PATCH 0/7] UBP, XOL and Uprobes
@ 2010-01-11 12:25 Srikar Dronamraju
  2010-01-11 12:25 ` [RFC] [PATCH 1/7] User Space Breakpoint Assistance Layer (UBP) Srikar Dronamraju
                   ` (8 more replies)
  0 siblings, 9 replies; 163+ messages in thread
From: Srikar Dronamraju @ 2010-01-11 12:25 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Srikar Dronamraju, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ananth N Mavinakayanahalli, utrace-devel, Mark Wielaard,
	Frederic Weisbecker, Masami Hiramatsu, Maneesh Soni,
	Jim Keniston, LKML

Hi, 

This patchset implements Uprobes which enables you to dynamically
break into any routine in a user space application and collect
information non-disruptively.  Uprobes is based on utrace and uses
x86 instruction decoder.

When a uprobe is registered, Uprobes makes a copy of the probed
instruction, stops the probed application, replaces the first
byte(s) of the probed instruction with a breakpoint instruction and
allows the probed application to continue.  (Uprobes uses the same
copy-on-write mechanism so that the breakpoint affects only that
process.)

When a CPU hits the breakpoint instruction, Uprobes intercepts the
SIGTRAP 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-process "single-step out of line
(XOL) area,"

Uprobes can be used to take advantage of static markers available
in user space applications.

Advantages of uprobes over conventional debugging include:
1. Non-disruptive.
2. Uses Execution out of line(XOL), 
3. Much better handling of multithreaded programs because of XOL.
4. No context switch between tracer, tracee.

Here is the list of TODO Items.

- Provide a perf interface to uprobes.
- Return probes.
- Support for Other Architectures.
- Jump optimization.


This patchset provides
Subject: [RFC] [PATCH 0/7] UBP, XOL and Uprobes
Subject: [RFC] [PATCH 1/7] User Space Breakpoint Assistance Layer (UBP)
Subject: [RFC] [PATCH 2/7] x86 support for  UBP 
Subject: [RFC] [PATCH 3/7] Execution out of line (XOL)
Subject: [RFC] [PATCH 4/7] Uprobes Implementation
Subject: [RFC] [PATCH 5/7] X86 Support for Uprobes
Subject: [RFC] [PATCH 6/7] Uprobes Documentation
Subject: [RFC] [PATCH 7/7] Ftrace plugin for Uprobes

This patchset is based on 
git://git.kernel.org/pub/scm/linux/kernel/git/frob/linux-2.6-utrace.git

If and when utrace gets accepted into tip tree or Mainline, I will rebase
this patchset.

Please do provide your valuable comments.

--
Thanks and Regards
Srikar

^ permalink raw reply	[flat|nested] 163+ messages in thread
* Re: [RFC] [PATCH 1/7] User Space Breakpoint Assistance Layer (UBP)
@ 2010-01-16 23:48 Jim Keniston
  2010-01-18  7:23 ` Peter Zijlstra
  2010-01-18 15:58 ` Masami Hiramatsu
  0 siblings, 2 replies; 163+ messages in thread
From: Jim Keniston @ 2010-01-16 23:48 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Srikar Dronamraju, Ingo Molnar, Arnaldo Carvalho de Melo,
	Ananth N Mavinakayanahalli, utrace-devel, Frederic Weisbecker,
	Masami Hiramatsu, Maneesh Soni, Mark Wielaard, LKML

Quoting Peter Zijlstra <peterz@infradead.org>:

> On Fri, 2010-01-15 at 16:58 -0800, Jim Keniston wrote:
>> But here are some things to keep in mind about the
>> various approaches:
>>
>> 1. Single-stepping inline is easiest: you need to know very little about
>> the instruction set you're probing.  But it's inadequate for
>> multithreaded apps.
>> 2. Single-stepping out of line solves the multithreading issue (as do #3
>> and #4), but requires more knowledge of the instruction set.  (In
>> particular, calls, jumps, and returns need special care; as do
>> rip-relative instructions in x86_64.)  I count 9 architectures that
>> support kprobes.  I think most of these do SSOL.
>> 3. "Boosted" probes (where an appended jump instruction removes the need
>> for the single-step trap on many instructions) require even more
>> knowledge of the instruction set, and like SSOL, require XOL slots.
>> Right now, as far as I know, x86 is the only architecture with boosted
>> kprobes.
>> 4. Emulation removes the need for the XOL area, but requires pretty much
>> total knowledge of the instruction set.  It's also a performance win for
>> architectures that can't do #3.  I see kvm implemented on 4
>> architectures (ia64, powerpc, s390, x86).  Coincidentally, those are the
>> architectures to which uprobes (old uprobes, with ubp and xol bundled
>> in) has already been ported (though Intel hasn't been maintaining their
>> ia64 port).
>
> Right, so I was thinking a combination of 4 and execute from kernel
> space would be feasible. I would think most regular instructions are
> runnable from kernel space given that we provide the proper pt_regs
> environment.
>
> Although I just realize we need to fully emulate the address computation
> step for all memory writes, otherwise a wild userspace pointer might end
> up writing in your kernel image.

Correct.

>
> Also, don't we already need full knowledge of the instruction set in
> order to decode the instruction stream and find instruction boundaries.

Not really.  For #3 (boosting), you need to know everything for #2,  
plus be able to compute the length of each instruction -- which we can  
now do for x86.  To emulate an instruction (#4), you need to replicate  
what it does, side-effects and all.  The x86 instruction set seems to  
be adding new floating-point instructions all the time, and I bet even  
Masami doesn't know what they all do, but so far, they all seem to  
adhere to the instruction-length rules encoded in Masami's instruction  
decoder.

As you may have noted before, I think FP would be a special problem  
for your approach.  I'm not sure how folks would react to the idea of  
executing FP instructions in kernel space.  But emulating them is also  
tough.  There's an IEEE FP emulation package somewhere in one of the  
Linux arch directories, but I'm not sure how precise it is, and  
dropping even 1 bit of precision is unacceptable for many  
applications, since such errors tend to grow in complex computations  
employing many FP instructions.

Jim


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

end of thread, other threads:[~2010-02-07 13:49 UTC | newest]

Thread overview: 163+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-11 12:25 [RFC] [PATCH 0/7] UBP, XOL and Uprobes Srikar Dronamraju
2010-01-11 12:25 ` [RFC] [PATCH 1/7] User Space Breakpoint Assistance Layer (UBP) Srikar Dronamraju
2010-01-14 11:08   ` Peter Zijlstra
2010-01-14 19:46     ` Jim Keniston
2010-01-15  9:02       ` Peter Zijlstra
2010-01-15 21:07         ` Jim Keniston
2010-01-15 21:49           ` Peter Zijlstra
2010-01-16  0:58             ` Jim Keniston
2010-01-16 10:33               ` Peter Zijlstra
2010-01-17  0:12               ` Bryan Donlan
2010-01-18  7:37                 ` Peter Zijlstra
2010-01-17 14:37               ` Avi Kivity
2010-01-15  9:03       ` Peter Zijlstra
2010-01-15  9:38         ` Ananth N Mavinakayanahalli
2010-01-15  9:50           ` Peter Zijlstra
2010-01-15 10:10             ` Ananth N Mavinakayanahalli
2010-01-15 10:13               ` Peter Zijlstra
2010-01-15 10:22                 ` Ananth N Mavinakayanahalli
2010-01-15 10:56                   ` Peter Zijlstra
2010-01-15 11:02                     ` Peter Zijlstra
2010-01-15 21:19             ` Jim Keniston
2010-01-17 14:39             ` Avi Kivity
2010-01-17 14:52               ` Peter Zijlstra
2010-01-17 14:56                 ` Avi Kivity
2010-01-17 15:01                   ` Peter Zijlstra
2010-01-20 12:55                     ` Pavel Machek
2010-01-17 14:59                 ` Avi Kivity
2010-01-17 15:03                   ` Peter Zijlstra
2010-01-17 19:33                     ` Avi Kivity
2010-01-18  7:45                       ` Peter Zijlstra
2010-01-18 11:01                         ` Avi Kivity
2010-01-18 11:44                           ` Peter Zijlstra
2010-01-18 12:01                             ` Avi Kivity
2010-01-18 12:06                               ` Peter Zijlstra
2010-01-18 12:09                                 ` Avi Kivity
2010-01-18 12:13                                   ` Pekka Enberg
2010-01-18 12:17                                     ` Avi Kivity
2010-01-18 12:24                                       ` Peter Zijlstra
2010-01-18 12:24                                       ` Pekka Enberg
2010-01-18 12:44                                       ` Srikar Dronamraju
2010-01-18 12:51                                         ` Pekka Enberg
2010-01-18 12:53                                           ` Avi Kivity
2010-01-18 12:57                                             ` Pekka Enberg
2010-01-18 13:06                                               ` Avi Kivity
2010-01-18 22:15                                               ` Jim Keniston
2010-01-19  8:07                                                 ` Avi Kivity
2010-01-19 17:47                                                   ` Jim Keniston
2010-01-19 18:06                                                     ` Frederic Weisbecker
2010-01-20  6:36                                                       ` Srikar Dronamraju
2010-01-20 10:51                                                         ` Frederic Weisbecker
2010-01-20 19:31                                                       ` Masami Hiramatsu
2010-01-20  9:43                                                     ` Avi Kivity
2010-01-20  9:57                                                       ` Peter Zijlstra
2010-01-20 12:22                                                         ` Avi Kivity
2010-01-27  8:24                                                           ` Ingo Molnar
2010-01-27  8:35                                                             ` Avi Kivity
2010-01-27  9:08                                                               ` Ingo Molnar
2010-01-27  9:25                                                                 ` Avi Kivity
2010-01-27 10:23                                                                   ` Ingo Molnar
2010-02-07 13:47                                                                     ` Avi Kivity
2010-01-20 10:45                                                       ` Srikar Dronamraju
2010-01-20 12:23                                                         ` Avi Kivity
2010-01-20 18:31                                                     ` Andi Kleen
2010-01-20 19:34                                                       ` Jim Keniston
2010-01-20 19:58                                                         ` Andi Kleen
2010-01-20 20:28                                                           ` Jim Keniston
2010-01-18 13:05                                             ` Peter Zijlstra
2010-01-18 13:34                                             ` Mark Wielaard
2010-01-18 19:49                                               ` Jim Keniston
2010-01-18 15:43                                     ` Ananth N Mavinakayanahalli
2010-01-18 16:52                                       ` Avi Kivity
2010-01-18 17:10                                         ` Ananth N Mavinakayanahalli
2010-01-18 12:14                                   ` Peter Zijlstra
2010-01-18 12:37                                     ` Avi Kivity
2010-01-18 13:15                                       ` Peter Zijlstra
2010-01-18 13:33                                         ` Avi Kivity
2010-01-18 13:34                                         ` K.Prasad
2010-01-20 15:57                                         ` Mel Gorman
2010-01-20 18:32                                     ` Andi Kleen
2010-01-18 11:45                           ` Peter Zijlstra
2010-01-11 12:25 ` [RFC] [PATCH 2/7] x86 support for UBP Srikar Dronamraju
2010-01-11 12:25 ` [RFC] [PATCH 3/7] Execution out of line (XOL) Srikar Dronamraju
2010-01-14 11:08   ` Peter Zijlstra
2010-01-14 22:43     ` Jim Keniston
2010-01-15  9:07       ` Peter Zijlstra
2010-01-15 11:12         ` Srikar Dronamraju
2010-01-15 20:18         ` Jim Keniston
2010-01-11 12:25 ` [RFC] [PATCH 4/7] Uprobes Implementation Srikar Dronamraju
2010-01-12  2:01   ` Paul E. McKenney
2010-01-12  8:21     ` Srikar Dronamraju
2010-01-12  5:36   ` Frederic Weisbecker
2010-01-12  8:14     ` Ananth N Mavinakayanahalli
2010-01-13  0:53       ` Jim Keniston
2010-01-14 11:12       ` Peter Zijlstra
2010-01-12  8:54     ` Srikar Dronamraju
2010-01-14 11:09   ` Peter Zijlstra
2010-01-14 22:49     ` Jim Keniston
2010-01-15  9:10       ` Peter Zijlstra
2010-01-15  9:26         ` Frank Ch. Eigler
2010-01-15  9:35           ` Peter Zijlstra
2010-01-15 13:10             ` Frank Ch. Eigler
2010-01-15 13:25               ` Peter Zijlstra
2010-01-15 13:38                 ` Frank Ch. Eigler
2010-01-15 13:47                   ` Peter Zijlstra
2010-01-15 14:00                     ` Frank Ch. Eigler
2010-01-15 14:06                       ` Peter Zijlstra
2010-01-15 14:22                         ` Frank Ch. Eigler
2010-01-15 14:40                           ` Peter Zijlstra
2010-01-15 14:20                     ` Srikar Dronamraju
2010-01-15 14:25                       ` Peter Zijlstra
2010-01-15 23:11                       ` Jim Keniston
2010-01-16 15:50                         ` Frank Ch. Eigler
2010-01-15 10:26         ` Srikar Dronamraju
2010-01-15 10:33           ` Peter Zijlstra
2010-01-15 11:05             ` Maneesh Soni
2010-01-15 11:12               ` Peter Zijlstra
2010-01-15 11:18                 ` Peter Zijlstra
2010-01-15 22:27                   ` Jim Keniston
2010-01-15 23:44                 ` Jim Keniston
2010-01-16 10:04                   ` Peter Zijlstra
2010-01-15 13:08             ` Srikar Dronamraju
2010-01-15 13:16               ` Peter Zijlstra
2010-01-15 13:38                 ` Peter Zijlstra
2010-01-11 12:25 ` [RFC] [PATCH 5/7] X86 Support for Uprobes Srikar Dronamraju
2010-01-14 11:13   ` Peter Zijlstra
2010-01-14 23:07     ` Jim Keniston
2010-01-11 12:26 ` [RFC] [PATCH 6/7] Uprobes Documentation Srikar Dronamraju
2010-01-11 12:26 ` [RFC] [PATCH 7/7] Ftrace plugin for Uprobes Srikar Dronamraju
2010-01-12  4:54   ` Frederic Weisbecker
2010-01-12  5:08     ` Steven Rostedt
2010-01-12  5:44       ` Frederic Weisbecker
2010-01-12 19:12       ` Tim Bird
2010-01-13 21:58       ` Masami Hiramatsu
2010-01-13 22:12         ` Masami Hiramatsu
2010-01-13 23:36           ` Steven Rostedt
2010-01-12 18:54     ` Frank Ch. Eigler
2010-01-12 22:00       ` Masami Hiramatsu
2010-01-12 22:15         ` Frank Ch. Eigler
2010-01-12 22:30           ` Masami Hiramatsu
2010-01-14 11:23   ` Peter Zijlstra
2010-01-14 11:29     ` Peter Zijlstra
2010-01-14 12:16       ` Mark Wielaard
2010-01-14 12:19         ` Peter Zijlstra
2010-01-14 11:35     ` Frederic Weisbecker
2010-01-14 11:43       ` Peter Zijlstra
2010-01-14 12:23         ` Frederic Weisbecker
2010-01-14 12:29           ` Peter Zijlstra
2010-01-18 13:00             ` Frederic Weisbecker
2010-01-11 14:35 ` [RFC] [PATCH 0/7] UBP, XOL and Uprobes Masami Hiramatsu
2010-01-11 22:59   ` Jim Keniston
2010-01-22  7:02 ` [RFC] [PATCH 0/7] UBP, XOL and Uprobes [ Summary of Comments and actions to be taken ] Srikar Dronamraju
2010-01-22  7:24   ` Ananth N Mavinakayanahalli
2010-01-22 10:47     ` Peter Zijlstra
2010-01-27  6:53     ` Peter Zijlstra
2010-01-27  8:24       ` Peter Zijlstra
2010-01-22 18:06   ` Peter Zijlstra
2010-01-22 18:36     ` Masami Hiramatsu
2010-01-22 23:55     ` Jim Keniston
2010-01-16 23:48 [RFC] [PATCH 1/7] User Space Breakpoint Assistance Layer (UBP) Jim Keniston
2010-01-18  7:23 ` Peter Zijlstra
2010-01-18 15:58 ` Masami Hiramatsu
2010-01-18 19:21   ` Jim Keniston
2010-01-18 21:20     ` Masami Hiramatsu

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