public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/Kconfig.debug: Require a release version of LLVM 22 for context analysis
@ 2026-02-24 23:16 Nathan Chancellor
  2026-02-25  7:00 ` Marco Elver
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Nathan Chancellor @ 2026-02-24 23:16 UTC (permalink / raw)
  To: Peter Zijlstra, Marco Elver
  Cc: Bart Van Assche, Nick Desaulniers, Bill Wendling, Justin Stitt,
	linux-kernel, llvm, Nathan Chancellor

Using a prerelease version as a minimum supported version for
CONFIG_WARN_CONTEXT_ANALYSIS was reasonable to do while LLVM 22 was the
development version so that people could immediately build from main and
start testing and validating this in their own code. However, it can be
problematic when using prerelease versions of LLVM 22, such as Android
clang 22.0.1 (the current android mainline compiler) or when bisecting
LLVM between llvmorg-22-init and llvmorg-23-init, to build the kernel,
as all compiler fixes for the context analysis may not be present,
potentially resulting in warnings that can easily turn into errors.

Now that LLVM 22 is released as 22.1.0, upgrade the check to require at
least this version to ensure that a user's toolchain actually has all
the changes needed for a smooth experience with context analysis.

Fixes: 3269701cb256 ("compiler-context-analysis: Add infrastructure for Context Analysis with Clang")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Peter, could you take this for a 7.0-rc?
---
 lib/Kconfig.debug | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 4e2dfbbd3d78..8e2b858078e6 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -630,7 +630,7 @@ config DEBUG_FORCE_WEAK_PER_CPU
 
 config WARN_CONTEXT_ANALYSIS
 	bool "Compiler context-analysis warnings"
-	depends on CC_IS_CLANG && CLANG_VERSION >= 220000
+	depends on CC_IS_CLANG && CLANG_VERSION >= 220100
 	# Branch profiling re-defines "if", which messes with the compiler's
 	# ability to analyze __cond_acquires(..), resulting in false positives.
 	depends on !TRACE_BRANCH_PROFILING
@@ -641,7 +641,7 @@ config WARN_CONTEXT_ANALYSIS
 	  and releasing user-definable "context locks".
 
 	  Clang's name of the feature is "Thread Safety Analysis". Requires
-	  Clang 22 or later.
+	  Clang 22.1.0 or later.
 
 	  Produces warnings by default. Select CONFIG_WERROR if you wish to
 	  turn these warnings into errors.

---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260224-bump-clang-ver-context-analysis-b4f5e27d208e

Best regards,
--  
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] lib/Kconfig.debug: Require a release version of LLVM 22 for context analysis
  2026-02-24 23:16 [PATCH] lib/Kconfig.debug: Require a release version of LLVM 22 for context analysis Nathan Chancellor
@ 2026-02-25  7:00 ` Marco Elver
  2026-02-25 14:52 ` Peter Zijlstra
  2026-02-25 15:31 ` [tip: locking/urgent] " tip-bot2 for Nathan Chancellor
  2 siblings, 0 replies; 7+ messages in thread
From: Marco Elver @ 2026-02-25  7:00 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Peter Zijlstra, Bart Van Assche, Nick Desaulniers, Bill Wendling,
	Justin Stitt, linux-kernel, llvm

On Wed, 25 Feb 2026 at 00:16, Nathan Chancellor <nathan@kernel.org> wrote:
>
> Using a prerelease version as a minimum supported version for
> CONFIG_WARN_CONTEXT_ANALYSIS was reasonable to do while LLVM 22 was the
> development version so that people could immediately build from main and
> start testing and validating this in their own code. However, it can be
> problematic when using prerelease versions of LLVM 22, such as Android
> clang 22.0.1 (the current android mainline compiler) or when bisecting
> LLVM between llvmorg-22-init and llvmorg-23-init, to build the kernel,
> as all compiler fixes for the context analysis may not be present,
> potentially resulting in warnings that can easily turn into errors.
>
> Now that LLVM 22 is released as 22.1.0, upgrade the check to require at
> least this version to ensure that a user's toolchain actually has all
> the changes needed for a smooth experience with context analysis.
>
> Fixes: 3269701cb256 ("compiler-context-analysis: Add infrastructure for Context Analysis with Clang")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Acked-by: Marco Elver <elver@google.com>

