aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/paging_tmpl.h
diff options
context:
space:
mode:
authorMarcelo Tosatti <marcelo@kvack.org>2008-03-29 19:17:59 -0400
committerAvi Kivity <avi@qumranet.com>2008-04-27 05:00:52 -0400
commit3200f405a1e8e06c8634f11d33614455baa4e6be (patch)
tree806116d2495dd7fd93b5c0db98a72fe4fa854787 /arch/x86/kvm/paging_tmpl.h
parent25c5f225beda4fbea878ed8b6203ab4ecc7de2d1 (diff)
KVM: MMU: unify slots_lock usage
Unify slots_lock acquision around vcpu_run(). This is simpler and less error-prone. Also fix some callsites that were not grabbing the lock properly. [avi: drop slots_lock while in guest mode to avoid holding the lock for indefinite periods] Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm/paging_tmpl.h')
-rw-r--r--arch/x86/kvm/paging_tmpl.h4
1 files changed, 0 insertions, 4 deletions
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index e9ae5dba724e..57d872aec663 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -388,7 +388,6 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
388 if (r) 388 if (r)
389 return r; 389 return r;
390 390
391 down_read(&vcpu->kvm->slots_lock);
392 /* 391 /*
393 * Look up the shadow pte for the faulting address. 392 * Look up the shadow pte for the faulting address.
394 */ 393 */
@@ -402,7 +401,6 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
402 pgprintk("%s: guest page fault\n", __func__); 401 pgprintk("%s: guest page fault\n", __func__);
403 inject_page_fault(vcpu, addr, walker.error_code); 402 inject_page_fault(vcpu, addr, walker.error_code);
404 vcpu->arch.last_pt_write_count = 0; /* reset fork detector */ 403 vcpu->arch.last_pt_write_count = 0; /* reset fork detector */
405 up_read(&vcpu->kvm->slots_lock);
406 return 0; 404 return 0;
407 } 405 }
408 406
@@ -422,7 +420,6 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
422 if (is_error_page(page)) { 420 if (is_error_page(page)) {
423 pgprintk("gfn %x is mmio\n", walker.gfn); 421 pgprintk("gfn %x is mmio\n", walker.gfn);
424 kvm_release_page_clean(page); 422 kvm_release_page_clean(page);
425 up_read(&vcpu->kvm->slots_lock);
426 return 1; 423 return 1;
427 } 424 }
428 425
@@ -440,7 +437,6 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
440 ++vcpu->stat.pf_fixed; 437 ++vcpu->stat.pf_fixed;
441 kvm_mmu_audit(vcpu, "post page fault (fixed)"); 438 kvm_mmu_audit(vcpu, "post page fault (fixed)");
442 spin_unlock(&vcpu->kvm->mmu_lock); 439 spin_unlock(&vcpu->kvm->mmu_lock);
443 up_read(&vcpu->kvm->slots_lock);
444 440
445 return write_pt; 441 return write_pt;
446} 442}