diff options
author | Andrea Arcangeli <aarcange@redhat.com> | 2010-07-16 11:52:55 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-08-02 06:40:54 +0300 |
commit | 6e3e243c3b6e0bbd18c6ce0fbc12bc3fe2d77b34 (patch) | |
tree | 05c55ba3c27ba5c778ec36c9c875534a81dffe10 /arch | |
parent | c19b8bd60e19308d5583ef200ddcc782d85d9543 (diff) | |
download | linux-3.10-6e3e243c3b6e0bbd18c6ce0fbc12bc3fe2d77b34.tar.gz linux-3.10-6e3e243c3b6e0bbd18c6ce0fbc12bc3fe2d77b34.tar.bz2 linux-3.10-6e3e243c3b6e0bbd18c6ce0fbc12bc3fe2d77b34.zip |
KVM: MMU: fix mmu notifier invalidate handler for huge spte
The index wasn't calculated correctly (off by one) for huge spte so KVM guest
was unstable with transparent hugepages.
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Reviewed-by: Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/mmu.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 36c62f33513..812770cddc8 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -850,8 +850,12 @@ static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, ret = handler(kvm, &memslot->rmap[gfn_offset], data); for (j = 0; j < KVM_NR_PAGE_SIZES - 1; ++j) { - int idx = gfn_offset; - idx /= KVM_PAGES_PER_HPAGE(PT_DIRECTORY_LEVEL + j); + unsigned long idx; + int sh; + + sh = KVM_HPAGE_GFN_SHIFT(PT_DIRECTORY_LEVEL+j); + idx = ((memslot->base_gfn+gfn_offset) >> sh) - + (memslot->base_gfn >> sh); ret |= handler(kvm, &memslot->lpage_info[j][idx].rmap_pde, data); |