[RFC PATCH 06/20] lockdep: Always inline the empty stubs called from noinstr code

From: Sasha Levin

Date: Wed Oct 28 2026 - 08:04:33 EST


With !CONFIG_PROVE_LOCKING, lockdep_hardirqs_on() and
lockdep_hardirqs_off() are empty static inline functions, and so are
lockdep_off() and lockdep_on() with !CONFIG_LOCKDEP, while the real
versions are noinstr functions and macros respectively. They are called
from noinstr code, which the compiler won't inline them into when
building with code coverage instrumentation:

vmlinux.o: warning: objtool: do_syscall_64+0x7b: call to lockdep_hardirqs_off() leaves .noinstr.text section
vmlinux.o: warning: objtool: irqentry_nmi_enter+0x4: call to lockdep_off() leaves .noinstr.text section

Make the stubs __always_inline, along with the neighbouring
lockdep_hardirqs_on_prepare() stub for consistency.

Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
include/linux/irqflags.h | 6 +++---
include/linux/lockdep.h | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
index 57b074e0cfbbb..e06004255e3d8 100644
--- a/include/linux/irqflags.h
+++ b/include/linux/irqflags.h
@@ -32,9 +32,9 @@ struct task_struct;
#else
static inline void lockdep_softirqs_on(unsigned long ip) { }
static inline void lockdep_softirqs_off(unsigned long ip) { }
- static inline void lockdep_hardirqs_on_prepare(void) { }
- static inline void lockdep_hardirqs_on(unsigned long ip) { }
- static inline void lockdep_hardirqs_off(unsigned long ip) { }
+ static __always_inline void lockdep_hardirqs_on_prepare(void) { }
+ static __always_inline void lockdep_hardirqs_on(unsigned long ip) { }
+ static __always_inline void lockdep_hardirqs_off(unsigned long ip) { }
static inline void lockdep_cleanup_dead_cpu(unsigned int cpu,
struct task_struct *idle) {}
#endif
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index a6451ecbbe9a0..85b864880d069 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -324,11 +324,11 @@ static inline void lockdep_init_task(struct task_struct *task)
{
}

-static inline void lockdep_off(void)
+static __always_inline void lockdep_off(void)
{
}

-static inline void lockdep_on(void)
+static __always_inline void lockdep_on(void)
{
}

--
2.53.0