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: <4a680b7d-2ecb-4579-a5ea-b612c08ebefa@intel.com>
Date: Fri, 15 Aug 2025 08:25:16 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: "Ahmed S. Darwish" <darwi@...utronix.de>, Borislav Petkov <bp@...en8.de>,
 Ingo Molnar <mingo@...hat.com>, Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
 Andrew Cooper <andrew.cooper3@...rix.com>, "H. Peter Anvin" <hpa@...or.com>,
 David Woodhouse <dwmw2@...radead.org>,
 Sean Christopherson <seanjc@...gle.com>,
 Peter Zijlstra <peterz@...radead.org>, Sohil Mehta <sohil.mehta@...el.com>,
 John Ogness <john.ogness@...utronix.de>, x86@...nel.org,
 x86-cpuid@...ts.linux.dev, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 28/34] x86/cacheinfo: Use parsed CPUID(0x80000005) and
 CPUID(0x80000006)

On 8/15/25 00:02, Ahmed S. Darwish wrote:
> +static void legacy_amd_cpuid4(struct cpuinfo_x86 *c, int index, struct leaf_0x4_0 *regs)
>  {
> -	unsigned int dummy, line_size, lines_per_tag, assoc, size_in_kb;
> -	union l1_cache l1i, l1d, *l1;
> -	union l2_cache l2;
> -	union l3_cache l3;
> +	const struct leaf_0x80000005_0 *el5 = cpuid_leaf(c, 0x80000005);
> +	const struct leaf_0x80000006_0 *el6 = cpuid_leaf(c, 0x80000006);
> +	const struct cpuid_regs *el5_raw = (const struct cpuid_regs *)el5;

Is there any way we could get rid of the casts? The lack of type safety
on those always worries me. Maybe a helper like this:

    const struct cpuid_regs *el5_raw = cpuid_leaf_raw(c, 0x80000006);

(although that would probably just do casts internally). The other way
would be to rig the macros up so that each 'struct leaf_$FOO' had a:

	union {
		struct leaf_0x80000005_0 l;
		struct cpuid_regs raw;
	};

and then the macros just selected one of the two.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