alpha: provide ftrace return address support for lockdep

Lockdep uses ftrace_return_address() to report useful call sites for
lock acquisition and IRQ-state tracking diagnostics. Provide the Alpha
architecture hook using the compiler return-address builtin when frame
pointers are available.

Return zero when frame pointers are disabled, matching the existing
fallback behavior of architectures that cannot provide a reliable return
address.

This is a preparatory change for enabling lockdep support on Alpha.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
Link: https://lore.kernel.org/r/20260706170019.2941459-5-linmag7@gmail.com
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
This commit is contained in:
Magnus Lindholm 2026-07-06 18:56:45 +02:00
parent 05dc12d664
commit cfdf5b879d

View File

@ -1 +1,29 @@
/* empty */
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_ALPHA_FTRACE_H
#define _ASM_ALPHA_FTRACE_H
#ifdef CONFIG_FRAME_POINTER
static void *alpha_ftrace_return_address0(void)
noinline notrace;
static void *alpha_ftrace_return_address0(void)
{
return __builtin_return_address(0);
}
#define ftrace_return_address0 alpha_ftrace_return_address0()
/*
* __builtin_return_address() requires a constant integer argument.
* Keep this as a macro so the value is seen at the callsite.
*/
#define ftrace_return_address(n) __builtin_return_address(n)
#else /* !CONFIG_FRAME_POINTER */
#define ftrace_return_address0 0UL
#define ftrace_return_address(n) ((void)(n), 0UL)
#endif /* CONFIG_FRAME_POINTER */
#endif /* _ASM_ALPHA_FTRACE_H */