Skip to content

Commit 108b566

Browse files
mstsirkinavikivity
authored andcommitted
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: Michael S. Tsirkin <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
1 parent d5c2dcc commit 108b566

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kvm/x86.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -2188,7 +2188,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
21882188
sizeof(struct kvm_pit_config)))
21892189
goto out;
21902190
create_pit:
2191-
mutex_lock(&kvm->lock);
2191+
down_write(&kvm->slots_lock);
21922192
r = -EEXIST;
21932193
if (kvm->arch.vpit)
21942194
goto create_pit_unlock;
@@ -2197,7 +2197,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
21972197
if (kvm->arch.vpit)
21982198
r = 0;
21992199
create_pit_unlock:
2200-
mutex_unlock(&kvm->lock);
2200+
up_write(&kvm->slots_lock);
22012201
break;
22022202
case KVM_IRQ_LINE_STATUS:
22032203
case KVM_IRQ_LINE: {

0 commit comments

Comments
 (0)