[58/80] KVM: MMU: fix mmu notifier invalidate handler for huge spte
From: Greg KH
Date: Fri Sep 24 2010 - 12:33:22 EST
2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andrea Arcangeli <aarcange@xxxxxxxxxx>
commit 6e3e243c3b6e0bbd18c6ce0fbc12bc3fe2d77b34 upstream.
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@xxxxxxxxxx>
Reviewed-by: Reviewed-by: Rik van Riel <riel@xxxxxxxxxx>
Signed-off-by: Avi Kivity <avi@xxxxxxxxxx>
Cc: Marcelo Tosatti <mtosatti@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
arch/x86/kvm/mmu.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -799,8 +799,12 @@ static int kvm_handle_hva(struct kvm *kv
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 nr;
+
+ nr = KVM_PAGES_PER_HPAGE(PT_DIRECTORY_LEVEL+j);
+ idx = (memslot->base_gfn+gfn_offset) / nr -
+ memslot->base_gfn / nr;
ret |= handler(kvm,
&memslot->lpage_info[j][idx].rmap_pde,
data);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/