[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z183M9-JIH6mG3q9@tardis.local>
Date: Sun, 15 Dec 2024 12:08:19 -0800
From: Boqun Feng <boqun.feng@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>
Subject: Re: [PATCH v1 1/1] lockdep: Move lockdep_assert_locked() under
#ifdef CONFIG_PROVE_LOCKING
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@...ux.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
>
Powered by blists - more mailing lists