From: Peter Zijlstra <peterz@infradead.org>
To: Marco Elver <elver@google.com>
Cc: Ingo Molnar <mingo@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
llvm@lists.linux.dev, Bart Van Assche <bvanassche@acm.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH tip/locking/core] compiler-context-analysis: Add support for multi-argument guarded_by
Date: Wed, 25 Mar 2026 16:20:00 +0100 [thread overview]
Message-ID: <20260325152000.GG3738786@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <CANpmjNMo5kX=2B7UTo-gbiBSTAF0JPwWRZNf=KWpRP4tRA2FAg@mail.gmail.com>
On Mon, Mar 23, 2026 at 04:39:41PM +0100, Marco Elver wrote:
> On Mon, 23 Mar 2026 at 16:33, Marco Elver <elver@google.com> wrote:
> >
> > Clang 23 introduces support for multiple arguments in the `guarded_by`
> > and `pt_guarded_by` attributes [1]. This allows defining variables
> > protected by multiple context locks, where read access requires holding
> > at least one lock (shared or exclusive), and write access requires
> > holding all of them exclusively.
> >
> > To use the feature while maintaining compatibility with Clang 22, add
> > the `__guarded_by_any()` and `__pt_guarded_by_any()` macros. On Clang 23
> > and newer, these expand to the underlying attributes; with older Clang
> > versions, they fall back to a no-op (false negatives possible).
> >
> > Link: https://github.com/llvm/llvm-project/pull/186838 [1]
> > Requested-by: Peter Zijlstra <peterz@infradead.org>
> > Signed-off-by: Marco Elver <elver@google.com>
>
> If we want to retain compatibility with Clang 22, we need
> __guarded_by_any, which ultimately maps to 'guarded_by' as well if we
> have Clang 23+.
>
> The alternative would be to wait a few weeks and then require Context
> Analysis to have a Clang 23 compiler. That'd avoid adding the new
> __guarded_by_any variant and we can just use __guarded_by as-is.
>
> We likely want to do that when Clang 23.1 is released anyway, because
> there were some other fixes (arrays of lock fix:
> https://github.com/llvm/llvm-project/pull/148551).
>
> Preferences?
I think we'll be okay just upping the requirement now. But I'll sit on
this a little until Debian's clang-23 build is fresh enough to includes
the awesome :-)
next prev parent reply other threads:[~2026-03-25 15:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 15:33 [PATCH tip/locking/core] compiler-context-analysis: Add support for multi-argument guarded_by Marco Elver
2026-03-23 15:39 ` Marco Elver
2026-03-25 15:20 ` Peter Zijlstra [this message]
2026-03-23 23:28 ` Nathan Chancellor
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=20260325152000.GG3738786@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bvanassche@acm.org \
--cc=elver@google.com \
--cc=justinstitt@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mingo@kernel.org \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
/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