Re: [PATCH 12/16] KVM: x86/mmu: Move slot checks from __kvm_faultin_pfn() to kvm_faultin_pfn()

From: Huang, Kai
Date: Wed Mar 06 2024 - 19:11:40 EST





Ditto for accesses to KVM internal memslots from L2, which
KVM also treats as emulated MMIO.

Nit:

This is not accurate anymore due to your previous patch ("KVM: x86/mmu: Don't force emulation of L2 accesses to non-APIC internal slots").


More importantly, this will allow for future cleanup by having the
"no memslot" case bail from kvm_faultin_pfn() very early on.

Go to rather extreme and gross lengths to make the change a glorified
nop, e.g. call into __kvm_faultin_pfn() even when there is no slot, as the
related code is very subtle. E.g. fault->slot can be nullified if it
points at the APIC access page, some flows in KVM x86 expect fault->pfn
to be KVM_PFN_NOSLOT, while others check only fault->slot, etc.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>

Feel free to add:

Reviewed-by: Kai Huang <kai.huang@xxxxxxxxx>