> ---
> Peter, could you take this for a 7.0-rc?
> ---
>  lib/Kconfig.debug | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 4e2dfbbd3d78..8e2b858078e6 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -630,7 +630,7 @@ config DEBUG_FORCE_WEAK_PER_CPU
>
>  config WARN_CONTEXT_ANALYSIS
>         bool "Compiler context-analysis warnings"
> -       depends on CC_IS_CLANG && CLANG_VERSION >= 220000
> +       depends on CC_IS_CLANG && CLANG_VERSION >= 220100
>         # Branch profiling re-defines "if", which messes with the compiler's
>         # ability to analyze __cond_acquires(..), resulting in false positives.
>         depends on !TRACE_BRANCH_PROFILING
> @@ -641,7 +641,7 @@ config WARN_CONTEXT_ANALYSIS
>           and releasing user-definable "context locks".
>
>           Clang's name of the feature is "Thread Safety Analysis". Requires
> -         Clang 22 or later.
> +         Clang 22.1.0 or later.
>
>           Produces warnings by default. Select CONFIG_WERROR if you wish to
>           turn these warnings into errors.
>
> ---
> base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
> change-id: 20260224-bump-clang-ver-context-analysis-b4f5e27d208e
>
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] lib/Kconfig.debug: Require a release version of LLVM 22 for context analysis
  2026-02-24 23:16 [PATCH] lib/Kconfig.debug: Require a release version of LLVM 22 for context analysis Nathan Chancellor
  2026-02-25  7:00 ` Marco Elver
@ 2026-02-25 14:52 ` Peter Zijlstra
  2026-02-25 18:53   ` Nathan Chancellor
  2026-02-25 15:31 ` [tip: locking/urgent] " tip-bot2 for Nathan Chancellor
  2 siblings, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2026-02-25 14:52 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Marco Elver, Bart Van Assche, Nick Desaulniers, Bill Wendling,
	Justin Stitt, linux-kernel, llvm, pkg-llvm-team

On Tue, Feb 24, 2026 at 04:16:30PM -0700, Nathan Chancellor wrote:
> Using a prerelease version as a minimum supported version for
> CONFIG_WARN_CONTEXT_ANALYSIS was reasonable to do while LLVM 22 was the
> development version so that people could immediately build from main and
> start testing and validating this in their own code. However, it can be
> problematic when using prerelease versions of LLVM 22, such as Android
> clang 22.0.1 (the current android mainline compiler) or when bisecting
> LLVM between llvmorg-22-init and llvmorg-23-init, to build the kernel,
> as all compiler fixes for the context analysis may not be present,
> potentially resulting in warnings that can easily turn into errors.
> 
> Now that LLVM 22 is released as 22.1.0, upgrade the check to require at
> least this version to ensure that a user's toolchain actually has all
> the changes needed for a smooth experience with context analysis.
> 
> Fixes: 3269701cb256 ("compiler-context-analysis: Add infrastructure for Context Analysis with Clang")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Peter, could you take this for a 7.0-rc?

Yes, I can. I would however appreciate the Debian folks to quickly push
an update to the clang-22/experimental package. Otherwise I can't run
this fancy stuff myself no moar.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [tip: locking/urgent] lib/Kconfig.debug: Require a release version of LLVM 22 for context analysis
  2026-02-24 23:16 [PATCH] lib/Kconfig.debug: Require a release version of LLVM 22 for context analysis Nathan Chancellor
  2026-02-25  7:00 ` Marco Elver
  2026-02-25 14:52 ` Peter Zijlstra
