]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
KVM: MMU: Add locking around kvm_mmu_slot_remove_write_access()
authorAvi Kivity <avi@qumranet.com>
Wed, 27 Aug 2008 13:32:24 +0000 (16:32 +0300)
committerAvi Kivity <avi@qumranet.com>
Wed, 15 Oct 2008 08:15:24 +0000 (10:15 +0200)
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>
arch/x86/kvm/mmu.c

index a24da8f2ee9136d603848b04bc24682199989ec4..5052acdc0a77f79303beafcdbfbc4aab69ec0636 100644 (file)
@@ -2097,6 +2097,7 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot)
 {
        struct kvm_mmu_page *sp;
 
+       spin_lock(&kvm->mmu_lock);
        list_for_each_entry(sp, &kvm->arch.active_mmu_pages, link) {
                int i;
                u64 *pt;
@@ -2110,6 +2111,7 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot)
                        if (pt[i] & PT_WRITABLE_MASK)
                                pt[i] &= ~PT_WRITABLE_MASK;
        }
+       spin_unlock(&kvm->mmu_lock);
 }
 
 void kvm_mmu_zap_all(struct kvm *kvm)