mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@kernel.org>
To: "Ingo Molnar" <mingo@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org,
	"Ahmed S . Darwish" <darwi@linutronix.de>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Borislav Petkov" <bp@alien8.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"John Ogness" <john.ogness@linutronix.de>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Thomas Gleixner" <tglx@linutronix.de>
Subject: Re: [PATCH 13/15] x86/cpu: Make CONFIG_X86_CX8 unconditional
Date: Tue, 29 Apr 2025 14:10:05 +0200	[thread overview]
Message-ID: <3005bc00-7ee2-4854-aef7-e274a9940fb2@app.fastmail.com> (raw)
In-Reply-To: <aBCoesvpVU0-njjH@gmail.com>

On Tue, Apr 29, 2025, at 12:22, Ingo Molnar wrote:
> * Arnd Bergmann <arnd@kernel.org> wrote:
>
> This is the current upstream status quo of x86-32 compiler flags, which 
> results in significant .text bloat:
>
>       text         data     bss     dec     hex filename
>   15427023      7601010 1744896 24772929        17a0141 vmlinux.M586
>   16578295      7598826 1744896 25922017        18b89e1 vmlinux.M686

>  - +7.5% increase in text size (+5.6% according to bloatometer),
>  - +2% increase in instruction count,
>  - the number of branches increases by +1.3%,
>  - while there's a -0.7% reduction in number of CALLs done.
>
> I believe this is mostly the result of increased amount of inlining GCC 
> 14.2.0 does on march=i686 vs. march=i586.

I can reproduce +7% numbers like the ones you have shown when
CONFIG_X86_GENERIC is disabled, but not if I turn that on,
or with my "[RFC] x86/cpu: rework instruction set selection"
patch applied.

What makes this confusing is that the -march=i686 option does
two things: it changes the allowed instructions to include cmov,
and it changes the implicit -mtune= argument to the same value,
unless you pass an explicit -mtune= as well.

Selecting the i686 instruction set by itself does not change
the amount of inlining at all, you can see that by comparing the
i586 and i686 output when CONFIG_X86_GENERIC=y is set, or if you
change the flags in the Makefile

What really kills it is the implied -mtune=i686, these are the
results of manually changing the flags:

   text	   data	    bss	    dec	    hex	filename
7235028	4240706	1691648	13167382	 c8eb16	vmlinux # i585
7218356	4240718	1691648	13150722	 c8aa02	vmlinux # i686, tune=i586
7299828	4240706	1691648	13232182	 c9e836	vmlinux # i586, tune=generic
7278948	4244826	1691648	13215422	 c9a6be	vmlinux # i686, tune=generic
7784708	4239410	1691648	13715766	 d14936	vmlinux # i586, tune=i686
7768340	4239446	1691648	13699434	 d1096a	vmlinux # i686

If you set the CONFIG_M586/M686 options, you get an additional
effect from a couple of changed Kconfig options, that lead to
the i686 further shrinking a little more, mainly from less
padding:

