The locking code changes have been merged for the Linux 7.0 kernel and it introduces support for a new compiler-driven feature being introduced on the compiler side with the upcoming LLVM Clang 22.
The new feature merged as part of the locking changes for Linux 7.0 is compiler-driven static analysis locking context checking that can be used when building the kernel with LLVM Clang 22+. This feature is described in the pull request as:
“Implement compiler-driven static analysis locking context checking, using the upcoming Clang 22 compiler’s context analysis features. (Marco Elver)
We removed Sparse context analysis support, because prior to removal even a defconfig kernel produced 1,700+ context tracking Sparse warnings, the overwhelming majority of which are false positives. On an allmodconfig kernel the number of false positive context tracking Sparse warnings grows to over 5,200… On the plus side of the balance actual locking bugs found by Sparse context analysis is also rather … sparse: I found only 3 such commits in the last 3 years. So the rate of false positives and the maintenance overhead is rather high and there appears to be no active policy in place to achieve a zero-warnings baseline to move the annotations & fixers to developers who introduce new code.
Clang context analysis is more complete and more aggressive in trying to find bugs, at least in principle. Plus it has a different model to enabling it: it’s enabled subsystem by subsystem, which results in zero warnings on all relevant kernel builds (as far as our testing managed to cover it). Which allowed us to enable it by default, similar to other compiler warnings, with the expectation that there are no warnings going forward. This enforces a zero-warnings baseline on clang-22+ builds. (Which are still limited in distribution, admittedly.)
Hopefully the Clang approach can lead to a more maintainable zero-warnings status quo and policy, with more and more subsystems and drivers enabling the feature. Context tracking can be enabled for all kernel code via WARN_CONTEXT_ANALYSIS_ALL=y (default disabled), but this will generate a lot of false positives.”
The locking pull also brought a number of Rust integration updates and other fixes. All of these changes have successfully been merged to Linux Git for the big Linux 7.0 release.
