Skip to contentSkip to conversation

rcu: mark lockdep_assert_rcu_helper() __always_inline

PATCH Applied Arnd Bergmann 4 participants 4 messages Feb 2 RCU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rcu: mark lockdep_assert_rcu_helper() __always_inline

From: Arnd Bergmann <[email protected]>

There are some configurations in which lockdep_assert_rcu_helper() ends up not being inlined, for some reason. This leads to a link failure because now the caller tries to pass a nonexistant __ctx_lock_RCU structure:

ld: lib/test_context-analysis.o: in function `test_rcu_assert_variants':
test_context-analysis.c:(.text+0x275c): undefined reference to `RCU'
ld: test_context-analysis.c:(.text+0x276c): undefined reference to `RCU_BH'
ld: test_context-analysis.c:(.text+0x2774): undefined reference to `RCU_SCHED'

I saw this in one out of many 32-bit arm builds using gcc-15.2, but it probably happens in others as well.

Mark this function as __always_inline to fix the build.

Fixes fe00f6e84621 ("rcu: Support Clang's context analysis")
---
 include/linux/rcupdate.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rcupdate.h +1 -1
index ea1e979b290e..7729fef249e1 100644
@@ -406,7 +406,7 @@ static inline void rcu_preempt_sleep_check(void) { }
 
 // See RCU_LOCKDEP_WARN() for an explanation of the double call to
 // debug_lockdep_rcu_enabled().
-static inline bool lockdep_assert_rcu_helper(bool c, const struct __ctx_lock_RCU *ctx)
+static __always_inline bool lockdep_assert_rcu_helper(bool c, const struct __ctx_lock_RCU *ctx)
 	__assumes_shared_ctx_lock(RCU) __assumes_shared_ctx_lock(ctx)
 {
 	return debug_lockdep_rcu_enabled() &&
Signature · 1 line
2.39.5
#1 lore raw
Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

There are some configurations in which lockdep_assert_rcu_helper() ends up not being inlined, for some reason. This leads to a link failure because now the caller tries to pass a nonexistant __ctx_lock_RCU structure:

ld: lib/test_context-analysis.o: in function `test_rcu_assert_variants':
test_context-analysis.c:(.text+0x275c): undefined reference to `RCU'
ld: test_context-analysis.c:(.text+0x276c): undefined reference to `RCU_BH'
ld: test_context-analysis.c:(.text+0x2774): undefined reference to `RCU_SCHED'

Quoted 7 lines

I saw this in one out of many 32-bit arm builds using gcc-15.2, but it probably happens in others as well.

Mark this function as __always_inline to fix the build.

Fixes fe00f6e84621 ("rcu: Support Clang's context analysis")

Thanks!

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

There are some configurations in which lockdep_assert_rcu_helper() ends up not being inlined, for some reason. This leads to a link failure because now the caller tries to pass a nonexistant __ctx_lock_RCU structure:

ld: lib/test_context-analysis.o: in function `test_rcu_assert_variants':
test_context-analysis.c:(.text+0x275c): undefined reference to `RCU'
ld: test_context-analysis.c:(.text+0x276c): undefined reference to `RCU_BH'
ld: test_context-analysis.c:(.text+0x2774): undefined reference to `RCU_SCHED'

Quoted 7 lines

I saw this in one out of many 32-bit arm builds using gcc-15.2, but it probably happens in others as well.

Mark this function as __always_inline to fix the build.

Fixes fe00f6e84621 ("rcu: Support Clang's context analysis")
Quoted 20 lines
---
 include/linux/rcupdate.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rcupdate.h +1 -1
index ea1e979b290e..7729fef249e1 100644
@@ -406,7 +406,7 @@ static inline void rcu_preempt_sleep_check(void) { }
 
 // See RCU_LOCKDEP_WARN() for an explanation of the double call to
 // debug_lockdep_rcu_enabled().
-static inline bool lockdep_assert_rcu_helper(bool c, const struct __ctx_lock_RCU *ctx)
+static __always_inline bool lockdep_assert_rcu_helper(bool c, const struct __ctx_lock_RCU *ctx)
 	__assumes_shared_ctx_lock(RCU) __assumes_shared_ctx_lock(ctx)
 {
 	return debug_lockdep_rcu_enabled() &&
Signature · 1 line
2.39.5
merge bot Applied
#3 lore raw

[tip: locking/core] rcu: Mark lockdep_assert_rcu_helper() __always_inline

In reply to Arnd Bergmann
The following commit has been merged into the locking/core branch of tip:

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     451c3a0356099483218535aed17fcf94ab5764a3
Gitweb:        https://git.kernel.org/tip/451c3a0356099483218535aed17fcf94ab5764a3
Author:        Arnd Bergmann <[email protected]>
AuthorDate:    Mon, 02 Feb 2026 10:55:01 +01:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Mon, 02 Feb 2026 22:02:49 +01:00

rcu: Mark lockdep_assert_rcu_helper() __always_inline

There are some configurations in which lockdep_assert_rcu_helper() ends up not being inlined, for some reason. This leads to a link failure because now the caller tries to pass a nonexistant __ctx_lock_RCU structure:

ld: lib/test_context-analysis.o: in function `test_rcu_assert_variants':
test_context-analysis.c:(.text+0x275c): undefined reference to `RCU'
ld: test_context-analysis.c:(.text+0x276c): undefined reference to `RCU_BH'
ld: test_context-analysis.c:(.text+0x2774): undefined reference to `RCU_SCHED'

I saw this in one out of many 32-bit arm builds using gcc-15.2, but it probably happens in others as well.

Mark this function as __always_inline to fix the build.

---
 include/linux/rcupdate.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rcupdate.h +1 -1
index d828a46..f0aa48b 100644
@@ -435,7 +435,7 @@ static inline void rcu_preempt_sleep_check(void) { }
 
 // See RCU_LOCKDEP_WARN() for an explanation of the double call to
 // debug_lockdep_rcu_enabled().
-static inline bool lockdep_assert_rcu_helper(bool c, const struct __ctx_lock_RCU *ctx)
+static __always_inline bool lockdep_assert_rcu_helper(bool c, const struct __ctx_lock_RCU *ctx)
 	__assumes_shared_ctx_lock(RCU) __assumes_shared_ctx_lock(ctx)
 {
 	return debug_lockdep_rcu_enabled() &&