Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: linux-tip-commits@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>,
	"Borislav Petkov (AMD)" <bp@alien8.de>,
	stable@vger.kernel.org, x86@kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [tip: x86/urgent] x86/build: Do not allow X86_NATIVE_CPU to be enabled when compile testing
Date: Mon, 16 Nov 2026 10:40:01 +0100	[thread overview]
Message-ID: <avrPcQ4sOkgJPbkZ@gmail.com> (raw)
In-Reply-To: <179480914308.3191731.6125228756396043444.tip-bot2@tip-bot2>


* tip-bot2 for Nathan Chancellor <tip-bot2@linutronix.de> wrote:

> which was first added by the initial '-march=native' support in clang in 2009¹
> (other architecture drivers appear to have a similar problem).  Due to the lack
> of validation that the host CPU is an x86_64 CPU, '-march=native' is expanded
> using the aarch64 host CPU's target features, which are unrecognized by the x86
> backend.
> 
> While this should obviously be fixed in the compiler, this does not help
> currently released toolchains that have this issue. As a simple workaround that
> makes sense regardless of the toolchain issue, only allow CONFIG_X86_NATIVE_CPU
> to be enabled when CONFIG_COMPILE_TEST is not set (i.e., the user intends to run
> the kernel, not just build it), which will exclude it from allmodconfig.
> 
>   ¹https://github.com/llvm/llvm-project/commit/e13ada6a3b236f505b24501d456dec2518e4944c
> 
> Fixes: ea1dcca1de12 ("x86/kbuild/64: Add the CONFIG_X86_NATIVE_CPU option to locally optimize the kernel with '-march=native'")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
> Cc: stable@vger.kernel.org
> Link: https://lore.kernel.org/r/20261113-x86-no-march-native-on-non-x86_64-v1-1-cbc8b096d1c4@kernel.org
> ---
>  arch/x86/Kconfig.cpu | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
> index 6e7a366..32d22cb 100644
> --- a/arch/x86/Kconfig.cpu
> +++ b/arch/x86/Kconfig.cpu
> @@ -217,6 +217,7 @@ config RUSTC_HAS_APXF
>  config X86_NATIVE_CPU
>  	bool "Build and optimize for local/native CPU"
>  	depends on X86_64
> +	depends on !COMPILE_TEST

I really don't like this patch. People *do* use this feature,
and it's good to have it enabled in allmodconfig.

Another problem is that this turns off most automated x86-on-x86
build testing of CONFIG_X86_NATIVE_CPU in essence, at least for the
typical configs that CI farms test, just to make much more rare
types of cross-builds a bit more convenient...

Can we just limit the feature to when host == target, ie. to not
work it around in such a crude fashion?

Thanks,

	Ingo

      reply	other threads:[~2026-11-16  9:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  6:05 [tip: x86/urgent] x86/build: Do not allow X86_NATIVE_CPU to be enabled when compile testing tip-bot2 for Nathan Chancellor
2026-11-16  9:40 ` Ingo Molnar [this message]

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=avrPcQ4sOkgJPbkZ@gmail.com \
    --to=mingo@kernel.org \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@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