Rust for Linux List
 help / color / mirror / Atom feed
From: "Chang S. Bae" <chang.seok.bae@intel.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: <linux-kernel@vger.kernel.org>, <x86@kernel.org>,
	<rust-for-linux@vger.kernel.org>, <tglx@kernel.org>,
	<mingo@redhat.com>, <bp@alien8.de>, <dave.hansen@linux.intel.com>,
	<hpa@zytor.com>, <ojeda@kernel.org>, <nathan@kernel.org>,
	<boqun@kernel.org>, <gary@garyguo.net>,
	<bjorn3_gh@protonmail.com>, <lossin@kernel.org>,
	<a.hindborg@kernel.org>, <aliceryhl@google.com>,
	<tmgross@umich.edu>, <dakr@kernel.org>,
	<daniel.almeida@collabora.com>, <tamird@kernel.org>,
	<acourbot@nvidia.com>, <work@onurozkan.dev>,
	Omar Avelar <omar.avelar@intel.com>, <stable@vger.kernel.org>
Subject: Re: [PATCH v2] x86/build/64: Prevent native builds from generating APX instructions
Date: Fri, 7 Aug 2026 20:21:18 -0700	[thread overview]
Message-ID: <b00de567-f828-4ad8-a6ab-6ab1c47de68e@intel.com> (raw)
In-Reply-To: <CANiq72=bEB5-GvvroXigiCVtHjGtkhs1ARkk+mDbvjNAR4XKVQ@mail.gmail.com>

On 8/7/2026 9:58 AM, Miguel Ojeda wrote:
> On Fri, Aug 7, 2026 at 5:43 PM Chang S. Bae <chang.seok.bae@intel.com> wrote:
>>
>> Omar reported this broad concern to me, when resolving a separate issue
>> with his custom module. CONFIG_X86_NATIVE_CPU=y allows builds to
>> opportunistically emit APX instructions when the build host supports APX
>> since the commit.
> 
> I think this sentence may be cut? I guess this refers to the commit in
> the Fixes tag.


Yes, I intended “the commit” to refer to the one in the Fixes: tag. To 
make it explicit, I can add the commit back here:

   ea1dcca1de12 ("x86/kbuild/64: Add the CONFIG_X86_NATIVE_CPU ...")


>> For Rust, APX must be explicitly disabled because any backend supporting
>> APX may otherwise emit APX instructions with target-cpu=native. Pass
>> features=-apxf through the generated JSON to avoid unstable-feature
>> warnings.
> 
> So, just to confirm: is Rust 1.88 (with a new enough LLVM) enough to
> avoid the warnings? Maybe a link to the tracking issue would be nice:
> 
>    https://github.com/rust-lang/rust/issues/139284


Passing `-apxf` through the generated target JSON avoids this warning:

warning: unstable feature specified for `-Ctarget-feature`: `apxf`
   |
   = note: this feature is not stably supported; its behavior can change 
in the future

I’ll add the link to reference the status of the Rust support. Thanks.

>> Support for this gating also depends on the Rust/LLVM combination. Rust
>> 1.88 introduced the `apxf` feature option, but versions prior to 1.93 may
>> emit an `apxf` attribute which LLVM 23 or later can interpret. Restrict
>> native Rust builds accordingly.
>>
>> Fixes: ea1dcca1de12 ("x86/kbuild/64: Add the CONFIG_X86_NATIVE_CPU option to locally optimize the kernel with '-march=native'")
> 
> This looks like it exists in 6.18.y+, so I assume this should have:
> 
> Cc: stable@vger.kernel.org

Yes, I have included it.

Thanks,
Chang

  reply	other threads:[~2026-08-08  3:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 15:17 [PATCH v2] x86/build/64: Prevent native builds from generating APX instructions Chang S. Bae
2026-08-07 16:58 ` Miguel Ojeda
2026-08-08  3:21   ` Chang S. Bae [this message]
2026-08-10 15:24     ` Miguel Ojeda
2026-09-03  5:23       ` Borislav Petkov
2026-09-03 14:10         ` Chang S. Bae

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=b00de567-f828-4ad8-a6ab-6ab1c47de68e@intel.com \
    --to=chang.seok.bae@intel.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=bp@alien8.de \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=gary@garyguo.net \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=mingo@redhat.com \
    --cc=nathan@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=omar.avelar@intel.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tglx@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    --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