diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2020-04-16 15:48:07 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-04-21 15:13:08 +0200 |
commit | c36b71503a2268206ebeda6697094ffb4e7e94c2 (patch) | |
tree | 21246416886044ae8a3cfd39b9af17b6600bbb15 /virt | |
parent | KVM: x86/mmu: Set @writable to false for non-visible accesses by L2 (diff) | |
download | linux-c36b71503a2268206ebeda6697094ffb4e7e94c2.tar.xz linux-c36b71503a2268206ebeda6697094ffb4e7e94c2.zip |
KVM: x86/mmu: Avoid an extra memslot lookup in try_async_pf() for L2
Create a new function kvm_is_visible_memslot() and use it from
kvm_is_visible_gfn(); use the new function in try_async_pf() too,
to avoid an extra memslot lookup.
Opportunistically squish a multi-line comment into a single-line comment.
Note, the end result, KVM_PFN_NOSLOT, is unchanged.
Cc: Jim Mattson <jmattson@google.com>
Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
Suggested-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index da8fd45e0e3e..8aa577db131e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1607,11 +1607,7 @@ bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn) { struct kvm_memory_slot *memslot = gfn_to_memslot(kvm, gfn); - if (!memslot || memslot->id >= KVM_USER_MEM_SLOTS || - memslot->flags & KVM_MEMSLOT_INVALID) - return false; - - return true; + return kvm_is_visible_memslot(memslot); } EXPORT_SYMBOL_GPL(kvm_is_visible_gfn); |