Re: [PATCH 0/4] KVM: x86: Cleanup #MC and XCR0/XSS/PKRU handling

From: Sean Christopherson
Date: Mon Nov 17 2025 - 13:35:23 EST


On Mon, Nov 10, 2025, Sean Christopherson wrote:
> On Thu, 30 Oct 2025 15:42:42 -0700, Sean Christopherson wrote:
> > This series is the result of the recent PUCK discussion[*] on optimizing the
> > XCR0/XSS loads that are currently done on every VM-Enter and VM-Exit. My
> > initial thought that swapping XCR0/XSS outside of the fastpath was spot on;
> > turns out the only reason they're swapped in the fastpath is because of a
> > hack-a-fix that papered over an egregious #MC handling bug where the kernel #MC
> > handler would call schedule() from an atomic context. The resulting #GP due to
> > trying to swap FPU state with a guest XCR0/XSS was "fixed" by loading the host
> > values before handling #MCs from the guest.
> >
> > [...]
>
> Applied to kvm-x86 misc, thanks!
>
> [1/4] KVM: SVM: Handle #MCs in guest outside of fastpath
> https://github.com/kvm-x86/linux/commit/6e640bb5caab
> [2/4] KVM: VMX: Handle #MCs on VM-Enter/TD-Enter outside of the fastpath
> https://github.com/kvm-x86/linux/commit/8934c592bcbf
> [3/4] KVM: x86: Load guest/host XCR0 and XSS outside of the fastpath run loop
> https://github.com/kvm-x86/linux/commit/3377a9233d30
> [4/4] KVM: x86: Load guest/host PKRU outside of the fastpath run loop
> https://github.com/kvm-x86/linux/commit/7df3021b622f

I've dropped these for now as patch 2 broke TDX. I'll send a v2 shortly.