From: Magnus Lindholm <linmag7@gmail.com>
To: richard.henderson@linaro.org, mattst88@gmail.com,
linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org
Cc: glaubitz@physik.fu-berlin.de, mcree@orcon.net.nz,
ink@unseen.parts, macro@orcam.me.uk,
Magnus Lindholm <linmag7@gmail.com>
Subject: [PATCH v2 5/8] alpha: provide ftrace return address support for lockdep
Date: Fri, 29 May 2026 16:22:01 +0200 [thread overview]
Message-ID: <20260529142322.1362438-6-linmag7@gmail.com> (raw)
In-Reply-To: <20260529142322.1362438-1-linmag7@gmail.com>
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.
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
---
arch/alpha/include/asm/ftrace.h | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/arch/alpha/include/asm/ftrace.h b/arch/alpha/include/asm/ftrace.h
index 40a8c178f10d..7ec44134c804 100644
--- a/arch/alpha/include/asm/ftrace.h
+++ b/arch/alpha/include/asm/ftrace.h
@@ -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 */
--
2.53.0
next prev parent reply other threads:[~2026-05-29 14:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 14:21 [PATCH v2 0/8] alpha: enable generic entry infrastructure Magnus Lindholm
2026-05-29 14:21 ` [PATCH v2 1/8] alpha: enable regset-based ptrace and core dumps Magnus Lindholm
2026-05-29 14:21 ` [PATCH v2 2/8] alpha: add ARCH_STACKWALK-based stacktrace support Magnus Lindholm
2026-05-29 14:21 ` [PATCH v2 3/8] alpha: make irqflags helpers operate on IPL state Magnus Lindholm
2026-05-29 14:22 ` [PATCH v2 4/8] alpha: initialize PCI sysfs bin attributes for lockdep Magnus Lindholm
2026-05-29 14:22 ` Magnus Lindholm [this message]
2026-05-29 14:22 ` [PATCH v2 6/8] alpha: use raw spinlocks for low-level platform locks Magnus Lindholm
2026-05-29 14:22 ` [PATCH v2 7/8] alpha: enable lockdep hardirq state tracking Magnus Lindholm
2026-05-29 14:22 ` [PATCH v2 8/8] alpha: enable GENERIC_ENTRY and GENERIC_IRQ_ENTRY Magnus Lindholm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260529142322.1362438-6-linmag7@gmail.com \
--to=linmag7@gmail.com \
--cc=glaubitz@physik.fu-berlin.de \
--cc=ink@unseen.parts \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=macro@orcam.me.uk \
--cc=mattst88@gmail.com \
--cc=mcree@orcon.net.nz \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox