mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 17:22:07 +00:00
function_graph: Everyone uses HAVE_FUNCTION_GRAPH_RET_ADDR_PTR, remove it
All architectures that implement function graph also implements HAVE_FUNCTION_GRAPH_RET_ADDR_PTR. Remove it, as it is no longer a differentiator. Link: https://lore.kernel.org/linux-trace-kernel/20240611031737.982047614@goodmis.org Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Guo Ren <guoren@kernel.org> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: WANG Xuerui <kernel@xen0n.name> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com> Cc: Paul Walmsley <paul.walmsley@sifive.com> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Christian Borntraeger <borntraeger@linux.ibm.com> Cc: Sven Schnelle <svens@linux.ibm.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
parent
29c1c24a27
commit
5f7fb89a11
@ -217,18 +217,6 @@ along to ftrace_push_return_trace() instead of a stub value of 0.
|
|||||||
|
|
||||||
Similarly, when you call ftrace_return_to_handler(), pass it the frame pointer.
|
Similarly, when you call ftrace_return_to_handler(), pass it the frame pointer.
|
||||||
|
|
||||||
HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
|
||||||
--------------------------------
|
|
||||||
|
|
||||||
An arch may pass in a pointer to the return address on the stack. This
|
|
||||||
prevents potential stack unwinding issues where the unwinder gets out of
|
|
||||||
sync with ret_stack and the wrong addresses are reported by
|
|
||||||
ftrace_graph_ret_addr().
|
|
||||||
|
|
||||||
Adding support for it is easy: just define the macro in asm/ftrace.h and
|
|
||||||
pass the return address pointer as the 'retp' argument to
|
|
||||||
ftrace_push_return_trace().
|
|
||||||
|
|
||||||
HAVE_SYSCALL_TRACEPOINTS
|
HAVE_SYSCALL_TRACEPOINTS
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
|
@ -12,17 +12,6 @@
|
|||||||
|
|
||||||
#define HAVE_FUNCTION_GRAPH_FP_TEST
|
#define HAVE_FUNCTION_GRAPH_FP_TEST
|
||||||
|
|
||||||
/*
|
|
||||||
* HAVE_FUNCTION_GRAPH_RET_ADDR_PTR means that the architecture can provide a
|
|
||||||
* "return address pointer" which can be used to uniquely identify a return
|
|
||||||
* address which has been overwritten.
|
|
||||||
*
|
|
||||||
* On arm64 we use the address of the caller's frame record, which remains the
|
|
||||||
* same for the lifetime of the instrumented function, unlike the return
|
|
||||||
* address in the LR.
|
|
||||||
*/
|
|
||||||
#define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
|
||||||
|
|
||||||
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_ARGS
|
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_ARGS
|
||||||
#define ARCH_SUPPORTS_FTRACE_OPS 1
|
#define ARCH_SUPPORTS_FTRACE_OPS 1
|
||||||
#else
|
#else
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
#define HAVE_FUNCTION_GRAPH_FP_TEST
|
#define HAVE_FUNCTION_GRAPH_FP_TEST
|
||||||
|
|
||||||
#define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
|
||||||
|
|
||||||
#define ARCH_SUPPORTS_FTRACE_OPS 1
|
#define ARCH_SUPPORTS_FTRACE_OPS 1
|
||||||
|
|
||||||
#define MCOUNT_ADDR ((unsigned long)_mcount)
|
#define MCOUNT_ADDR ((unsigned long)_mcount)
|
||||||
|
@ -28,7 +28,6 @@ struct dyn_ftrace;
|
|||||||
struct dyn_arch_ftrace { };
|
struct dyn_arch_ftrace { };
|
||||||
|
|
||||||
#define ARCH_SUPPORTS_FTRACE_OPS 1
|
#define ARCH_SUPPORTS_FTRACE_OPS 1
|
||||||
#define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
|
||||||
|
|
||||||
#define ftrace_init_nop ftrace_init_nop
|
#define ftrace_init_nop ftrace_init_nop
|
||||||
int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
|
int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
#define MCOUNT_ADDR ((unsigned long)(_mcount))
|
#define MCOUNT_ADDR ((unsigned long)(_mcount))
|
||||||
#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
|
#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
|
||||||
|
|
||||||
#define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
|
||||||
|
|
||||||
/* Ignore unused weak functions which will have larger offsets */
|
/* Ignore unused weak functions which will have larger offsets */
|
||||||
#if defined(CONFIG_MPROFILE_KERNEL) || defined(CONFIG_ARCH_USING_PATCHABLE_FUNCTION_ENTRY)
|
#if defined(CONFIG_MPROFILE_KERNEL) || defined(CONFIG_ARCH_USING_PATCHABLE_FUNCTION_ENTRY)
|
||||||
#define FTRACE_MCOUNT_MAX_OFFSET 16
|
#define FTRACE_MCOUNT_MAX_OFFSET 16
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#if defined(CONFIG_FUNCTION_GRAPH_TRACER) && defined(CONFIG_FRAME_POINTER)
|
#if defined(CONFIG_FUNCTION_GRAPH_TRACER) && defined(CONFIG_FRAME_POINTER)
|
||||||
#define HAVE_FUNCTION_GRAPH_FP_TEST
|
#define HAVE_FUNCTION_GRAPH_FP_TEST
|
||||||
#endif
|
#endif
|
||||||
#define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
|
||||||
|
|
||||||
#define ARCH_SUPPORTS_FTRACE_OPS 1
|
#define ARCH_SUPPORTS_FTRACE_OPS 1
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#ifndef _ASM_S390_FTRACE_H
|
#ifndef _ASM_S390_FTRACE_H
|
||||||
#define _ASM_S390_FTRACE_H
|
#define _ASM_S390_FTRACE_H
|
||||||
|
|
||||||
#define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
|
||||||
#define ARCH_SUPPORTS_FTRACE_OPS 1
|
#define ARCH_SUPPORTS_FTRACE_OPS 1
|
||||||
#define MCOUNT_INSN_SIZE 6
|
#define MCOUNT_INSN_SIZE 6
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
#define ARCH_SUPPORTS_FTRACE_OPS 1
|
#define ARCH_SUPPORTS_FTRACE_OPS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
extern void __fentry__(void);
|
extern void __fentry__(void);
|
||||||
|
|
||||||
|
@ -1071,9 +1071,7 @@ struct ftrace_ret_stack {
|
|||||||
#ifdef HAVE_FUNCTION_GRAPH_FP_TEST
|
#ifdef HAVE_FUNCTION_GRAPH_FP_TEST
|
||||||
unsigned long fp;
|
unsigned long fp;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
|
||||||
unsigned long *retp;
|
unsigned long *retp;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -593,9 +593,7 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func,
|
|||||||
#ifdef HAVE_FUNCTION_GRAPH_FP_TEST
|
#ifdef HAVE_FUNCTION_GRAPH_FP_TEST
|
||||||
ret_stack->fp = frame_pointer;
|
ret_stack->fp = frame_pointer;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
|
||||||
ret_stack->retp = retp;
|
ret_stack->retp = retp;
|
||||||
#endif
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -887,10 +885,8 @@ ftrace_graph_get_ret_stack(struct task_struct *task, int idx)
|
|||||||
* will be assigned that location so that if called again, it will continue
|
* will be assigned that location so that if called again, it will continue
|
||||||
* where it left off.
|
* where it left off.
|
||||||
*
|
*
|
||||||
* @retp is a pointer to the return address on the stack. It's ignored if
|
* @retp is a pointer to the return address on the stack.
|
||||||
* the arch doesn't have HAVE_FUNCTION_GRAPH_RET_ADDR_PTR defined.
|
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
|
||||||
unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
|
unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
|
||||||
unsigned long ret, unsigned long *retp)
|
unsigned long ret, unsigned long *retp)
|
||||||
{
|
{
|
||||||
@ -926,35 +922,6 @@ unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#else /* !HAVE_FUNCTION_GRAPH_RET_ADDR_PTR */
|
|
||||||
unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
|
|
||||||
unsigned long ret, unsigned long *retp)
|
|
||||||
{
|
|
||||||
struct ftrace_ret_stack *ret_stack;
|
|
||||||
unsigned long return_handler = (unsigned long)dereference_kernel_function_descriptor(return_to_handler);
|
|
||||||
int offset = task->curr_ret_stack;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (ret != return_handler)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (!idx)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
i = *idx;
|
|
||||||
do {
|
|
||||||
ret_stack = get_ret_stack(task, offset, &offset);
|
|
||||||
if (ret_stack && ret_stack->ret == return_handler)
|
|
||||||
continue;
|
|
||||||
i--;
|
|
||||||
} while (i >= 0 && ret_stack);
|
|
||||||
|
|
||||||
if (ret_stack)
|
|
||||||
return ret_stack->ret;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif /* HAVE_FUNCTION_GRAPH_RET_ADDR_PTR */
|
|
||||||
|
|
||||||
static struct ftrace_ops graph_ops = {
|
static struct ftrace_ops graph_ops = {
|
||||||
.func = ftrace_graph_func,
|
.func = ftrace_graph_func,
|
||||||
|
Loading…
Reference in New Issue
Block a user