Messages in this thread | | | Subject | Re: [PATCH 07/14] KVM: x86/mmu: Walk host page tables to find THP mappings | From | Paolo Bonzini <> | Date | Tue, 21 Jan 2020 15:40:43 +0100 |
| |
On 08/01/20 21:24, Sean Christopherson wrote: > + > + /* > + * Manually do the equivalent of kvm_vcpu_gfn_to_hva() to avoid the > + * "writable" check in __gfn_to_hva_many(), which will always fail on > + * read-only memslots due to gfn_to_hva() assuming writes. Earlier > + * page fault steps have already verified the guest isn't writing a > + * read-only memslot. > + */ > + slot = kvm_vcpu_gfn_to_memslot(vcpu, gfn); > + if (!memslot_valid_for_gpte(slot, true)) > + return PT_PAGE_TABLE_LEVEL; > + > + hva = __gfn_to_hva_memslot(slot, gfn); > +
Using gfn_to_memslot_dirty_bitmap is also a good excuse to avoid kvm_vcpu_gfn_to_hva.
+ slot = gfn_to_memslot_dirty_bitmap(vcpu, gfn, true); + if (!slot) + return PT_PAGE_TABLE_LEVEL; + + hva = __gfn_to_hva_memslot(slot, gfn);
(I am planning to remove gfn_to_hva_memslot so that __gfn_to_hva_memslot can lose the annoying underscores).
Paolo
| |