[PATCH v3 16/22] context_tracking: Mark exception_enter() and exception_exit() notrace

From: Song Liu

Date: Mon Nov 30 2026 - 23:27:11 EST


The tracing code uses preempt_enable_notrace(), which calls
preempt_schedule_notrace(). Tracing can happen before the kernel has
left user context, so preempt_schedule_notrace() calls exception_enter()
to leave it before calling the scheduler. exception_enter() therefore
runs while RCU may not be watching. exception_enter() and
exception_exit() are plain inline functions, so an out-of-line copy is
untraced only because inline implies notrace. With clang, a powerpc
ppc64le_defconfig build has such a copy of exception_enter(), called
from preempt_schedule_notrace().

Mark them notrace explicitly. No functional change.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Song Liu <song@xxxxxxxxxx>
---
include/linux/context_tracking.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index af9fe87a0922..0059328995cc 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -48,7 +48,7 @@ static __always_inline void user_exit_irqoff(void)
__ct_user_exit(CT_STATE_USER);
}

-static inline enum ctx_state exception_enter(void)
+static inline enum ctx_state notrace exception_enter(void)
{
enum ctx_state prev_ctx;

@@ -63,7 +63,7 @@ static inline enum ctx_state exception_enter(void)
return prev_ctx;
}

-static inline void exception_exit(enum ctx_state prev_ctx)
+static inline void notrace exception_exit(enum ctx_state prev_ctx)
{
if (!IS_ENABLED(CONFIG_HAVE_CONTEXT_TRACKING_USER_OFFSTACK) &&
context_tracking_enabled()) {
--
2.53.1-Meta