[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e37ee471-0b10-48d4-ad20-871e585c98f6@app.fastmail.com>
Date: Sat, 22 Mar 2025 12:40:08 +0100
From: "Arnd Bergmann" <arnd@...nel.org>
To: "Tor Vic" <torvic9@...lbox.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Cc: "Borislav Petkov" <bp@...en8.de>, "Thomas Gleixner" <tglx@...utronix.de>,
"Ingo Molnar" <mingo@...hat.com>, "H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH] arch/x86: Add an option to build the kernel with '-march=native'
on x86-64
On Fri, Mar 21, 2025, at 15:28, Tor Vic wrote:
> Add a 'native' option that allows users to build an optimized kernel for
> their local machine (i.e. the machine which is used to build the kernel)
> by passing '-march=native' to the CFLAGS.
>
> The idea comes from Linus' reply to Arnd's initial proposal in [1].
>
> This patch is based on Arnd's x86 cleanup series, which is now in -tip [2].
Thanks for having another look at this and for including the
benchmarks. I ended up dropping this bit of my series because
there were too many open questions around things like
reproducible builds, but there is clearly a demand for having
this included.
> hackbench (lower is better):
> 102.27 --> 99.50 (-2.709 %)
>
> - stress-ng, bogoops, average of 3 15-second runs:
> fork:
> 111'744 --> 115'509 (+3.397 %)
> bsearch:
> 7'211 --> 7'436 (+3.120 %)
> vm:
> 1'442'256 --> 1'486'615 (+3.076 %)
3% in userspace benchmarks does seem significant enough to
spend more time on seeing what exactly made the difference
here, and possibly including it as separate options.
> +ifdef CONFIG_NATIVE_CPU
> + KBUILD_CFLAGS += -march=native
> + KBUILD_RUSTFLAGS += -Ctarget-cpu=native
> +else
> KBUILD_CFLAGS += -march=x86-64 -mtune=generic
> KBUILD_RUSTFLAGS += -Ctarget-cpu=x86-64 -Ztune-cpu=generic
> +endif
I assume that the difference here is that -march=native on
your machine gets turned into -march=skylake, which then turns
on both additional instructions and a different instruction
scheduler.
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
Arnd
Powered by blists - more mailing lists