RE: [PATCH v3 3/4] KVM: x86: Virtualize AMD CPUID faulting

From: Kaplan, David

Date: Thu May 14 2026 - 14:17:44 EST


AMD General

> -----Original Message-----
> From: Jim Mattson <jmattson@xxxxxxxxxx>
> Sent: Thursday, May 14, 2026 1:02 PM
> To: Sean Christopherson <seanjc@xxxxxxxxxx>; Kaplan, David
> <David.Kaplan@xxxxxxx>
> Cc: pbonzini@xxxxxxxxxx; tglx@xxxxxxxxxx; mingo@xxxxxxxxxx;
> bp@xxxxxxxxx; dave.hansen@xxxxxxxxxxxxxxx; x86@xxxxxxxxxx;
> hpa@xxxxxxxxx; shuah@xxxxxxxxxx; kvm@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; linux-kselftest@xxxxxxxxxxxxxxx; ctpence@xxxxxxxxxx
> Subject: Re: [PATCH v3 3/4] KVM: x86: Virtualize AMD CPUID faulting
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Thu, May 14, 2026 at 9:35 AM Sean Christopherson
> <seanjc@xxxxxxxxxx> wrote:
> >
> > On Thu, May 14, 2026, Jim Mattson wrote:
> > > On Thu, May 14, 2026 at 9:20 AM Sean Christopherson
> <seanjc@xxxxxxxxxx> wrote:
> > > > Oooh, this is based on the generic CPL rules. I didn't think about it from
> that
> > > > perspective. So yeah, addressing that does make sense. What a pain.
> > >
> > > When I fix this in version 4, what's the correct footer for Sashiko
> attribution:
> > >
> > > Assisted-by: Sashiko:gemini/gemini-3.1-pro-preview
> > >
> > > or
> > >
> > > Reported-by: Sashiko:gemini/gemini-3.1-pro-preview
> >
> > This, or even just:
> >
> > Reported-by: Sashiko
> >
> > is good enough for me. I don't expect random developers to know or care
> what
> > model was used, at least not when it comes to reporting bugs. If you use AI
> to
> > help write the code, then maybe I'd care?
>
> I had Jetski write an empirical test to see how the hardware behaves.
> On the first userspace CPUID VM-exit, temporarily set #GP on userspace
> CPUID per the appropriate vendor's mechanism, make sure that we
> intercept #GP, and re-enter the guest without advancing RIP. Then, see
> what the next VM-exit is.
>
> Surprise!
>
> kvm_intel: KVM: EMPIRICAL TEST RESULT: #GP took precedence over CPUID
> VM-exit
> kvm_amd: KVM: EMPIRICAL TEST RESULT (SVM): CPUID VM-exit took
> precedence over #GP!
>
> LOL!
>
> David: Is this intentional or a bug?

This appears to be a bug, as most other instructions (e.g. INVPCID) that have CPL checks do the CPL checks before the VMEXIT checks. I'm following up on this internally...

Thanks for bringing this to our attention
--David Kaplan