diff options
author | Marcelo Tosatti <marcelo@kvack.org> | 2008-03-29 19:17:59 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-04-27 05:00:52 -0400 |
commit | 3200f405a1e8e06c8634f11d33614455baa4e6be (patch) | |
tree | 806116d2495dd7fd93b5c0db98a72fe4fa854787 /arch/x86/kvm/vmx.c | |
parent | 25c5f225beda4fbea878ed8b6203ab4ecc7de2d1 (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/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 87eee7a7f16e..6249810b2155 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -1505,7 +1505,6 @@ static int init_rmode_tss(struct kvm *kvm) | |||
1505 | int ret = 0; | 1505 | int ret = 0; |
1506 | int r; | 1506 | int r; |
1507 | 1507 | ||
1508 | down_read(&kvm->slots_lock); | ||
1509 | r = kvm_clear_guest_page(kvm, fn, 0, PAGE_SIZE); | 1508 | r = kvm_clear_guest_page(kvm, fn, 0, PAGE_SIZE); |
1510 | if (r < 0) | 1509 | if (r < 0) |
1511 | goto out; | 1510 | goto out; |
@@ -1528,7 +1527,6 @@ static int init_rmode_tss(struct kvm *kvm) | |||
1528 | 1527 | ||
1529 | ret = 1; | 1528 | ret = 1; |
1530 | out: | 1529 | out: |
1531 | up_read(&kvm->slots_lock); | ||
1532 | return ret; | 1530 | return ret; |
1533 | } | 1531 | } |
1534 | 1532 | ||
@@ -1730,6 +1728,7 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) | |||
1730 | u64 msr; | 1728 | u64 msr; |
1731 | int ret; | 1729 | int ret; |
1732 | 1730 | ||
1731 | down_read(&vcpu->kvm->slots_lock); | ||
1733 | if (!init_rmode_tss(vmx->vcpu.kvm)) { | 1732 | if (!init_rmode_tss(vmx->vcpu.kvm)) { |
1734 | ret = -ENOMEM; | 1733 | ret = -ENOMEM; |
1735 | goto out; | 1734 | goto out; |
@@ -1833,9 +1832,10 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) | |||
1833 | 1832 | ||
1834 | vpid_sync_vcpu_all(vmx); | 1833 | vpid_sync_vcpu_all(vmx); |
1835 | 1834 | ||
1836 | return 0; | 1835 | ret = 0; |
1837 | 1836 | ||
1838 | out: | 1837 | out: |
1838 | up_read(&vcpu->kvm->slots_lock); | ||
1839 | return ret; | 1839 | return ret; |
1840 | } | 1840 | } |
1841 | 1841 | ||