From: Boqun Feng <boqun.feng@gmail.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
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: Mark chain_hlock_class_idx() with __maybe_unused
Date: Mon, 20 Jan 2025 09:00:23 -0800 [thread overview]
Message-ID: <Z46BJ8FhWCIXbM7p@boqun-archlinux> (raw)
In-Reply-To: <Z44FHR2Z_i54PHfJ@gmail.com>
On Mon, Jan 20, 2025 at 09:11:09AM +0100, Ingo Molnar wrote:
>
> * Boqun Feng <boqun.feng@gmail.com> wrote:
>
> > On Sun, Dec 15, 2024 at 11:21:36PM +0200, Andy Shevchenko wrote:
> > > On Sun, Dec 15, 2024 at 11:55:08AM -0800, Boqun Feng wrote:
> > > > On Mon, Dec 09, 2024 at 07:08:10PM +0200, Andy Shevchenko wrote:
> > > > > When chain_hlock_class_idx() is unused, it prevents kernel builds with clang,
> > > > > `make W=1` and CONFIG_WERROR=y:
> > > > >
> > > > > kernel/locking/lockdep.c:435:28: error: unused function 'chain_hlock_class_idx' [-Werror,-Wunused-function]
> > > > >
> > > > > Fix this by marking it with __maybe_unused.
> > > > >
> > > > > 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>
> > > >
> > > > This looks fine to me, so I'm going to queue it, but could you do me
> > > > favor if you could share the exact configs that would make
> > > > chain_hlock_class_idx() an unused fuction in kernel/locking/lockdep.c ?
> > >
> > > I might harvest this when I come from vacations (some around mid-January).
> > >
> >
> > After some investigation myself, it turns out that
> > chain_hlock_class_idx() is defined outside "#ifdef CONFIG_PROVING_LOCK",
> > but only used under CONFIG_PROVING_LOCK=y, hence the unused warning.
> >
> > TBH, I feel we should really clean-up/consolidate those "#ifdef" to make
> > internal definition/usage more clear. But nothing blocks this patch, it
> > fixes a real issue, I will add the CONFIG_PROVING_LOCK part in the
> > commit log. Thanks!
>
> So now that we have:
>
> 343060092585 lockdep: Move lockdep_assert_locked() under #ifdef CONFIG_PROVE_LOCKING
>
> Do we really need:
>
> 8148fa2e022b lockdep: Mark chain_hlock_class_idx() with __maybe_unused
>
> As it would hide the problem fixed by 343060092585?
>
These two commits fix different functions, so they are both needed.
Though, we could probably regroup the functions into one big #ifdef
block so that we won't need the __maybe_unused annotations.
I will take a look.
Regards,
Boqun
> __maybe_unused annotations are almost always canaries of something
> messy being hidden.
>
> Thanks,
>
> Ingo
next prev parent reply other threads:[~2025-01-20 17:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 17:08 [PATCH v1 1/1] lockdep: Mark chain_hlock_class_idx() with __maybe_unused Andy Shevchenko
2024-12-15 19:55 ` Boqun Feng
2024-12-15 21:21 ` Andy Shevchenko
2024-12-19 21:57 ` Boqun Feng
2024-12-23 18:55 ` Andy Shevchenko
2025-01-20 8:11 ` Ingo Molnar
2025-01-20 17:00 ` Boqun Feng [this message]
2024-12-24 18:53 ` [tip: locking/core] " tip-bot2 for Andy Shevchenko
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=Z46BJ8FhWCIXbM7p@boqun-archlinux \
--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@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).