summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorRadim Krčmář <rkrcmar@redhat.com>2015-04-08 14:16:48 +0200
committerLuis Henriques <luis.henriques@canonical.com>2015-05-06 11:33:06 +0100
commit91209d5cfc82ec22e844c8cf3595294ff0b95fe2 (patch)
tree6ae06313f0603c2fafaa5d48f7ea8fd94e4e4775 /virt
parent23b082a86fd2d37a8dcd055f7a0a4e6146587fb1 (diff)
downloadlinux-stable-91209d5cfc82ec22e844c8cf3595294ff0b95fe2.tar.gz
linux-stable-91209d5cfc82ec22e844c8cf3595294ff0b95fe2.tar.bz2
linux-stable-91209d5cfc82ec22e844c8cf3595294ff0b95fe2.zip
KVM: use slowpath for cross page cached accesses
commit ca3f0874723fad81d0c701b63ae3a17a408d5f25 upstream. 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: 8f964525a121 ("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: Luis Henriques <luis.henriques@canonical.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 27e140d5f073..032150ca597d 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1550,8 +1550,8 @@ int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
ghc->generation = slots->generation;
ghc->len = len;
ghc->memslot = gfn_to_memslot(kvm, start_gfn);
- ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, &nr_pages_avail);
- if (!kvm_is_error_hva(ghc->hva) && nr_pages_avail >= nr_pages_needed) {
+ ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, NULL);
+ if (!kvm_is_error_hva(ghc->hva) && nr_pages_needed <= 1) {
ghc->hva += offset;
} else {
/*