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: <Z9p9VcQ3CO7Mrubl@lx-t490>
Date: Wed, 19 Mar 2025 09:16:21 +0100
From: "Ahmed S. Darwish" <darwi@...utronix.de>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Andrew Cooper <andrew.cooper3@...rix.com>, mingo@...nel.org,
	linux-kernel@...r.kernel.org, Juergen Gross <jgross@...e.com>,
	Stefano Stabellini <sstabellini@...nel.org>,
	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 Tue, 18 Mar 2025, H. Peter Anvin wrote:
>
> tglx has suggested that we should cache or even preload the cpuid data
> (the latter would have the potential advantage of making the memory
> data structures a little easier to manage, given the very large
>  potential space.)
>

This is indeed in the patch queue that I plan to send after this leaf
cleanups one gets merged.  We have a data model and CPUIDs are cached on
early boot.  The cache is also refreshed during machine state changes
where the CPUIDs can change; e.g. a microcode update, PSN disable, etc.

Call sites then just do:

    a = cpudata_cpuid(c, 0x0)->max_std_leaf;
    b = cpudata_cpuid(c, 0x80000000)->max_ext_leaf;

    struct leaf_0x1_0 *l1 = cpudata_cpuid(c, 0x1);
    x = l0->cpu_vendorid_0;
    y = l0->cpu_vendorid_1;
    z = l0->cpu_vendorid_2;

and all the data is retrieved auto-magically from the cached tables.

The struct leaf_0xM_N C99 bitfield listings are auto generated by
x86-cpuid-db of course, just like in tools/arch/x86/kcpuid/cpuid.csv.

Thanks,

--
Ahmed S. Darwish
Linutronix GmbH

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