@ 2026-02-25 15:31 ` tip-bot2 for Nathan Chancellor
  2 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Nathan Chancellor @ 2026-02-25 15:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Nathan Chancellor, Peter Zijlstra (Intel), Marco Elver, x86,
	linux-kernel

The following commit has been merged into the locking/urgent branch of tip:

Commit-ID:     ab6088e7a95943af3452b20e3b96caaaef3eeebd
Gitweb:        https://git.kernel.org/tip/ab6088e7a95943af3452b20e3b96caaaef3eeebd
Author:        Nathan Chancellor <nathan@kernel.org>
AuthorDate:    Tue, 24 Feb 2026 16:16:30 -07:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 25 Feb 2026 15:36:02 +01:00

lib/Kconfig.debug: Require a release version of LLVM 22 for context analysis

Using a prerelease version as a minimum supported version for
CONFIG_WARN_CONTEXT_ANALYSIS was reasonable to do while LLVM 22 was the
development version so that people could immediately build from main and
start testing and validating this in their own code. However, it can be
problematic when using prerelease versions of LLVM 22, such as Android
clang 22.0.1 (the current android mainline compiler) or when bisecting
LLVM between llvmorg-22-init and llvmorg-23-init, to build the kernel,
as all compiler fixes for the context analysis may not be present,
potentially resulting in warnings that can easily turn into errors.

Now that LLVM 22 is released as 22.1.0, upgrade the check to require at
least this version to ensure that a user's toolchain actually has all
the changes needed for a smooth experience with context analysis.

Fixes: 3269701cb256 ("compiler-context-analysis: Add infrastructure for Context Analysis with Clang")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Marco Elver <elver@google.com>
Link: https://patch.msgid.link/20260224-bump-clang-ver-context-analysis-v1-1-16cc7a90a040@kernel.org
---
 lib/Kconfig.debug | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 4e2dfbb..8e2b858 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -630,7 +630,7 @@ config DEBUG_FORCE_WEAK_PER_CPU
 
 config WARN_CONTEXT_ANALYSIS
 	bool "Compiler context-analysis warnings"
-	depends on CC_IS_CLANG && CLANG_VERSION >= 220000
+	depends on CC_IS_CLANG && CLANG_VERSION >= 220100
 	# Branch profiling re-defines "if", which messes with the compiler's
 	# ability to analyze __cond_acquires(..), resulting in false positives.
 	depends on !TRACE_BRANCH_PROFILING
@@ -641,7 +641,7 @@ config WARN_CONTEXT_ANALYSIS
 	  and releasing user-definable "context locks".
 
 	  Clang's name of the feature is "Thread Safety Analysis". Requires
-	  Clang 22 or later.
+	  Clang 22.1.0 or later.
 
 	  Produces warnings by default. Select CONFIG_WERROR if you wish to
 	  turn these warnings into errors.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] lib/Kconfig.debug: Require a release version of LLVM 22 for context analysis
  2026-02-25 14:52 ` Peter Zijlstra
@ 2026-02-25 18:53   ` Nathan Chancellor
  2026-02-25 22:23     ` Peter Zijlstra
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2026-02-25 18:53 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Marco Elver, Bart Van Assche, Nick Desaulniers, Bill Wendling,
	Justin Stitt, linux-kernel, llvm, pkg-llvm-team

On Wed, Feb 25, 2026 at 03:52:28PM +0100, Peter Zijlstra wrote:
> On Tue, Feb 24, 2026 at 04:16:30PM -0700, Nathan Chancellor wrote:
> > Using a prerelease version as a minimum supported version for
> > Peter, could you take this for a 7.0-rc?
> 
> Yes, I can.

Thanks a lot!

> I would however appreciate the Debian folks to quickly push an update
> to the clang-22/experimental package. Otherwise I can't run this fancy
> stuff myself no moar.

  https://packages.debian.org/experimental/clang-22

claims that the experimental clang-22 package is at 22.1.0-rc3, so you
should be good. If not for some reason, it looks like 22.1.0 should be
coming down the pipeline soon based on the llvm-toolchain repo:

  https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/commits/22

