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] [thread-next>] [day] [month] [year] [list]
Message-ID: <bb1d6eb7-7dc8-49be-a4b5-aa461e85ac0b@citrix.com>
Date: Tue, 18 Mar 2025 19:09:59 +0000
From: Andrew Cooper <andrew.cooper3@...rix.com>
To: "H. Peter Anvin" <hpa@...or.com>, mingo@...nel.org,
 linux-kernel@...r.kernel.org
Cc: Juergen Gross <jgross@...e.com>,
 Stefano Stabellini <sstabellini@...nel.org>,
 "Ahmed S . Darwish" <darwi@...utronix.de>,
 John Ogness <john.ogness@...utronix.de>,
 Linus Torvalds <torvalds@...ux-foundation.org>,
 Peter Zijlstra <peterz@...radead.org>, Borislav Petkov <bp@...en8.de>,
 Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 4/5] x86/cpuid: Standardize on u32 in <asm/cpuid/api.h>

On 18/03/2025 6:48 pm, H. Peter Anvin wrote:
> One more thing is that we ought to be able to make cpuid a const function, allowing the compiler to elide multiple calls. (Slight warning for feature-enabling MSRs changing CPUID), but that would require changing the API to returning a structure, since a pure or const structure can't return values by reference.

It's not only the feature-enabling MSRs.  It's also OSXSAVE/OSPKE/etc in
CR4, and on Intel CPUs, the CPUID instruction still has a side effect
for microcode patch revision MSR.

There are a few too many side effects to call it const/pure.

That said, when experimenting with the same in Xen, there was nothing
interesting the compiler could do with const/pure because of how the
existing logic is laid out.  Removing volatile and the memory clobber
however did allow the compiler to make slightly better code.

~Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