]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
KVM: switch pit creation to slots_lock
authorMichael S. Tsirkin <mst@redhat.com>
Mon, 29 Jun 2009 19:24:21 +0000 (22:24 +0300)
committerAvi Kivity <avi@redhat.com>
Thu, 10 Sep 2009 05:33:05 +0000 (08:33 +0300)
switch pit creation to slots_lock. slots_lock is already taken for read
everywhere, so we only need to take it for write when creating pit.
This is in preparation to removing in_range and kvm->lock around it.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/x86.c

index 0be75d53b7fd7a8f42d786dcff740c0fa20d972c..7ce6367c1976eb6d7e764d59991763e777a927c5 100644 (file)
@@ -2188,7 +2188,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
                                   sizeof(struct kvm_pit_config)))
                        goto out;
        create_pit:
-               mutex_lock(&kvm->lock);
+               down_write(&kvm->slots_lock);
                r = -EEXIST;
                if (kvm->arch.vpit)
                        goto create_pit_unlock;
@@ -2197,7 +2197,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
                if (kvm->arch.vpit)
                        r = 0;
        create_pit_unlock:
-               mutex_unlock(&kvm->lock);
+               up_write(&kvm->slots_lock);
                break;
        case KVM_IRQ_LINE_STATUS:
        case KVM_IRQ_LINE: {