Re: [PATCH 1/1] x86: fix text_poke

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ingo Molnar
Date: Monday, April 28, 2008 - 1:21 pm

* Linus Torvalds <torvalds@linux-foundation.org> wrote:


Ob'plug: with the pending dyn-ftrace function tracer feature we do 
something rather close to that already: we have a 5 byte NOP in the 
prologue of every function that can be used as a non-destructive 'branch 
away' place.

Right now we use that to trace a (regex-ish pattern identified) set of 
functions. The regex pattern can be configured runtime via 
/debug/tracing/function_filter is not parsed runtime in any fastpath - 
it is used to activate/deactivate the tracepoints and patches them from 
NOPs into CALLs.

_But_ the same mechanism could perhaps be used to patch the function as 
well.

The cost is +5 bytes of NOP for every function in the system, but in 
practice we've not been able to measure any actual runtime costs of 
these NOPs - neither in micro-benchmarks nor in macro-benchmarks. (the 
only real cost here is the +5 bytes of I$ cost - otherwise the NOP will 
just be skipped by the decoder.)

the patching of these NOPs is inherently safe because they are inserted 
at build time. There's no negative impact to gcc optimizations at all. 
We get a nice selection of 75,000 tracepoints in an allmodconfig kernel 
- without _any_ source code level impact in the functions.

