* Porting "jump labels" to userspace (was: Re: [ltt-dev] LTTng-UST vs SystemTap userspace tracing benchmarks) [not found] ` <20110216185056.CAD7B1806E0@magilla.sf.frob.com> @ 2011-02-16 20:00 ` Mathieu Desnoyers 2011-02-16 20:04 ` Roland McGrath 2011-02-16 20:14 ` David Daney 0 siblings, 2 replies; 9+ messages in thread From: Mathieu Desnoyers @ 2011-02-16 20:00 UTC (permalink / raw) To: Roland McGrath Cc: Mark Wielaard, Stefan Hajnoczi, Frank Ch. Eigler, Julien Desfossez, dominique.toupin, ltt-dev, systemtap, linux-kernel, Jason Baron, hpa, rostedt, mingo, tglx, andi, roland, rth, masami.hiramatsu.pt, fweisbec, avi, davem, sam, ddaney, michael, Peter Zijlstra [ Adding the relevant people in CC for jump label discussion ] * Roland McGrath (roland@redhat.com) wrote: > Stefan was referring to #4 in your taxonomy. > > It's indeed the case that what UST uses today is an always-there normal > C code sequence that loads global variables to decide whether to make > indirect function calls. I don't recall off hand how many layers of > function calls to the libust DSO and such there are in either the > disabled or enabled cases. At best, there is the always the overhead of > several instructions and at least one load in the hot code path, and the > i-cache pollution that goes with that. > > It's indeed the cast that what Systemtap uses today is a > sometimes-inserted normal breakpoint instruction, which is indeed a > software interrupt that requires kernel mediation. When disabled, there > is as close to zero overhead as you can have, being a tiny placeholder > instruction sequence (currently just one nop), so the runtime overhead > is under a cycle and the i-cache pollution is the smallest possible unit > (one instruction, being just one byte on x86). > > The "sweet spot" between the two is to have overhead close to > Systemtap's epsilon for a disabled probe, while having overhead close to > UST's pure-user method when a probe is enabled. In the in-kernel > context, this is what the Linux kernel's latest code (still being hashed > out, but mostly done) has for kernel tracepoints using the so-called > "jump label" method. That is also possible for sdt markers with some > careful consideration and attention to machine-specific details for each > machine architecture of concern. It entails making the placeholder in > the hot code path slightly larger (at least for x86, it has to be a > "long nop", being probably neglibly more runtime overhead, and a few > bytes more i-cache pollution), and adding some additional static code > outside the hot path. The work to enable or disable a probe becomes > just as costly as the current Systemtap method, since it involves > modifying the program text in place (inserting jump instructions rather > than breakpoint ones). Once enabled, the runtime work of the probes > firing can be very much like what UST does today. Actually, creating the equivalent of the jump labels for userspace is on our list of "things to do" for the UST project. If Jason and other jump label contributors agree to dual-license the jump label generic and per-arch implementations under both GPLv2 and LGPLv2.1, we could probably re-use a large part of this code to create a static jump label library for userspace. The concerned authors are precisely: Jason for generic and x86 code, Steven for some improvements in generic code and David S. Miller for the sparc port. After things settle down with the current jump label changes proposed by Peter Zijlstra, we might also want to ask for his permission to LGPLize his changes. Thanks, Mathieu > > > Thanks, > Roland -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Porting "jump labels" to userspace (was: Re: [ltt-dev] LTTng-UST vs SystemTap userspace tracing benchmarks) 2011-02-16 20:00 ` Porting "jump labels" to userspace (was: Re: [ltt-dev] LTTng-UST vs SystemTap userspace tracing benchmarks) Mathieu Desnoyers @ 2011-02-16 20:04 ` Roland McGrath 2011-02-16 20:17 ` Porting "jump labels" to userspace David Daney 2011-02-16 20:14 ` David Daney 1 sibling, 1 reply; 9+ messages in thread From: Roland McGrath @ 2011-02-16 20:04 UTC (permalink / raw) To: Mathieu Desnoyers Cc: Mark Wielaard, Stefan Hajnoczi, Frank Ch. Eigler, Julien Desfossez, dominique.toupin, ltt-dev, systemtap, linux-kernel, Jason Baron, hpa, rostedt, mingo, tglx, andi, rth, masami.hiramatsu.pt, fweisbec, avi, davem, sam, ddaney, michael, Peter Zijlstra IMHO there is not really so much to the in-kernel implementation that it's worth attempting to reuse the code in userland. Pretty much all the work is in the details of the implementation that would naturally differ a lot in a different context. If you understand the mechanism and the machine details, then implementing it well for a userland context is not a big deal and is cleaner to do from scratch than shoe-horning kernel-centric code into a wildly different context. Thanks, Roland ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Porting "jump labels" to userspace 2011-02-16 20:04 ` Roland McGrath @ 2011-02-16 20:17 ` David Daney 2011-02-16 20:39 ` Mathieu Desnoyers 0 siblings, 1 reply; 9+ messages in thread From: David Daney @ 2011-02-16 20:17 UTC (permalink / raw) To: Roland McGrath Cc: Mathieu Desnoyers, Mark Wielaard, Stefan Hajnoczi, Frank Ch. Eigler, Julien Desfossez, dominique.toupin, ltt-dev, systemtap, linux-kernel, Jason Baron, hpa, rostedt, mingo, tglx, andi, rth, masami.hiramatsu.pt, fweisbec, avi, davem, sam, michael, Peter Zijlstra On 02/16/2011 12:04 PM, Roland McGrath wrote: > IMHO there is not really so much to the in-kernel implementation that it's > worth attempting to reuse the code in userland. Pretty much all the work > is in the details of the implementation that would naturally differ a lot > in a different context. If you understand the mechanism and the machine > details, then implementing it well for a userland context is not a big deal > and is cleaner to do from scratch than shoe-horning kernel-centric code > into a wildly different context. > Good point. Certainly the details of maintaining instruction cache coherency may be different in userspace. David Daney ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Porting "jump labels" to userspace 2011-02-16 20:17 ` Porting "jump labels" to userspace David Daney @ 2011-02-16 20:39 ` Mathieu Desnoyers 2011-02-16 20:45 ` Thomas Gleixner 0 siblings, 1 reply; 9+ messages in thread From: Mathieu Desnoyers @ 2011-02-16 20:39 UTC (permalink / raw) To: David Daney Cc: Roland McGrath, Mark Wielaard, Stefan Hajnoczi, Frank Ch. Eigler, Julien Desfossez, dominique.toupin, ltt-dev, systemtap, linux-kernel, Jason Baron, hpa, rostedt, mingo, tglx, andi, rth, masami.hiramatsu.pt, fweisbec, avi, davem, sam, michael, Peter Zijlstra * David Daney (ddaney@caviumnetworks.com) wrote: > On 02/16/2011 12:04 PM, Roland McGrath wrote: >> IMHO there is not really so much to the in-kernel implementation that it's >> worth attempting to reuse the code in userland. Pretty much all the work >> is in the details of the implementation that would naturally differ a lot >> in a different context. If you understand the mechanism and the machine >> details, then implementing it well for a userland context is not a big deal >> and is cleaner to do from scratch than shoe-horning kernel-centric code >> into a wildly different context. >> > > Good point. > > Certainly the details of maintaining instruction cache coherency may be > different in userspace. Indeed, the arch-specific parts will need some extra care (which might, in the worse case scenario, require to suspend a whole process during the update), but the generic code in jump_label.c and jump_label.h could certainly be reused. Thanks, Mathieu > > David Daney -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Porting "jump labels" to userspace 2011-02-16 20:39 ` Mathieu Desnoyers @ 2011-02-16 20:45 ` Thomas Gleixner 2011-02-16 21:42 ` Peter Zijlstra 0 siblings, 1 reply; 9+ messages in thread From: Thomas Gleixner @ 2011-02-16 20:45 UTC (permalink / raw) To: Mathieu Desnoyers Cc: David Daney, Roland McGrath, Mark Wielaard, Stefan Hajnoczi, Frank Ch. Eigler, Julien Desfossez, dominique.toupin, ltt-dev, systemtap, linux-kernel, Jason Baron, hpa, rostedt, mingo, andi, rth, masami.hiramatsu.pt, fweisbec, avi, davem, sam, michael, Peter Zijlstra On Wed, 16 Feb 2011, Mathieu Desnoyers wrote: > * David Daney (ddaney@caviumnetworks.com) wrote: > > On 02/16/2011 12:04 PM, Roland McGrath wrote: > >> IMHO there is not really so much to the in-kernel implementation that it's > >> worth attempting to reuse the code in userland. Pretty much all the work > >> is in the details of the implementation that would naturally differ a lot > >> in a different context. If you understand the mechanism and the machine > >> details, then implementing it well for a userland context is not a big deal > >> and is cleaner to do from scratch than shoe-horning kernel-centric code > >> into a wildly different context. > >> > > > > Good point. > > > > Certainly the details of maintaining instruction cache coherency may be > > different in userspace. > > Indeed, the arch-specific parts will need some extra care (which might, in the > worse case scenario, require to suspend a whole process during the update), but > the generic code in jump_label.c and jump_label.h could certainly be reused. We talk about 500 lines of code, where half of it is modules specific and the whole thing is full of kernelims. IMNSHO, that's faster reimplemented from scratch than writing all the mails and get the authors to sign off on the license change. Thanks, tglx ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Porting "jump labels" to userspace 2011-02-16 20:45 ` Thomas Gleixner @ 2011-02-16 21:42 ` Peter Zijlstra 2011-02-17 13:58 ` Ingo Molnar 0 siblings, 1 reply; 9+ messages in thread From: Peter Zijlstra @ 2011-02-16 21:42 UTC (permalink / raw) To: Thomas Gleixner Cc: Mathieu Desnoyers, David Daney, Roland McGrath, Mark Wielaard, Stefan Hajnoczi, Frank Ch. Eigler, Julien Desfossez, dominique.toupin, ltt-dev, systemtap, linux-kernel, Jason Baron, hpa, rostedt, mingo, andi, rth, masami.hiramatsu.pt, fweisbec, avi, davem, sam, michael On Wed, 2011-02-16 at 21:45 +0100, Thomas Gleixner wrote: > We talk about 500 lines of code, where half of it is modules specific > and the whole thing is full of kernelims. IMNSHO, that's faster > reimplemented from scratch than writing all the mails and get the > authors to sign off on the license change. That and I'm not going to consent with an LGPL license, I'm an avid GPLv2 fan as various people already know ;-) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Porting "jump labels" to userspace 2011-02-16 21:42 ` Peter Zijlstra @ 2011-02-17 13:58 ` Ingo Molnar 0 siblings, 0 replies; 9+ messages in thread From: Ingo Molnar @ 2011-02-17 13:58 UTC (permalink / raw) To: Peter Zijlstra Cc: Thomas Gleixner, Mathieu Desnoyers, David Daney, Roland McGrath, Mark Wielaard, Stefan Hajnoczi, Frank Ch. Eigler, Julien Desfossez, dominique.toupin, ltt-dev, systemtap, linux-kernel, Jason Baron, hpa, rostedt, andi, rth, masami.hiramatsu.pt, fweisbec, avi, davem, sam, michael * Peter Zijlstra <peterz@infradead.org> wrote: > On Wed, 2011-02-16 at 21:45 +0100, Thomas Gleixner wrote: > > > We talk about 500 lines of code, where half of it is modules specific > > and the whole thing is full of kernelims. IMNSHO, that's faster > > reimplemented from scratch than writing all the mails and get the > > authors to sign off on the license change. > > That and I'm not going to consent with an LGPL license, I'm an avid > GPLv2 fan as various people already know ;-) Ditto for me. Thanks, Ingo ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Porting "jump labels" to userspace 2011-02-16 20:00 ` Porting "jump labels" to userspace (was: Re: [ltt-dev] LTTng-UST vs SystemTap userspace tracing benchmarks) Mathieu Desnoyers 2011-02-16 20:04 ` Roland McGrath @ 2011-02-16 20:14 ` David Daney 2011-02-16 20:36 ` Mathieu Desnoyers 1 sibling, 1 reply; 9+ messages in thread From: David Daney @ 2011-02-16 20:14 UTC (permalink / raw) To: Mathieu Desnoyers Cc: Roland McGrath, Mark Wielaard, Stefan Hajnoczi, Frank Ch. Eigler, Julien Desfossez, dominique.toupin, ltt-dev, systemtap, linux-kernel, Jason Baron, hpa, rostedt, mingo, tglx, andi, rth, masami.hiramatsu.pt, fweisbec, avi, davem, sam, michael, Peter Zijlstra On 02/16/2011 12:00 PM, Mathieu Desnoyers wrote: [...]> > Actually, creating the equivalent of the jump labels for userspace is on our > list of "things to do" for the UST project. > > If Jason and other jump label contributors agree to dual-license the jump label > generic and per-arch implementations under both GPLv2 and LGPLv2.1, we could > probably re-use a large part of this code to create a static jump label library > for userspace. The concerned authors are precisely: Jason for generic and x86 > code, Steven for some improvements in generic code and David S. Miller for the > sparc port. After things settle down with the current jump label changes > proposed by Peter Zijlstra, we might also want to ask for his permission to > LGPLize his changes. > FWIW: MIPS jump label support is now in as of: 94bb0c1 (MIPS: jump label: Add MIPS support.) I would be the author of that. David Daney ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Porting "jump labels" to userspace 2011-02-16 20:14 ` David Daney @ 2011-02-16 20:36 ` Mathieu Desnoyers 0 siblings, 0 replies; 9+ messages in thread From: Mathieu Desnoyers @ 2011-02-16 20:36 UTC (permalink / raw) To: David Daney Cc: Roland McGrath, Mark Wielaard, Stefan Hajnoczi, Frank Ch. Eigler, Julien Desfossez, dominique.toupin, ltt-dev, systemtap, linux-kernel, Jason Baron, hpa, rostedt, mingo, tglx, andi, rth, masami.hiramatsu.pt, fweisbec, avi, davem, sam, michael, Peter Zijlstra * David Daney (ddaney@caviumnetworks.com) wrote: > On 02/16/2011 12:00 PM, Mathieu Desnoyers wrote: > [...]> >> Actually, creating the equivalent of the jump labels for userspace is on our >> list of "things to do" for the UST project. >> >> If Jason and other jump label contributors agree to dual-license the jump label >> generic and per-arch implementations under both GPLv2 and LGPLv2.1, we could >> probably re-use a large part of this code to create a static jump label library >> for userspace. The concerned authors are precisely: Jason for generic and x86 >> code, Steven for some improvements in generic code and David S. Miller for the >> sparc port. After things settle down with the current jump label changes >> proposed by Peter Zijlstra, we might also want to ask for his permission to >> LGPLize his changes. >> > FWIW: MIPS jump label support is now in as of: > > 94bb0c1 (MIPS: jump label: Add MIPS support.) > > I would be the author of that. Sorry David, my tree was a bit outdated from Linus's head :) Mathieu > > David Daney -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-02-17 13:58 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4D5AA164.1050607@polymtl.ca>
[not found] ` <y0mvd0ltgba.fsf@fche.csb>
[not found] ` <AANLkTi=Nsy6fXE9=Njxs9LPHuohHzf=q5kD+fK765Rht@mail.gmail.com>
[not found] ` <1297853778.3224.90.camel@springer.wildebeest.org>
[not found] ` <20110216185056.CAD7B1806E0@magilla.sf.frob.com>
2011-02-16 20:00 ` Porting "jump labels" to userspace (was: Re: [ltt-dev] LTTng-UST vs SystemTap userspace tracing benchmarks) Mathieu Desnoyers
2011-02-16 20:04 ` Roland McGrath
2011-02-16 20:17 ` Porting "jump labels" to userspace David Daney
2011-02-16 20:39 ` Mathieu Desnoyers
2011-02-16 20:45 ` Thomas Gleixner
2011-02-16 21:42 ` Peter Zijlstra
2011-02-17 13:58 ` Ingo Molnar
2011-02-16 20:14 ` David Daney
2011-02-16 20:36 ` Mathieu Desnoyers
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox