aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-05-13 04:25:04 -0400
committerAvi Kivity <avi@redhat.com>2010-08-01 03:35:47 -0400
commit2122ff5eab8faec853e43f6de886e8dc8f31e317 (patch)
treee2a31431281f255c6dd38a79ffba4f051fd5b20d /virt
parent1683b2416e4c514d30ff5844a06733d0444ee000 (diff)
KVM: move vcpu locking to dispatcher for generic vcpu ioctls
All vcpu ioctls need to be locked, so instead of locking each one specifically we lock at the generic dispatcher. This patch only updates generic ioctls and leaves arch specific ioctls alone. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 187aa8d984a7..e0fb0988a3fe 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1392,6 +1392,18 @@ static long kvm_vcpu_ioctl(struct file *filp,
1392 1392
1393 if (vcpu->kvm->mm != current->mm) 1393 if (vcpu->kvm->mm != current->mm)
1394 return -EIO; 1394 return -EIO;
1395
1396#if defined(CONFIG_S390) || defined(CONFIG_PPC)
1397 /*
1398 * Special cases: vcpu ioctls that are asynchronous to vcpu execution,
1399 * so vcpu_load() would break it.
1400 */
1401 if (ioctl == KVM_S390_INTERRUPT || ioctl == KVM_INTERRUPT)
1402 return kvm_arch_vcpu_ioctl(filp, ioctl, arg);
1403#endif
1404
1405
1406 vcpu_load(vcpu);
1395 switch (ioctl) { 1407 switch (ioctl) {
1396 case KVM_RUN: 1408 case KVM_RUN:
1397 r = -EINVAL; 1409 r = -EINVAL;
@@ -1566,9 +1578,12 @@ out_free2:
1566 break; 1578 break;
1567 } 1579 }
1568 default: 1580 default:
1581 vcpu_put(vcpu);
1569 r = kvm_arch_vcpu_ioctl(filp, ioctl, arg); 1582 r = kvm_arch_vcpu_ioctl(filp, ioctl, arg);
1583 vcpu_load(vcpu);
1570 } 1584 }
1571out: 1585out:
1586 vcpu_put(vcpu);
1572 kfree(fpu); 1587 kfree(fpu);
1573 kfree(kvm_sregs); 1588 kfree(kvm_sregs);
1574 return r; 1589 return r;