]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
KVM: Allow reading aliases with mmu_lock
authorAndrea Arcangeli <andrea@qumranet.com>
Fri, 25 Jul 2008 14:26:39 +0000 (16:26 +0200)
committerAvi Kivity <avi@qumranet.com>
Tue, 29 Jul 2008 09:33:40 +0000 (12:33 +0300)
This allows the mmu notifier code to run unalias_gfn with only the
mmu_lock held.  Only alias writes need the mmu_lock held. Readers will
either take the slots_lock in read mode or the mmu_lock.

Signed-off-by: Andrea Arcangeli <andrea@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/x86.c

index 5916191420c714d7e9b43ca9b1bf995672f88eab..9870ce4229209f8663b9dfc827899607a835ac9f 100644 (file)
@@ -1495,6 +1495,7 @@ static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm,
                goto out;
 
        down_write(&kvm->slots_lock);
+       spin_lock(&kvm->mmu_lock);
 
        p = &kvm->arch.aliases[alias->slot];
        p->base_gfn = alias->guest_phys_addr >> PAGE_SHIFT;
@@ -1506,6 +1507,7 @@ static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm,
                        break;
        kvm->arch.naliases = n;
 
+       spin_unlock(&kvm->mmu_lock);
        kvm_mmu_zap_all(kvm);
 
        up_write(&kvm->slots_lock);