mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
parisc/ftrace: use static key to enable/disable function graph tracer
This avoids using dereference_function_descriptor in the ftrace code path, and it's also faster. Signed-off-by: Sven Schnelle <svens@stackframe.org> Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
parent
44382af893
commit
98f2926171
1 changed files with 6 additions and 3 deletions
|
@ -15,6 +15,7 @@
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <linux/kprobes.h>
|
#include <linux/kprobes.h>
|
||||||
#include <linux/ptrace.h>
|
#include <linux/ptrace.h>
|
||||||
|
#include <linux/jump_label.h>
|
||||||
|
|
||||||
#include <asm/assembly.h>
|
#include <asm/assembly.h>
|
||||||
#include <asm/sections.h>
|
#include <asm/sections.h>
|
||||||
|
@ -24,6 +25,8 @@
|
||||||
#define __hot __section(".text.hot")
|
#define __hot __section(".text.hot")
|
||||||
|
|
||||||
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
||||||
|
static DEFINE_STATIC_KEY_FALSE(ftrace_graph_enable);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hook the return address and push it in the stack of return addrs
|
* Hook the return address and push it in the stack of return addrs
|
||||||
* in current thread info.
|
* in current thread info.
|
||||||
|
@ -60,9 +63,7 @@ void notrace __hot ftrace_function_trampoline(unsigned long parent,
|
||||||
ftrace_func(self_addr, parent, function_trace_op, fregs);
|
ftrace_func(self_addr, parent, function_trace_op, fregs);
|
||||||
|
|
||||||
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
||||||
if (dereference_function_descriptor(ftrace_graph_return) !=
|
if (static_branch_unlikely(&ftrace_graph_enable)) {
|
||||||
dereference_function_descriptor(ftrace_stub) ||
|
|
||||||
ftrace_graph_entry != ftrace_graph_entry_stub) {
|
|
||||||
unsigned long *parent_rp;
|
unsigned long *parent_rp;
|
||||||
|
|
||||||
/* calculate pointer to %rp in stack */
|
/* calculate pointer to %rp in stack */
|
||||||
|
@ -80,11 +81,13 @@ void notrace __hot ftrace_function_trampoline(unsigned long parent,
|
||||||
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
||||||
int ftrace_enable_ftrace_graph_caller(void)
|
int ftrace_enable_ftrace_graph_caller(void)
|
||||||
{
|
{
|
||||||
|
static_key_enable(&ftrace_graph_enable.key);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ftrace_disable_ftrace_graph_caller(void)
|
int ftrace_disable_ftrace_graph_caller(void)
|
||||||
{
|
{
|
||||||
|
static_key_enable(&ftrace_graph_enable.key);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue