提交 108b5669 编写于 作者: M Michael S. Tsirkin 提交者: Avi Kivity

KVM: switch pit creation to slots_lock

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: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 d5c2dcc3
...@@ -2188,7 +2188,7 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -2188,7 +2188,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
sizeof(struct kvm_pit_config))) sizeof(struct kvm_pit_config)))
goto out; goto out;
create_pit: create_pit:
mutex_lock(&kvm->lock); down_write(&kvm->slots_lock);
r = -EEXIST; r = -EEXIST;
if (kvm->arch.vpit) if (kvm->arch.vpit)
goto create_pit_unlock; goto create_pit_unlock;
...@@ -2197,7 +2197,7 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -2197,7 +2197,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
if (kvm->arch.vpit) if (kvm->arch.vpit)
r = 0; r = 0;
create_pit_unlock: create_pit_unlock:
mutex_unlock(&kvm->lock); up_write(&kvm->slots_lock);
break; break;
case KVM_IRQ_LINE_STATUS: case KVM_IRQ_LINE_STATUS:
case KVM_IRQ_LINE: { case KVM_IRQ_LINE: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册