linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] x86: use new text_poke_bp in ftrace
@ 2013-10-18 14:27 Petr Mladek
  2013-10-18 14:38 ` Frederic Weisbecker
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Mladek @ 2013-10-18 14:27 UTC (permalink / raw)
  To: Steven Rostedt, Frederic Weisbecker, Masami Hiramatsu, Jiri Kosina
  Cc: linux-kernel, x86

The commit fd4363fff3d9 (x86: Introduce int3 (breakpoint)-based instruction
patching) uses the same technique that has been used in ftrace since 08d636b
("ftrace/x86: Have arch x86_64 use breakpoints instead of stop machine")

This patch set merge the two implemetations and remove duplicities from
the ftrace side.

The first three patches speed up and extend the existing text_poke_bp
function to be usable in ftrace. All the changes are based on ideas
already used in ftrace. They need to be moved to the generic framework
to keep the functinality and efficiency.

The other three patches modifies different parts of the current
x86-specific ftrace implemetation and use text_poke_bp there.

The result is an improved generic code that has already been used
in jump labels and kprobe. It reduces the amount of arch-specific
ftrace code. It is also a bit faster. For example, I tried to modify
the ftrace function, enable, and disable the tracer in a cycle.
With 9 different trace functions and 500 cycles, I got these times:

	original code:                  with this patch set:

	real    20m8.123s               real    18m47.042s
	user    0m0.004s                user    0m0.008s
	sys     0m28.400s               sys     0m42.760s

	real    19m59.777s              real    18m41.668s
	user    0m0.004s                user    0m0.000s
	sys     0m28.344s               sys     0m43.576s

	real    19m57.598s              real    18m38.203s
	user    0m0.004s                user    0m0.004s
	sys     0m28.728s               sys     0m43.104s

This is my first patch set for Linux kernel. I did a lot of checks
and test but it is possible that I have missed something. I am looking
forward to hear your opinion, hints and update the patches accordingly.

The patches are agaist kernel/git/tip/tip.git on top of the commit
f3db36699379159b761cdbc (Merge branch 'sched/core').

Petr Mladek (6)
  x86: speed up int3-based patching using less paranoid
  x86: allow to call text_poke_bp during boot
  x86: allow to modify more instructions in one
  x86: modify ftrace function using the new int3-based
  x86: patch all traced function calls using the
  x86: enable/disable ftrace graph call using new

 arch/x86/include/asm/alternative.h |   3 +-
 arch/x86/kernel/alternative.c      | 135 ++++++--
 arch/x86/kernel/ftrace.c           | 605 ++++++++---------------------------
 arch/x86/kernel/jump_label.c       |   3 +-
 arch/x86/kernel/kprobes/opt.c      |   8 +-
 arch/x86/kernel/traps.c            |  10 -
 lib/bsearch.c                      |   2 +-
 7 files changed, 264 insertions(+), 502 deletions(-)

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

* Re: [PATCH 0/6] x86: use new text_poke_bp in ftrace
  2013-10-18 14:27 [PATCH 0/6] x86: use new text_poke_bp in ftrace Petr Mladek
@ 2013-10-18 14:38 ` Frederic Weisbecker
  0 siblings, 0 replies; 2+ messages in thread
From: Frederic Weisbecker @ 2013-10-18 14:38 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Steven Rostedt, Masami Hiramatsu, Jiri Kosina, linux-kernel, x86

On Fri, Oct 18, 2013 at 04:27:19PM +0200, Petr Mladek wrote:
[...]
> 
>  arch/x86/include/asm/alternative.h |   3 +-
>  arch/x86/kernel/alternative.c      | 135 ++++++--
>  arch/x86/kernel/ftrace.c           | 605 ++++++++---------------------------
>  arch/x86/kernel/jump_label.c       |   3 +-
>  arch/x86/kernel/kprobes/opt.c      |   8 +-
>  arch/x86/kernel/traps.c            |  10 -
>  lib/bsearch.c                      |   2 +-
>  7 files changed, 264 insertions(+), 502 deletions(-)

Nice!

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

end of thread, other threads:[~2013-10-18 14:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-18 14:27 [PATCH 0/6] x86: use new text_poke_bp in ftrace Petr Mladek
2013-10-18 14:38 ` Frederic Weisbecker

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