and there is always https://apt.llvm.org or the kernel.org copies if you
were really in a bind :)

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] lib/Kconfig.debug: Require a release version of LLVM 22 for context analysis
  2026-02-25 18:53   ` Nathan Chancellor
@ 2026-02-25 22:23     ` Peter Zijlstra
  2026-02-26  8:08       ` Sylvestre Ledru
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2026-02-25 22:23 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Marco Elver, Bart Van Assche, Nick Desaulniers, Bill Wendling,
	Justin Stitt, linux-kernel, llvm, pkg-llvm-team

On Wed, Feb 25, 2026 at 11:53:57AM -0700, Nathan Chancellor wrote:
> On Wed, Feb 25, 2026 at 03:52:28PM +0100, Peter Zijlstra wrote:
> > On Tue, Feb 24, 2026 at 04:16:30PM -0700, Nathan Chancellor wrote:
> > > Using a prerelease version as a minimum supported version for
> > > Peter, could you take this for a 7.0-rc?
> > 
> > Yes, I can.
> 
> Thanks a lot!
> 
> > I would however appreciate the Debian folks to quickly push an update
> > to the clang-22/experimental package. Otherwise I can't run this fancy
> > stuff myself no moar.
> 
>   https://packages.debian.org/experimental/clang-22
> 
> claims that the experimental clang-22 package is at 22.1.0-rc3, so you
> should be good. 

Ah indeed. Operator error; I forgot the -t experimental and apt claimed:

  clang-22 is already the newest version (1:22~++20251023025710+3f47a7be1ae6-1~exp5).

But now I am indeed at 22.1.0-rc3.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] lib/Kconfig.debug: Require a release version of LLVM 22 for context analysis
  2026-02-25 22:23     ` Peter Zijlstra
@ 2026-02-26  8:08       ` Sylvestre Ledru
  0 siblings, 0 replies; 7+ messages in thread
From: Sylvestre Ledru @ 2026-02-26  8:08 UTC (permalink / raw)
  To: Peter Zijlstra, Nathan Chancellor
  Cc: Marco Elver, Bart Van Assche, Nick Desaulniers, Bill Wendling,
	Justin Stitt, linux-kernel, llvm, pkg-llvm-team

Hello,

Le 25/02/2026 à 23:23, Peter Zijlstra a écrit :
> On Wed, Feb 25, 2026 at 11:53:57AM -0700, Nathan Chancellor wrote:
>> On Wed, Feb 25, 2026 at 03:52:28PM +0100, Peter Zijlstra wrote:
>>> On Tue, Feb 24, 2026 at 04:16:30PM -0700, Nathan Chancellor wrote:
>>>> Using a prerelease version as a minimum supported version for
>>>> Peter, could you take this for a 7.0-rc?
>>> Yes, I can.
>> Thanks a lot!
>>
>>> I would however appreciate the Debian folks to quickly push an update
>>> to the clang-22/experimental package. Otherwise I can't run this fancy
>>> stuff myself no moar.
>>    https://packages.debian.org/experimental/clang-22
>>
>> claims that the experimental clang-22 package is at 22.1.0-rc3, so you
>> should be good.
> Ah indeed. Operator error; I forgot the -t experimental and apt claimed:
>
>    clang-22 is already the newest version (1:22~++20251023025710+3f47a7be1ae6-1~exp5).
>
> But now I am indeed at 22.1.0-rc3.
>
The stable release is now in sid:

https://tracker.debian.org/pkg/llvm-toolchain-22

Cheers,
Sylvestre



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-02-26  8:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-24 23:16 [PATCH] lib/Kconfig.debug: Require a release version of LLVM 22 for context analysis Nathan Chancellor
2026-02-25  7:00 ` Marco Elver
2026-02-25 14:52 ` Peter Zijlstra
2026-02-25 18:53   ` Nathan Chancellor
2026-02-25 22:23     ` Peter Zijlstra
2026-02-26  8:08       ` Sylvestre Ledru
2026-02-25 15:31 ` [tip: locking/urgent] " tip-bot2 for Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox