Skip to content

Commit 06aeaae

Browse files
mhiramathitachirostedt
authored andcommitted
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/[email protected] Cc: Ingo Molnar <[email protected]> Cc: Ananth N Mavinakayanahalli <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Frederic Weisbecker <[email protected]> Signed-off-by: Masami Hiramatsu <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
1 parent 8741db5 commit 06aeaae

File tree

6 files changed

+16
-8
lines changed

6 files changed

+16
-8
lines changed

arch/x86/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ config X86
4444
select HAVE_FENTRY if X86_64
4545
select HAVE_C_RECORDMCOUNT
4646
select HAVE_DYNAMIC_FTRACE
47+
select HAVE_DYNAMIC_FTRACE_WITH_REGS
4748
select HAVE_FUNCTION_TRACER
4849
select HAVE_FUNCTION_GRAPH_TRACER
4950
select HAVE_FUNCTION_GRAPH_FP_TEST

arch/x86/include/asm/ftrace.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444

4545
#ifdef CONFIG_DYNAMIC_FTRACE
4646
#define ARCH_SUPPORTS_FTRACE_OPS 1
47-
#define ARCH_SUPPORTS_FTRACE_SAVE_REGS
4847
#endif
4948

5049
#ifndef __ASSEMBLY__

include/linux/ftrace.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
7474
* SAVE_REGS - The ftrace_ops wants regs saved at each function called
7575
* and passed to the callback. If this flag is set, but the
7676
* 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
7878
* ftrace_ops will fail to register, unless the next flag
7979
* is set.
8080
* SAVE_REGS_IF_SUPPORTED - This is the same as SAVE_REGS, but if the
@@ -418,7 +418,7 @@ void ftrace_modify_all_code(int command);
418418
#endif
419419

420420
#ifndef FTRACE_REGS_ADDR
421-
#ifdef ARCH_SUPPORTS_FTRACE_SAVE_REGS
421+
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
422422
# define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller)
423423
#else
424424
# define FTRACE_REGS_ADDR FTRACE_ADDR
@@ -480,7 +480,7 @@ extern int ftrace_make_nop(struct module *mod,
480480
*/
481481
extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr);
482482

483-
#ifdef ARCH_SUPPORTS_FTRACE_SAVE_REGS
483+
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
484484
/**
485485
* ftrace_modify_call - convert from one addr to another (no nop)
486486
* @rec: the mcount call site record

kernel/trace/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ config HAVE_DYNAMIC_FTRACE
3939
help
4040
See Documentation/trace/ftrace-design.txt
4141

42+
config HAVE_DYNAMIC_FTRACE_WITH_REGS
43+
bool
44+
4245
config HAVE_FTRACE_MCOUNT_RECORD
4346
bool
4447
help
@@ -434,6 +437,11 @@ config DYNAMIC_FTRACE
434437
were made. If so, it runs stop_machine (stops all CPUS)
435438
and modifies the code to jump over the call to ftrace.
436439

440+
config DYNAMIC_FTRACE_WITH_REGS
441+
def_bool y
442+
depends on DYNAMIC_FTRACE
443+
depends on HAVE_DYNAMIC_FTRACE_WITH_REGS
444+
437445
config FUNCTION_PROFILER
438446
bool "Kernel function profiler"
439447
depends on FUNCTION_TRACER

kernel/trace/ftrace.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ static int __register_ftrace_function(struct ftrace_ops *ops)
337337
if ((ops->flags & FL_GLOBAL_CONTROL_MASK) == FL_GLOBAL_CONTROL_MASK)
338338
return -EINVAL;
339339

340-
#ifndef ARCH_SUPPORTS_FTRACE_SAVE_REGS
340+
#ifndef CONFIG_DYNAMIC_FTRACE_WITH_REGS
341341
/*
342342
* If the ftrace_ops specifies SAVE_REGS, then it only can be used
343343
* if the arch supports it, or SAVE_REGS_IF_SUPPORTED is also set.
@@ -4143,8 +4143,8 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
41434143
* Archs are to support both the regs and ftrace_ops at the same time.
41444144
* If they support ftrace_ops, it is assumed they support regs.
41454145
* 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.
41484148
* An architecture can pass partial regs with ftrace_ops and still
41494149
* set the ARCH_SUPPORT_FTARCE_OPS.
41504150
*/

kernel/trace/trace_selftest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ trace_selftest_function_regs(void)
568568
int ret;
569569
int supported = 0;
570570

571-
#ifdef ARCH_SUPPORTS_FTRACE_SAVE_REGS
571+
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
572572
supported = 1;
573573
#endif
574574

0 commit comments

Comments
 (0)