Skip to content

Commit 35e1329

Browse files
rkrcmarsashalevin
authored andcommitted
KVM: use slowpath for cross page cached accesses
[ Upstream commit ca3f087 ] kvm_write_guest_cached() does not mark all written pages as dirty and code comments in kvm_gfn_to_hva_cache_init() talk about NULL memslot with cross page accesses. Fix all the easy way. The check is '<= 1' to have the same result for 'len = 0' cache anywhere in the page. (nr_pages_needed is 0 on page boundary.) Fixes: 8f96452 ("KVM: Allow cross page reads and writes from cached translations.") Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Message-Id: <20150408121648.GA3519@potion.brq.redhat.com> Reviewed-by: Wanpeng Li <wanpeng.li@linux.intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
1 parent 2378645 commit 35e1329

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎virt/kvm/kvm_main.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,8 +1615,8 @@ int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
16151615
ghc->generation = slots->generation;
16161616
ghc->len = len;
16171617
ghc->memslot = gfn_to_memslot(kvm, start_gfn);
1618-
ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, &nr_pages_avail);
1619-
if (!kvm_is_error_hva(ghc->hva) && nr_pages_avail >= nr_pages_needed) {
1618+
ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, NULL);
1619+
if (!kvm_is_error_hva(ghc->hva) && nr_pages_needed <= 1) {
16201620
ghc->hva += offset;
16211621
} else {
16221622
/*

0 commit comments

Comments
 (0)