mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@kernel.org>
To: "Tor Vic" <torvic9@mailbox.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Cc: "Borislav Petkov" <bp@alien8.de>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] arch/x86: Add an option to build the kernel with '-march=native' on x86-64
Date: Mon, 24 Mar 2025 09:45:14 +0100	[thread overview]
Message-ID: <106aacc5-e863-4e74-b223-34b7a0be60a0@app.fastmail.com> (raw)
In-Reply-To: <b67fad41-3849-446e-8982-1485f42e61eb@mailbox.org>

On Sun, Mar 23, 2025, at 16:14, Tor Vic wrote:
> On 3/22/25 12:40, Arnd Bergmann wrote:
>> On Fri, Mar 21, 2025, at 15:28, Tor Vic wrote:
>>
>> Are you able to quickly run the same tests again using
>> just one of the two?
>> 
>> a) -march=x86-64 -mtune=skylake
>> b) -march=skylake -mtune=generic
>> 
>
> I ran the tests on Zen2 (znver2), but this time the kernel was built 
> with clang-20+lto (the skylake tests were with gcc-14).
>
> It turned out that with '-march=native', there is almost no difference 
> compared to '-march=x86-64'.
> All results are within +0.8% and -0.6%, most of which are probably 
> noise. Hackbench, stress-ng fork and xz compression seem to profit the 
> most from 'native'.
>
> The vmlinux image is 0.03% bigger with 'native'.
>
> I guess that 'native' can be somewhat useful on some architectures, but 
> not on all...

It certainly depends on configuration, toolchain and target machine,
so it's very hard to say anything general about -march=native.
znver2 and skylake are quite similar in the supported instructions,
so my guess would be that the clang-20+lto doesn't behave that differently
between march=x86-64 and march=znver2.

Of course if you don't have the same kernel version and configuration
that you are testing, the results between the two machines, the
results would be fairly random as well.

     Arnd

  reply	other threads:[~2025-03-24  8:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21 14:28 Tor Vic
2025-03-21 17:35 ` H. Peter Anvin
2025-03-22 11:40 ` Arnd Bergmann
2025-03-22 12:08   ` Tor Vic
2025-03-22 21:53   ` David Laight
2025-03-22 22:03     ` H. Peter Anvin
2025-03-23 15:14   ` Tor Vic
2025-03-24  8:45     ` Arnd Bergmann [this message]
2025-04-03 13:33 ` [tip: x86/kconfig] x86/kbuild/64: Add the CONFIG_X86_NATIVE_CPU option to locally optimize the kernel with '-march=native' tip-bot2 for Tor Vic

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=106aacc5-e863-4e74-b223-34b7a0be60a0@app.fastmail.com \
    --to=arnd@kernel.org \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvic9@mailbox.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®