Skip to contentSkip to conversation

mmu notifier index huge spte fix

PATCH Applied Andrea Arcangeli 3 participants 3 messages Jul 16, 2010 – Jul 19, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmu notifier index huge spte fix

Subject: fix kvm mmu notifier invalidate handler for huge spte

From: Andrea Arcangeli <[email protected]>

The index wasn't calucalted correctly (off by one) for huge spte so KVM guest was unstable with transparent hugepages.

---

arch/x86/kvm/mmu.c +6 -2
index d16efbe..da44e31 100644
@@ -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);
Applied
#2 lore raw
In reply to Andrea Arcangeli
Quoted 7 lines · Andrea Arcangeli

Subject: fix kvm mmu notifier invalidate handler for huge spte

From: Andrea Arcangeli<[email protected]>

The index wasn't calucalted correctly (off by one) for huge spte so KVM guest was unstable with transparent hugepages.

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function