lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <3005bc00-7ee2-4854-aef7-e274a9940fb2@app.fastmail.com>
Date: Tue, 29 Apr 2025 14:10:05 +0200
From: "Arnd Bergmann" <arnd@...nel.org>
To: "Ingo Molnar" <mingo@...nel.org>
Cc: "H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org,
 "Ahmed S . Darwish" <darwi@...utronix.de>,
 "Andrew Cooper" <andrew.cooper3@...rix.com>,
 "Ard Biesheuvel" <ardb@...nel.org>, "Borislav Petkov" <bp@...en8.de>,
 "Dave Hansen" <dave.hansen@...ux.intel.com>,
 "John Ogness" <john.ogness@...utronix.de>,
 "Linus Torvalds" <torvalds@...ux-foundation.org>,
 "Peter Zijlstra" <peterz@...radead.org>,
 "Thomas Gleixner" <tglx@...utronix.de>
Subject: Re: [PATCH 13/15] x86/cpu: Make CONFIG_X86_CX8 unconditional

On Tue, Apr 29, 2025, at 12:22, Ingo Molnar wrote:
> * Arnd Bergmann <arnd@...nel.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