mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Antoni Kuczyński" <antoni.kucz@gmail.com>
To: nathan@kernel.org
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	"Antoni Kuczyński" <antoni.kucz@gmail.com>,
	"Thomas Gleixner" <tglx@kernel.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] x86/build/64: Prevent native builds from generating SSE/AVX code
Date: Sun, 25 Oct 2026 21:07:35 +0100	[thread overview]
Message-ID: <20261025200735.61814-1-antoni.kucz@gmail.com> (raw)
In-Reply-To: <20261025194411.GA56787@ax162>

Hi Nathan,

On Sun, Oct 25, 2026 at 12:44:11PM -0700, Nathan Chancellor wrote:
> This option has been in the kernel for quite some time and I am sure
> people are using it. I wonder why this has not come up sooner. Just
> unlucky timing or configuration?

Configuration, on my side, sorry for the noise. Following up on your
question I found that "gcc" in my PATH was the icecc (icecream 1.4.0)
wrapper. To be able to distribute the compilation, icecc replaces
-march=native with an explicit list of options for the local CPU:

  /usr/bin/gcc -mno-sse -mno-avx -Os -march=ivybridge -mmmx -mpopcnt
    -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx ...

so the expanded -msse/-mavx come after the kernel's -mno-* flags and
win. Plain GCC 14.2 does not have this problem: the reproducer from
the changelog built with /usr/bin/gcc-14 emits no SIMD instructions,
as explicit -mno-* options take precedence over what -march=native
enables.

So the changelog's explanation and the Fixes:/stable tags are wrong,
please drop this patch. I will report the issue to icecream instead.

> Maintaining two copies of these flags (and having them appear in the
> command line twice) seems objectively worse than just adding an extra
> 'ifdef CONFIG_X86_64' and moving the block up so that this happens in
> the naturally expected order?

Agreed, and FWIW your diff on top of current master also fixes the
icecc build here: -march=native now comes before the -mno-* flags and
arch/x86/boot/startup/gdt_idt.o contains no SIMD instructions. If you
think that ordering is worth having on its own merits, I am happy to
send it as a cleanup without Fixes:/stable, but I understand if it is
not worth the churn for an icecc-only problem.

Thanks for the review,
Antoni

  reply	other threads:[~2026-10-25 20:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-25 17:43 Antoni Kuczyński
2026-10-25 17:55 ` Antoni Kuczyński
2026-10-25 19:44 ` Nathan Chancellor
2026-10-25 20:07   ` Antoni Kuczyński [this message]
2026-10-25 20:20     ` Nathan Chancellor

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=20261025200735.61814-1-antoni.kucz@gmail.com \
    --to=antoni.kucz@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nathan@kernel.org \
    --cc=tglx@kernel.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

all inboxes | Powered by JetHome®