diff options
author | Avi Kivity <avi@qumranet.com> | 2008-08-27 09:32:24 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-10-15 04:15:24 -0400 |
commit | 2245a28fe2e6fdb1bdabc4dcde1ea3a5c37e2a9e (patch) | |
tree | 7e43c47167c447b343c279e8562fe08c58b4b759 /arch | |
parent | bc2d429979451d69d0985c5dbdf908cace2831cc (diff) |
KVM: MMU: Add locking around kvm_mmu_slot_remove_write_access()
It was generally safe due to slots_lock being held for write, but it wasn't
very nice.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/mmu.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index a24da8f2ee91..5052acdc0a77 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2097,6 +2097,7 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot) | |||
2097 | { | 2097 | { |
2098 | struct kvm_mmu_page *sp; | 2098 | struct kvm_mmu_page *sp; |
2099 | 2099 | ||
2100 | spin_lock(&kvm->mmu_lock); | ||
2100 | list_for_each_entry(sp, &kvm->arch.active_mmu_pages, link) { | 2101 | list_for_each_entry(sp, &kvm->arch.active_mmu_pages, link) { |
2101 | int i; | 2102 | int i; |
2102 | u64 *pt; | 2103 | u64 *pt; |
@@ -2110,6 +2111,7 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot) | |||
2110 | if (pt[i] & PT_WRITABLE_MASK) | 2111 | if (pt[i] & PT_WRITABLE_MASK) |
2111 | pt[i] &= ~PT_WRITABLE_MASK; | 2112 | pt[i] &= ~PT_WRITABLE_MASK; |
2112 | } | 2113 | } |
2114 | spin_unlock(&kvm->mmu_lock); | ||
2113 | } | 2115 | } |
2114 | 2116 | ||
2115 | void kvm_mmu_zap_all(struct kvm *kvm) | 2117 | void kvm_mmu_zap_all(struct kvm *kvm) |