On the other hand, i'm not opposed to a handful of static markers either 
- i think the best model is to have both of these facilities. There are 
a couple of 'core events' that are not expressed via function calls, and 
even where they are expressed via function calls the function call 
layout is not stable while markers are stable across kernel versions. 
The notion of "a context-switch happened from task X to task Y" or "task 
X woke up task Y" is not going to change anytime soon so i'm not opposed 
to exposing that kind of information. And once we accept the static 
markers, we might as well make them as cheap as possible.

	Ingo
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.25-git1: Solid hang on HP nx6325 (64-bit), Rafael J. Wysocki, (Sat Apr 19, 6:22 am)
2.6.25-git2: BUG: unable to handle kernel paging request a ..., Rafael J. Wysocki, (Sun Apr 20, 12:04 pm)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Rafael J. Wysocki, (Sun Apr 20, 12:14 pm)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Paul E. McKenney, (Sun Apr 20, 10:47 pm)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Rafael J. Wysocki, (Mon Apr 21, 6:35 am)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Rafael J. Wysocki, (Mon Apr 21, 9:12 am)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Rafael J. Wysocki, (Mon Apr 21, 9:24 am)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Paul E. McKenney, (Mon Apr 21, 10:05 am)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Rafael J. Wysocki, (Mon Apr 21, 10:19 am)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Paul E. McKenney, (Mon Apr 21, 10:43 am)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Rafael J. Wysocki, (Mon Apr 21, 11:22 am)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Rafael J. Wysocki, (Mon Apr 21, 5:54 pm)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Rafael J. Wysocki, (Mon Apr 21, 6:15 pm)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Rafael J. Wysocki, (Mon Apr 21, 6:30 pm)
device_pm_add (was: Re: 2.6.25-git2: BUG: unable to handle ..., Rafael J. Wysocki, (Tue Apr 22, 1:34 pm)
Re: device_pm_add (was: Re: 2.6.25-git2: BUG: unable to ha ..., Rafael J. Wysocki, (Tue Apr 22, 1:57 pm)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Rafael J. Wysocki, (Tue Apr 22, 2:46 pm)
Re: device_pm_add (was: Re: 2.6.25-git2: BUG: unable to ha ..., Rafael J. Wysocki, (Tue Apr 22, 3:48 pm)
Re: device_pm_add (was: Re: 2.6.25-git2: BUG: unable to ha ..., Rafael J. Wysocki, (Tue Apr 22, 5:50 pm)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Christoph Lameter, (Wed Apr 23, 12:05 pm)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Christoph Lameter, (Wed Apr 23, 12:28 pm)
Re: [PATCH 1/1] x86: fix text_poke, Linus Torvalds, (Fri Apr 25, 8:03 am)
Re: [PATCH 1/1] x86: fix text_poke, Andi Kleen, (Fri Apr 25, 8:17 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 8:19 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 8:26 am)
Re: [PATCH 1/1] x86: fix text_poke, Andi Kleen, (Fri Apr 25, 8:27 am)
Re: 2.6.25-git2: BUG: unable to handle kernel paging reque ..., Rafael J. Wysocki, (Fri Apr 25, 8:30 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 8:32 am)
Re: [PATCH 1/1] x86: fix text_poke, Linus Torvalds, (Fri Apr 25, 8:33 am)
Re: [PATCH 1/1] x86: fix text_poke, Andi Kleen, (Fri Apr 25, 8:48 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 8:50 am)
Re: [PATCH 1/1] x86: fix text_poke, Mathieu Desnoyers, (Fri Apr 25, 8:54 am)
Re: [PATCH 1/1] x86: fix text_poke, H. Peter Anvin, (Fri Apr 25, 8:57 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 8:59 am)
Re: [PATCH 1/1] x86: fix text_poke, Linus Torvalds, (Fri Apr 25, 9:06 am)
Re: [PATCH 1/1] x86: fix text_poke, Mathieu Desnoyers, (Fri Apr 25, 9:11 am)
Re: [PATCH 1/1] x86: fix text_poke, Linus Torvalds, (Fri Apr 25, 9:11 am)
Re: [PATCH 1/1] x86: fix text_poke, Andi Kleen, (Fri Apr 25, 9:19 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 9:22 am)
Re: [PATCH 1/1] x86: fix text_poke, Linus Torvalds, (Fri Apr 25, 9:24 am)
Re: [PATCH 1/1] x86: fix text_poke, Mathieu Desnoyers, (Fri Apr 25, 9:30 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 9:33 am)
Re: [PATCH 1/1] x86: fix text_poke, Linus Torvalds, (Fri Apr 25, 9:37 am)
Re: [PATCH 1/1] x86: fix text_poke, H. Peter Anvin, (Fri Apr 25, 9:42 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 9:43 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 9:45 am)
Re: [PATCH 1/1] x86: fix text_poke, Linus Torvalds, (Fri Apr 25, 9:51 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 9:52 am)
Re: [PATCH 1/1] x86: fix text_poke, Andi Kleen, (Fri Apr 25, 9:56 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 10:02 am)
Re: [PATCH 1/1] x86: fix text_poke, Mathieu Desnoyers, (Fri Apr 25, 10:09 am)
Re: [PATCH 1/1] x86: fix text_poke, Linus Torvalds, (Fri Apr 25, 10:13 am)
Re: [PATCH 1/1] x86: fix text_poke, Andi Kleen, (Fri Apr 25, 10:26 am)
Re: [PATCH 1/1] x86: fix text_poke, Linus Torvalds, (Fri Apr 25, 10:29 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 10:53 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 11:04 am)
Re: [PATCH 1/1] x86: fix text_poke, Linus Torvalds, (Fri Apr 25, 11:09 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 11:13 am)
Re: [PATCH 1/1] x86: fix text_poke, Jeremy Fitzhardinge, (Fri Apr 25, 11:13 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 11:19 am)
Re: [PATCH 1/1] x86: fix text_poke, Mathieu Desnoyers, (Fri Apr 25, 11:37 am)
Re: [PATCH 1/1] x86: fix text_poke, H. Peter Anvin, (Fri Apr 25, 11:47 am)
Re: [PATCH 1/1] x86: fix text_poke, Pavel Machek, (Fri Apr 25, 11:53 am)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Fri Apr 25, 11:56 am)
Re: [PATCH 1/1] x86: fix text_poke, H. Peter Anvin, (Fri Apr 25, 12:19 pm)
Re: [PATCH 1/1] x86: fix text_poke, Christoph Lameter, (Fri Apr 25, 12:36 pm)
Re: [PATCH 1/1] x86: fix text_poke, Mathieu Desnoyers, (Fri Apr 25, 1:04 pm)
Re: [PATCH 1/1] x86: fix text_poke, H. Peter Anvin, (Fri Apr 25, 1:09 pm)
Re: [PATCH 1/1] x86: fix text_poke, David Miller, (Fri Apr 25, 1:18 pm)
Re: [PATCH 1/1] x86: fix text_poke, H. Peter Anvin, (Fri Apr 25, 1:18 pm)
Re: [PATCH 1/1] x86: fix text_poke, Mathieu Desnoyers, (Fri Apr 25, 1:37 pm)
Re: [PATCH 1/1] x86: fix text_poke, H. Peter Anvin, (Fri Apr 25, 1:41 pm)
Re: [PATCH 1/1] x86: fix text_poke, Linus Torvalds, (Fri Apr 25, 1:51 pm)
Re: [PATCH 1/1] x86: fix text_poke, David Miller, (Fri Apr 25, 2:02 pm)
Re: [PATCH 1/1] x86: fix text_poke, H. Peter Anvin, (Fri Apr 25, 2:11 pm)
Re: [PATCH 1/1] x86: fix text_poke, Mathieu Desnoyers, (Fri Apr 25, 2:12 pm)
Re: [PATCH 1/1] x86: fix text_poke, H. Peter Anvin, (Fri Apr 25, 2:15 pm)
Re: [PATCH 1/1] x86: fix text_poke, Mathieu Desnoyers, (Fri Apr 25, 2:47 pm)
Re: [PATCH 1/1] x86: fix text_poke, Linus Torvalds, (Fri Apr 25, 3:04 pm)
Re: [PATCH 1/1] x86: fix text_poke, H. Peter Anvin, (Fri Apr 25, 3:07 pm)
Re: [PATCH 1/1] x86: fix text_poke, Mathieu Desnoyers, (Fri Apr 25, 3:30 pm)
Re: [PATCH 1/1] x86: fix text_poke, Linus Torvalds, (Fri Apr 25, 3:36 pm)
Re: [PATCH 1/1] x86: fix text_poke, H. Peter Anvin, (Fri Apr 25, 3:38 pm)
Re: [PATCH 1/1] x86: fix text_poke, Mathieu Desnoyers, (Fri Apr 25, 4:00 pm)
Re: [PATCH 1/1] x86: fix text_poke, Jeremy Fitzhardinge, (Fri Apr 25, 4:13 pm)
Re: [PATCH 1/1] x86: fix text_poke, Masami Hiramatsu, (Fri Apr 25, 4:34 pm)
Re: [PATCH 1/1] x86: fix text_poke, Frank Ch. Eigler, (Fri Apr 25, 7:12 pm)
Re: [PATCH 1/1] x86: fix text_poke, Jeremy Fitzhardinge, (Fri Apr 25, 11:21 pm)
Re: [PATCH 1/1] x86: fix text_poke, Jeremy Fitzhardinge, (Fri Apr 25, 11:50 pm)
Re: [PATCH 1/1] x86: fix text_poke, Andi Kleen, (Sat Apr 26, 2:59 am)
Re: [PATCH 1/1] x86: fix text_poke, Jiri Slaby, (Sat Apr 26, 4:16 am)
Re: [PATCH 1/1] x86: fix text_poke, Andi Kleen, (Sat Apr 26, 4:34 am)
Re: [PATCH 1/1] x86: fix text_poke, Arnaldo Carvalho de Melo, (Sat Apr 26, 4:56 am)
Re: [PATCH 1/1] x86: fix text_poke, Jeremy Fitzhardinge, (Sat Apr 26, 4:38 pm)
Re: [PATCH 1/1] x86: fix text_poke, Arnaldo Carvalho de Melo, (Sat Apr 26, 6:00 pm)
Re: [PATCH 1/1] x86: fix text_poke, Masami Hiramatsu, (Sun Apr 27, 5:49 pm)
[PATCH 1/1] x86: fix text_poke, Jiri Slaby, (Sun Apr 27, 5:51 pm)
Re: [PATCH 1/1] x86: fix text_poke, Ingo Molnar, (Mon Apr 28, 1:21 pm)
VIRTUAL_BUG_ON(), Christoph Lameter, (Mon Apr 28, 1:24 pm)
Re: [PATCH 1/1] x86: fix text_poke, Mathieu Desnoyers, (Mon Apr 28, 1:43 pm)
Re: [PATCH 1/1] x86: fix text_poke, Jeremy Fitzhardinge, (Mon Apr 28, 1:55 pm)
Re: [PATCH 1/1] x86: fix text_poke, H. Peter Anvin, (Mon Apr 28, 2:01 pm)
Re: [PATCH 1/1] x86: fix text_poke, Jeremy Fitzhardinge, (Mon Apr 28, 2:02 pm)
Re: [PATCH 1/1] x86: fix text_poke, Mathieu Desnoyers, (Mon Apr 28, 3:42 pm)
[RFC 1/1] mm: add virt to phys debug, Jiri Slaby, (Thu May 1, 12:22 pm)
Re: [RFC 1/1] mm: add virt to phys debug, Christoph Lameter, (Thu May 1, 1:18 pm)
Re: [PATCH 1/1] x86: fix text_poke, Mathieu Desnoyers, (Sun May 4, 8:03 am)
Re: [PATCH 1/1] x86: fix text_poke, H. Peter Anvin, (Sun May 4, 9:18 am)
Re: [PATCH 1/1] x86: fix text_poke, Nick Piggin, (Sun May 4, 7:36 pm)
Re: [RFC 1/1] mm: add virt to phys debug, Jiri Slaby, (Tue May 6, 2:54 pm)
Re: [RFC 1/1] mm: add virt to phys debug, Christoph Lameter, (Wed May 7, 10:30 am)
Re: [RFC 1/1] mm: add virt to phys debug, Jiri Slaby, (Tue May 13, 7:38 am)
Re: [PATCH 1/1] x86: fix text_poke, Frank Ch. Eigler, (Thu Jun 5, 10:44 am)