* [PATCH v1 1/1] lockdep: Move lockdep_assert_locked() under #ifdef CONFIG_PROVE_LOCKING
@ 2024-12-02 19:34 Andy Shevchenko
2024-12-15 20:08 ` Boqun Feng
2024-12-24 18:53 ` [tip: locking/core] " tip-bot2 for Andy Shevchenko
0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2024-12-02 19:34 UTC (permalink / raw)
To: linux-kernel, llvm
Cc: Peter Zijlstra, Ingo Molnar, Will Deacon, Waiman Long, Boqun Feng,
Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
Andy Shevchenko
When lockdep_assert_locked() is unused, it prevents kernel builds
with clang, `make W=1` and CONFIG_WERROR=y:
kernel/locking/lockdep.c:160:20: error: unused function 'lockdep_assert_locked' [-Werror,-Wunused-function]
Fix this by moving it under the respective ifdeffery.
See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
inline functions for W=1 build").
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
kernel/locking/lockdep.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 2d8ec0351ef9..bb65abfcfa71 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -157,10 +157,12 @@ static inline void lockdep_unlock(void)
__this_cpu_dec(lockdep_recursion);
}
+#ifdef CONFIG_PROVE_LOCKING
static inline bool lockdep_assert_locked(void)
{
return DEBUG_LOCKS_WARN_ON(__owner != current);
}
+#endif
static struct task_struct *lockdep_selftest_task_struct;
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] lockdep: Move lockdep_assert_locked() under #ifdef CONFIG_PROVE_LOCKING
2024-12-02 19:34 [PATCH v1 1/1] lockdep: Move lockdep_assert_locked() under #ifdef CONFIG_PROVE_LOCKING Andy Shevchenko
@ 2024-12-15 20:08 ` Boqun Feng
2024-12-24 18:53 ` [tip: locking/core] " tip-bot2 for Andy Shevchenko
1 sibling, 0 replies; 3+ messages in thread
From: Boqun Feng @ 2024-12-15 20:08 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-kernel, llvm, Peter Zijlstra, Ingo Molnar, Will Deacon,
Waiman Long, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
Justin Stitt
On Mon, Dec 02, 2024 at 09:34:45PM +0200, Andy Shevchenko wrote:
> When lockdep_assert_locked() is unused, it prevents kernel builds
> with clang, `make W=1` and CONFIG_WERROR=y:
>
> kernel/locking/lockdep.c:160:20: error: unused function 'lockdep_assert_locked' [-Werror,-Wunused-function]
>
> Fix this by moving it under the respective ifdeffery.
>
> See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
> inline functions for W=1 build").
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Queued for more testing, thanks!
Regards,
Boqun
> ---
> kernel/locking/lockdep.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 2d8ec0351ef9..bb65abfcfa71 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -157,10 +157,12 @@ static inline void lockdep_unlock(void)
> __this_cpu_dec(lockdep_recursion);
> }
>
> +#ifdef CONFIG_PROVE_LOCKING
> static inline bool lockdep_assert_locked(void)
> {
> return DEBUG_LOCKS_WARN_ON(__owner != current);
> }
> +#endif
>
> static struct task_struct *lockdep_selftest_task_struct;
>
> --
> 2.43.0.rc1.1336.g36b5255a03ac
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip: locking/core] lockdep: Move lockdep_assert_locked() under #ifdef CONFIG_PROVE_LOCKING
2024-12-02 19:34 [PATCH v1 1/1] lockdep: Move lockdep_assert_locked() under #ifdef CONFIG_PROVE_LOCKING Andy Shevchenko
2024-12-15 20:08 ` Boqun Feng
@ 2024-12-24 18:53 ` tip-bot2 for Andy Shevchenko
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Andy Shevchenko @ 2024-12-24 18:53 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Andy Shevchenko, Boqun Feng, x86, linux-kernel
The following commit has been merged into the locking/core branch of tip:
Commit-ID: 3430600925859be3c8588b8220173758c7860e8c
Gitweb: https://git.kernel.org/tip/3430600925859be3c8588b8220173758c7860e8c
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate: Mon, 02 Dec 2024 21:34:45 +02:00
Committer: Boqun Feng <boqun.feng@gmail.com>
CommitterDate: Thu, 19 Dec 2024 14:04:03 -08:00
lockdep: Move lockdep_assert_locked() under #ifdef CONFIG_PROVE_LOCKING
When lockdep_assert_locked() is unused, it prevents kernel builds
with clang, `make W=1` and CONFIG_WERROR=y, CONFIG_LOCKDEP=y and
CONFIG_PROVE_LOCKING=n:
kernel/locking/lockdep.c:160:20: error: unused function 'lockdep_assert_locked' [-Werror,-Wunused-function]
Fix this by moving it under the respective ifdeffery.
See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
inline functions for W=1 build").
[Boqun: add more config information of the error]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://lore.kernel.org/r/20241202193445.769567-1-andriy.shevchenko@linux.intel.com
---
kernel/locking/lockdep.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index fe04a21..29acd23 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -157,10 +157,12 @@ static inline void lockdep_unlock(void)
__this_cpu_dec(lockdep_recursion);
}
+#ifdef CONFIG_PROVE_LOCKING
static inline bool lockdep_assert_locked(void)
{
return DEBUG_LOCKS_WARN_ON(__owner != current);
}
+#endif
static struct task_struct *lockdep_selftest_task_struct;
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-24 18:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-02 19:34 [PATCH v1 1/1] lockdep: Move lockdep_assert_locked() under #ifdef CONFIG_PROVE_LOCKING Andy Shevchenko
2024-12-15 20:08 ` Boqun Feng
2024-12-24 18:53 ` [tip: locking/core] " tip-bot2 for Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox