]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: x86/mmu: Try "unprotect for retry" iff there are indirect SPs
authorSean Christopherson <seanjc@google.com>
Sat, 31 Aug 2024 00:15:24 +0000 (17:15 -0700)
committerSean Christopherson <seanjc@google.com>
Tue, 10 Sep 2024 03:16:24 +0000 (20:16 -0700)
commitdfaae8447c53819749cf3ba10ce24d3c609752e3
tree4e4651559d8d728cef69ad7e86671ece1773c68a
parent01dd4d319207c4cfd51a1c9a1812909e944d8c86
KVM: x86/mmu: Try "unprotect for retry" iff there are indirect SPs

Try to unprotect shadow pages if and only if indirect_shadow_pages is non-
zero, i.e. iff there is at least one protected such shadow page.  Pre-
checking indirect_shadow_pages avoids taking mmu_lock for write when the
gfn is write-protected by a third party, i.e. not for KVM shadow paging,
and in the *extremely* unlikely case that a different task has already
unprotected the last shadow page.

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