KVM: x86: Drop dedicated logic for direct MMUs in reexecute_instruction()
authorSean Christopherson <seanjc@google.com>
Sat, 3 Feb 2024 00:23:41 +0000 (16:23 -0800)
committerSean Christopherson <seanjc@google.com>
Fri, 23 Feb 2024 00:19:06 +0000 (16:19 -0800)
commit515c18a64e704bc932c5a64e25aaeb712252cf0b
treeda833eee797ac7e10bb06518a61d289caba1e7c3
parent474b99ed703b7e4031f3925adacf19e7c8af2075
KVM: x86: Drop dedicated logic for direct MMUs in reexecute_instruction()

Now that KVM doesn't pointlessly acquire mmu_lock for direct MMUs, drop
the dedicated path entirely and always query indirect_shadow_pages when
deciding whether or not to try unprotecting the gfn.  For indirect, a.k.a.
shadow MMUs, checking indirect_shadow_pages is harmless; unless *every*
shadow page was somehow zapped while KVM was attempting to emulate the
instruction, indirect_shadow_pages is guaranteed to be non-zero.

Well, unless the instruction used a direct hugepage with 2-level paging
for its code page, but in that case, there's obviously nothing to
unprotect.  And in the extremely unlikely case all shadow pages were
zapped, there's again obviously nothing to unprotect.

Link: https://lore.kernel.org/r/20240203002343.383056-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/x86.c