aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2010-07-16 05:52:55 -0400
committerAvi Kivity <avi@redhat.com>2010-08-01 23:40:54 -0400
commit6e3e243c3b6e0bbd18c6ce0fbc12bc3fe2d77b34 (patch)
tree05c55ba3c27ba5c778ec36c9c875534a81dffe10 /arch/x86/kvm
parentc19b8bd60e19308d5583ef200ddcc782d85d9543 (diff)
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/x86/kvm')
-rw-r--r--arch/x86/kvm/mmu.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 36c62f33513f..812770cddc8d 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,
850 ret = handler(kvm, &memslot->rmap[gfn_offset], data); 850 ret = handler(kvm, &memslot->rmap[gfn_offset], data);
851 851
852 for (j = 0; j < KVM_NR_PAGE_SIZES - 1; ++j) { 852 for (j = 0; j < KVM_NR_PAGE_SIZES - 1; ++j) {
853 int idx = gfn_offset; 853 unsigned long idx;
854 idx /= KVM_PAGES_PER_HPAGE(PT_DIRECTORY_LEVEL + j); 854 int sh;
855
856 sh = KVM_HPAGE_GFN_SHIFT(PT_DIRECTORY_LEVEL+j);
857 idx = ((memslot->base_gfn+gfn_offset) >> sh) -
858 (memslot->base_gfn >> sh);
855 ret |= handler(kvm, 859 ret |= handler(kvm,
856 &memslot->lpage_info[j][idx].rmap_pde, 860 &memslot->lpage_info[j][idx].rmap_pde,
857 data); 861 data);