Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	Waiman Long <longman@redhat.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>
Subject: Re: [PATCH v1 1/1] lockdep: Move lockdep_assert_locked() under #ifdef CONFIG_PROVE_LOCKING
Date: Sun, 15 Dec 2024 12:08:19 -0800	[thread overview]
Message-ID: <Z183M9-JIH6mG3q9@tardis.local> (raw)
In-Reply-To: <20241202193445.769567-1-andriy.shevchenko@linux.intel.com>

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
> 

      reply	other threads:[~2024-12-15 20:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z183M9-JIH6mG3q9@tardis.local \
    --to=boqun.feng@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox