]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bit_spinlock: Support Clang's context analysis
authorMarco Elver <elver@google.com>
Fri, 19 Dec 2025 15:40:02 +0000 (16:40 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 5 Jan 2026 15:43:30 +0000 (16:43 +0100)
commiteb7d96a13bf45f86909006a59e7855d8810f020a
treec1aa9a0a02f24aec08bd20071fc197cd52f9d5ea
parent5f7ba059710609bb997d50775ba92fbf29be51da
bit_spinlock: Support Clang's context analysis

The annotations for bit_spinlock.h have simply been using "bitlock" as
the token. For Sparse, that was likely sufficient in most cases. But
Clang's context analysis is more precise, and we need to ensure we
can distinguish different bitlocks.

To do so, add a token context, and a macro __bitlock(bitnum, addr)
that is used to construct unique per-bitlock tokens.

Add the appropriate test.

<linux/list_bl.h> is implicitly included through other includes, and
requires 2 annotations to indicate that acquisition (without release)
and release (without prior acquisition) of its bitlock is intended.

Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251219154418.3592607-14-elver@google.com
Documentation/dev-tools/context-analysis.rst
include/linux/bit_spinlock.h
include/linux/list_bl.h
lib/test_context-analysis.c