Re: [PATCH AUTOSEL 5.10 2/6] x86/cpu: Don't clear X86_FEATURE_LAHF_LM flag in init_amd_k8() on AMD when running in a virtual machine

From: Pavel Machek
Date: Fri Apr 18 2025 - 12:54:55 EST


Hi!

> From: Max Grobecker <max@xxxxxxxxxxxxxx>
>
> [ Upstream commit a4248ee16f411ac1ea7dfab228a6659b111e3d65 ]

> This can prevent some docker containers from starting or build scripts to create
> unoptimized binaries.
>
> Admittably, this is more a small inconvenience than a severe bug in the kernel
> and the shoddy scripts that rely on parsing /proc/cpuinfo
> should be fixed instead.

I'd say this is not good stable candidate.

Best regards,
Pavel

> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -839,7 +839,7 @@ static void init_amd_k8(struct cpuinfo_x86 *c)
> * (model = 0x14) and later actually support it.
> * (AMD Erratum #110, docId: 25759).
> */
> - if (c->x86_model < 0x14 && cpu_has(c, X86_FEATURE_LAHF_LM)) {
> + if (c->x86_model < 0x14 && cpu_has(c, X86_FEATURE_LAHF_LM) && !cpu_has(c, X86_FEATURE_HYPERVISOR)) {
> clear_cpu_cap(c, X86_FEATURE_LAHF_LM);
> if (!rdmsrl_amd_safe(0xc001100d, &value)) {
> value &= ~BIT_64(32);

--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Attachment: signature.asc
Description: PGP signature