aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/paging_tmpl.h
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-01-05 19:36:52 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2007-01-06 02:55:26 -0500
commit143646567f6dcd584e1ab359b5ec83e0545e70cf (patch)
tree0fd9d4018799b3cc39902fe66a9e6f3bf5c882b7 /drivers/kvm/paging_tmpl.h
parent32b35627355c3bf17e1903efd117efed7653a54e (diff)
[PATCH] KVM: MMU: Treat user-mode faults as a hint that a page is no longer a page table
Signed-off-by: Avi Kivity <avi@qumranet.com> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/kvm/paging_tmpl.h')
-rw-r--r--drivers/kvm/paging_tmpl.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h
index 03c474aaedde..6acb16ea5ce2 100644
--- a/drivers/kvm/paging_tmpl.h
+++ b/drivers/kvm/paging_tmpl.h
@@ -271,6 +271,7 @@ static int FNAME(fix_write_pf)(struct kvm_vcpu *vcpu,
271 pt_element_t *guest_ent; 271 pt_element_t *guest_ent;
272 int writable_shadow; 272 int writable_shadow;
273 gfn_t gfn; 273 gfn_t gfn;
274 struct kvm_mmu_page *page;
274 275
275 if (is_writeble_pte(*shadow_ent)) 276 if (is_writeble_pte(*shadow_ent))
276 return 0; 277 return 0;
@@ -303,7 +304,17 @@ static int FNAME(fix_write_pf)(struct kvm_vcpu *vcpu,
303 } 304 }
304 305
305 gfn = walker->gfn; 306 gfn = walker->gfn;
306 if (kvm_mmu_lookup_page(vcpu, gfn)) { 307
308 if (user) {
309 /*
310 * Usermode page faults won't be for page table updates.
311 */
312 while ((page = kvm_mmu_lookup_page(vcpu, gfn)) != NULL) {
313 pgprintk("%s: zap %lx %x\n",
314 __FUNCTION__, gfn, page->role.word);
315 kvm_mmu_zap_page(vcpu, page);
316 }
317 } else if (kvm_mmu_lookup_page(vcpu, gfn)) {
307 pgprintk("%s: found shadow page for %lx, marking ro\n", 318 pgprintk("%s: found shadow page for %lx, marking ro\n",
308 __FUNCTION__, gfn); 319 __FUNCTION__, gfn);
309 *write_pt = 1; 320 *write_pt = 1;