aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/entry_32.S3
-rw-r--r--arch/x86/kernel/entry_64.S3
-rw-r--r--arch/x86/kernel/ftrace.c7
3 files changed, 12 insertions, 1 deletions
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 826682abed1d..43ceb3f454bf 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -1196,6 +1196,9 @@ ENTRY(mcount)
1196#ifdef CONFIG_FUNCTION_GRAPH_TRACER 1196#ifdef CONFIG_FUNCTION_GRAPH_TRACER
1197 cmpl $ftrace_stub, ftrace_graph_return 1197 cmpl $ftrace_stub, ftrace_graph_return
1198 jnz ftrace_graph_caller 1198 jnz ftrace_graph_caller
1199
1200 cmpl $ftrace_graph_entry_stub, ftrace_graph_entry
1201 jnz ftrace_graph_caller
1199#endif 1202#endif
1200.globl ftrace_stub 1203.globl ftrace_stub
1201ftrace_stub: 1204ftrace_stub:
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 9060ba6497e2..54e0bbdccb99 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -120,6 +120,9 @@ ENTRY(mcount)
120#ifdef CONFIG_FUNCTION_GRAPH_TRACER 120#ifdef CONFIG_FUNCTION_GRAPH_TRACER
121 cmpq $ftrace_stub, ftrace_graph_return 121 cmpq $ftrace_stub, ftrace_graph_return
122 jnz ftrace_graph_caller 122 jnz ftrace_graph_caller
123
124 cmpq $ftrace_graph_entry_stub, ftrace_graph_entry
125 jnz ftrace_graph_caller
123#endif 126#endif
124 127
125.globl ftrace_stub 128.globl ftrace_stub
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index adba8e9a427c..d278ad2ebda2 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -425,6 +425,7 @@ static void pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret)
425 trace->calltime = current->ret_stack[index].calltime; 425 trace->calltime = current->ret_stack[index].calltime;
426 trace->overrun = atomic_read(&current->trace_overrun); 426 trace->overrun = atomic_read(&current->trace_overrun);
427 trace->depth = index; 427 trace->depth = index;
428 barrier();
428 current->curr_ret_stack--; 429 current->curr_ret_stack--;
429} 430}
430 431
@@ -506,7 +507,11 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
506 } 507 }
507 508
508 trace.func = self_addr; 509 trace.func = self_addr;
509 ftrace_graph_entry(&trace);
510 510
511 /* Only trace if the calling function expects to */
512 if (!ftrace_graph_entry(&trace)) {
513 current->curr_ret_stack--;
514 *parent = old;
515 }
511} 516}
512#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 517#endif /* CONFIG_FUNCTION_GRAPH_TRACER */