Commit 06aeaaeabf69da4a3e86df532425640f51b01cef

Authored by Masami Hiramatsu
Committed by Steven Rostedt
1 parent 8741db532e

ftrace: Move ARCH_SUPPORTS_FTRACE_SAVE_REGS in Kconfig

Move SAVE_REGS support flag into Kconfig and rename
it to CONFIG_DYNAMIC_FTRACE_WITH_REGS. This also introduces
CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS which indicates
the architecture depending part of ftrace has a code
that saves full registers.
On the other hand, CONFIG_DYNAMIC_FTRACE_WITH_REGS indicates
the code is enabled.

Link: http://lkml.kernel.org/r/20120928081516.3560.72534.stgit@ltc138.sdl.hitachi.co.jp

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Showing 6 changed files with 16 additions and 8 deletions Side-by-side Diff

... ... @@ -44,6 +44,7 @@
44 44 select HAVE_FENTRY if X86_64
45 45 select HAVE_C_RECORDMCOUNT
46 46 select HAVE_DYNAMIC_FTRACE
  47 + select HAVE_DYNAMIC_FTRACE_WITH_REGS
47 48 select HAVE_FUNCTION_TRACER
48 49 select HAVE_FUNCTION_GRAPH_TRACER
49 50 select HAVE_FUNCTION_GRAPH_FP_TEST
arch/x86/include/asm/ftrace.h
... ... @@ -44,7 +44,6 @@
44 44  
45 45 #ifdef CONFIG_DYNAMIC_FTRACE
46 46 #define ARCH_SUPPORTS_FTRACE_OPS 1
47   -#define ARCH_SUPPORTS_FTRACE_SAVE_REGS
48 47 #endif
49 48  
50 49 #ifndef __ASSEMBLY__
include/linux/ftrace.h
... ... @@ -74,7 +74,7 @@
74 74 * SAVE_REGS - The ftrace_ops wants regs saved at each function called
75 75 * and passed to the callback. If this flag is set, but the
76 76 * architecture does not support passing regs
77   - * (ARCH_SUPPORTS_FTRACE_SAVE_REGS is not defined), then the
  77 + * (CONFIG_DYNAMIC_FTRACE_WITH_REGS is not defined), then the
78 78 * ftrace_ops will fail to register, unless the next flag
79 79 * is set.
80 80 * SAVE_REGS_IF_SUPPORTED - This is the same as SAVE_REGS, but if the
... ... @@ -418,7 +418,7 @@
418 418 #endif
419 419  
420 420 #ifndef FTRACE_REGS_ADDR
421   -#ifdef ARCH_SUPPORTS_FTRACE_SAVE_REGS
  421 +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
422 422 # define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller)
423 423 #else
424 424 # define FTRACE_REGS_ADDR FTRACE_ADDR
... ... @@ -480,7 +480,7 @@
480 480 */
481 481 extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr);
482 482  
483   -#ifdef ARCH_SUPPORTS_FTRACE_SAVE_REGS
  483 +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
484 484 /**
485 485 * ftrace_modify_call - convert from one addr to another (no nop)
486 486 * @rec: the mcount call site record
kernel/trace/Kconfig
... ... @@ -39,6 +39,9 @@
39 39 help
40 40 See Documentation/trace/ftrace-design.txt
41 41  
  42 +config HAVE_DYNAMIC_FTRACE_WITH_REGS
  43 + bool
  44 +
42 45 config HAVE_FTRACE_MCOUNT_RECORD
43 46 bool
44 47 help
... ... @@ -433,6 +436,11 @@
433 436 wakes up once a second and checks to see if any ftrace calls
434 437 were made. If so, it runs stop_machine (stops all CPUS)
435 438 and modifies the code to jump over the call to ftrace.
  439 +
  440 +config DYNAMIC_FTRACE_WITH_REGS
  441 + def_bool y
  442 + depends on DYNAMIC_FTRACE
  443 + depends on HAVE_DYNAMIC_FTRACE_WITH_REGS
436 444  
437 445 config FUNCTION_PROFILER
438 446 bool "Kernel function profiler"
kernel/trace/ftrace.c
... ... @@ -337,7 +337,7 @@
337 337 if ((ops->flags & FL_GLOBAL_CONTROL_MASK) == FL_GLOBAL_CONTROL_MASK)
338 338 return -EINVAL;
339 339  
340   -#ifndef ARCH_SUPPORTS_FTRACE_SAVE_REGS
  340 +#ifndef CONFIG_DYNAMIC_FTRACE_WITH_REGS
341 341 /*
342 342 * If the ftrace_ops specifies SAVE_REGS, then it only can be used
343 343 * if the arch supports it, or SAVE_REGS_IF_SUPPORTED is also set.
... ... @@ -4143,8 +4143,8 @@
4143 4143 * Archs are to support both the regs and ftrace_ops at the same time.
4144 4144 * If they support ftrace_ops, it is assumed they support regs.
4145 4145 * If call backs want to use regs, they must either check for regs
4146   - * being NULL, or ARCH_SUPPORTS_FTRACE_SAVE_REGS.
4147   - * Note, ARCH_SUPPORT_SAVE_REGS expects a full regs to be saved.
  4146 + * being NULL, or CONFIG_DYNAMIC_FTRACE_WITH_REGS.
  4147 + * Note, CONFIG_DYNAMIC_FTRACE_WITH_REGS expects a full regs to be saved.
4148 4148 * An architecture can pass partial regs with ftrace_ops and still
4149 4149 * set the ARCH_SUPPORT_FTARCE_OPS.
4150 4150 */
kernel/trace/trace_selftest.c
... ... @@ -568,7 +568,7 @@
568 568 int ret;
569 569 int supported = 0;
570 570  
571   -#ifdef ARCH_SUPPORTS_FTRACE_SAVE_REGS
  571 +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
572 572 supported = 1;
573 573 #endif
574 574