-CONFIG_X86_F00F_BUG=y
-CONFIG_X86_ALIGNMENT_16=y
+CONFIG_X86_USE_PPRO_CHECKSUM=y
-CONFIG_X86_MINIMUM_CPU_FAMILY=5
+CONFIG_X86_CMOV=y
+CONFIG_X86_MINIMUM_CPU_FAMILY=6
+CONFIG_X86_DEBUGCTLMSR=y
-CONFIG_CPU_SUP_CYRIX_32=y
-CONFIG_FUNCTION_PADDING_CFI=11
-CONFIG_FUNCTION_PADDING_BYTES=16
+CONFIG_FUNCTION_PADDING_CFI=0
+CONFIG_FUNCTION_PADDING_BYTES=4
+CONFIG_X86_REQUIRED_FEATURE_CMOV=y
-CONFIG_FUNCTION_ALIGNMENT_16B=y
-CONFIG_FUNCTION_ALIGNMENT=16
+CONFIG_FUNCTION_ALIGNMENT=4

      Arnd

  reply	other threads:[~2025-04-29 12:10 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25  8:41 [RFC PATCH 0/15] x86: Remove support for TSC-less and CX8-less CPUs Ingo Molnar
2025-04-25  8:41 ` [PATCH 01/15] x86/cpu: Remove M486/M486SX/ELAN support Ingo Molnar
2025-04-25  8:41 ` [PATCH 02/15] x86/cpu: Remove CONFIG_MWINCHIP3D/MWINCHIPC6 Ingo Molnar
2025-04-25  8:42 ` [PATCH 03/15] x86/cpu: Remove CPU_SUP_UMC_32 support Ingo Molnar
2025-04-25  8:42 ` [PATCH 04/15] x86/cpu: Remove TSC-less CONFIG_M586 support Ingo Molnar
2025-04-25 15:09   ` H. Peter Anvin
2025-04-25  8:42 ` [PATCH 05/15] x86/cpu, x86/platform, watchdog: Remove CONFIG_X86_RDC321X support Ingo Molnar
2025-04-25  8:42 ` [PATCH 06/15] x86/cpu: Remove the CONFIG_X86_INVD_BUG quirk Ingo Molnar
2025-04-25  8:42 ` [PATCH 07/15] x86/cpu, cpufreq: Remove AMD ELAN support Ingo Molnar
2025-04-25  8:42 ` [PATCH 08/15] x86/fpu: Remove MATH_EMULATION and related glue code Ingo Molnar
2025-04-25  8:42 ` [PATCH 09/15] x86/fpu: Remove the 'no387' boot option Ingo Molnar
2025-04-25  8:42 ` [PATCH 10/15] x86/fpu: Remove the math-emu/ FPU emulation library Ingo Molnar
2025-04-25  8:42 ` [PATCH 11/15] x86/cpu: Make CONFIG_X86_TSC unconditional Ingo Molnar
2025-04-25  8:42 ` [PATCH 12/15] x86: Remove !CONFIG_X86_TSC code Ingo Molnar
2025-04-25  8:42 ` [PATCH 13/15] x86/cpu: Make CONFIG_X86_CX8 unconditional Ingo Molnar
2025-04-25 12:10   ` Arnd Bergmann
2025-04-25 15:15     ` H. Peter Anvin
2025-04-25 21:54       ` Arnd Bergmann
2025-04-27  9:25         ` Ingo Molnar
2025-04-27 17:32           ` Arnd Bergmann
2025-04-27 21:26             ` H. Peter Anvin
2025-04-28  9:16             ` Ingo Molnar
2025-04-28 11:21               ` Arnd Bergmann
2025-04-29 10:22                 ` Ingo Molnar
2025-04-29 12:10                   ` Arnd Bergmann [this message]
2025-04-27  8:15     ` Ingo Molnar
2025-04-25  8:42 ` [PATCH 14/15] x86/percpu: Remove !CONFIG_X86_CX8 methods Ingo Molnar
2025-04-25 14:05   ` Uros Bizjak
2025-04-27  7:46     ` [PATCH -v2 " Ingo Molnar
2025-04-25  8:42 ` [PATCH 15/15] x86/atomics: " Ingo Molnar
2025-04-25 13:55   ` Arnd Bergmann
2025-04-25 14:10   ` Uros Bizjak
2025-04-25 15:00     ` Brian Gerst
2025-04-27  8:23       ` Ingo Molnar
2025-04-27  8:26     ` Ingo Molnar
2025-04-27 10:31       ` Uros Bizjak
2025-05-15  8:49         ` Ingo Molnar
2025-04-25 11:13 ` [RFC PATCH 0/15] x86: Remove support for TSC-less and CX8-less CPUs Arnd Bergmann
2025-04-26  8:26 ` Pavel Machek
2025-05-05  8:53 ` Maciej W. Rozycki
2025-05-05 12:48   ` H. Peter Anvin
2025-05-05 13:04     ` Maciej W. Rozycki
2025-05-05 19:57       ` H. Peter Anvin
2025-05-05 20:54         ` Borislav Petkov
2025-05-06 13:51           ` Maciej W. Rozycki
2025-05-06 14:16             ` Borislav Petkov
2025-05-08 14:51               ` Maciej W. Rozycki
2025-05-08 20:11                 ` Borislav Petkov
2025-05-12 12:55                   ` Maciej W. Rozycki
2025-05-12 13:48                     ` Borislav Petkov
2025-05-12 17:29                       ` Maciej W. Rozycki
2025-05-13  2:00                         ` Linus Torvalds
2025-05-13  3:48                           ` H. Peter Anvin
2025-05-13  5:43                           ` John Paul Adrian Glaubitz
2025-05-13 21:55                             ` Maciej W. Rozycki
2025-05-13 22:02                               ` Linus Torvalds
2025-05-13 22:06                                 ` H. Peter Anvin
2025-05-15 16:32                                 ` Maciej W. Rozycki
2025-05-06 13:48         ` Maciej W. Rozycki
2025-05-06 13:54           ` John Paul Adrian Glaubitz
2025-05-05 15:59   ` Linus Torvalds
2025-05-06 13:53     ` Maciej W. Rozycki
2025-05-06 16:44       ` H. Peter Anvin
2025-05-06 17:11         ` Linus Torvalds
2025-05-06 17:51           ` H. Peter Anvin
2025-05-08 14:54             ` Maciej W. Rozycki
2025-05-08 14:53           ` Maciej W. Rozycki
2025-05-08 14:51         ` Maciej W. Rozycki
2025-05-15  8:56 [PATCH -v2 " Ingo Molnar
2025-05-15  8:57 ` [PATCH 13/15] x86/cpu: Make CONFIG_X86_CX8 unconditional Ingo Molnar
2025-12-14  8:46 [PATCH -v3 0/15] x86: Remove support for TSC-less and CX8-less CPUs Ingo Molnar
2025-12-14  8:47 ` [PATCH 13/15] x86/cpu: Make CONFIG_X86_CX8 unconditional Ingo Molnar

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=3005bc00-7ee2-4854-aef7-e274a9940fb2@app.fastmail.com \
    --to=arnd@kernel.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=darwi@linutronix.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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

Powered by JetHome