[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250418191224.GFaAKkGBnb01tGUVhW@fat_crate.local>
Date: Fri, 18 Apr 2025 21:12:24 +0200
From: Borislav Petkov <bp@...en8.de>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Pavel Machek <pavel@...x.de>, Sasha Levin <sashal@...nel.org>,
linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Max Grobecker <max@...becker.info>, Ingo Molnar <mingo@...nel.org>,
tglx@...utronix.de, mingo@...hat.com, dave.hansen@...ux.intel.com,
x86@...nel.org, thomas.lendacky@....com, perry.yuan@....com,
mario.limonciello@....com, riel@...riel.com, mjguzik@...il.com,
darwi@...utronix.de
Subject: 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
On Fri, Apr 18, 2025 at 11:31:27AM -0700, Sean Christopherson wrote:
> IMO, this is blatantly a QEMU bug (I verified the behavior when using "kvm64" on AMD).
> As per QEMU commit d1cd4bf419 ("introduce kvm64 CPU"), the vendor + FMS enumerates
> an Intel P4:
>
> .name = "kvm64",
> .level = 0xd,
> .vendor = CPUID_VENDOR_INTEL,
> .family = 15,
> .model = 6,
>
> Per x86_cpu_load_model(), QEMU overrides the vendor when using KVM (at a glance,
> I can't find the code that actually overrides the vendor, gotta love QEMU's object
> model):
LOL, I thought I was the only one who thought this is madness. :-P
>
> /*
> * vendor property is set here but then overloaded with the
> * host cpu vendor for KVM and HVF.
> */
> object_property_set_str(OBJECT(cpu), "vendor", def->vendor, &error_abort);
>
> Overriding the vendor but using Intel's P4 FMS is flat out wrong. IMO, QEMU
> should use the same FMS as qemu64 for kvm64 when running on AMD.
>
> .name = "qemu64",
> .level = 0xd,
> .vendor = CPUID_VENDOR_AMD,
> .family = 15,
> .model = 107,
> .stepping = 1,
>
> Yeah, scraping FMS information is a bad idea, but what QEMU is doing is arguably
> far worse.
Ok, let's fix qemu. I don't have a clue, though, how to go about that so I'd
rely on your guidance here.
Because I really hate wagging the dog and "fixing" the kernel because something
else can't be bothered. I didn't object stronger to that fix because it is
meh, more of those "if I'm a guest" gunk which we sprinkle nowadays and that's
apparently not that awful-ish...
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists