Patchwork [1/4] KVM: MMU: Use gfn_to_rmap() in audit_write_protection()

login
register
mail settings
Submitter Takuya Yoshikawa
Date Jan. 23, 2012, 10:43 a.m.
Message ID <20120123194311.c8abacde.yoshikawa.takuya@oss.ntt.co.jp>
Download mbox | patch
Permalink /patch/137333/
State New
Headers show

Comments

Takuya Yoshikawa - Jan. 23, 2012, 10:43 a.m.
We want to eliminate direct access to the rmap array.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
---
 arch/x86/kvm/mmu_audit.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

Patch

diff --git a/arch/x86/kvm/mmu_audit.c b/arch/x86/kvm/mmu_audit.c
index 6eabae3..e62fa4f 100644
--- a/arch/x86/kvm/mmu_audit.c
+++ b/arch/x86/kvm/mmu_audit.c
@@ -190,15 +190,13 @@  static void check_mappings_rmap(struct kvm *kvm, struct kvm_mmu_page *sp)
 
 static void audit_write_protection(struct kvm *kvm, struct kvm_mmu_page *sp)
 {
-	struct kvm_memory_slot *slot;
 	unsigned long *rmapp;
 	u64 *spte;
 
 	if (sp->role.direct || sp->unsync || sp->role.invalid)
 		return;
 
-	slot = gfn_to_memslot(kvm, sp->gfn);
-	rmapp = &slot->rmap[sp->gfn - slot->base_gfn];
+	rmapp = gfn_to_rmap(kvm, sp->gfn, PT_PAGE_TABLE_LEVEL);
 
 	spte = rmap_next(rmapp, NULL);
 	while (spte) {