diff options
author | Avi Kivity <avi@redhat.com> | 2010-05-13 11:25:04 +0300 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-08-01 10:35:47 +0300 |
commit | 2122ff5eab8faec853e43f6de886e8dc8f31e317 (patch) | |
tree | e2a31431281f255c6dd38a79ffba4f051fd5b20d /virt | |
parent | 1683b2416e4c514d30ff5844a06733d0444ee000 (diff) | |
download | kernel_samsung_smdk4412-2122ff5eab8faec853e43f6de886e8dc8f31e317.zip kernel_samsung_smdk4412-2122ff5eab8faec853e43f6de886e8dc8f31e317.tar.gz kernel_samsung_smdk4412-2122ff5eab8faec853e43f6de886e8dc8f31e317.tar.bz2 |
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.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 187aa8d..e0fb098 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, if (vcpu->kvm->mm != current->mm) return -EIO; + +#if defined(CONFIG_S390) || defined(CONFIG_PPC) + /* + * Special cases: vcpu ioctls that are asynchronous to vcpu execution, + * so vcpu_load() would break it. + */ + if (ioctl == KVM_S390_INTERRUPT || ioctl == KVM_INTERRUPT) + return kvm_arch_vcpu_ioctl(filp, ioctl, arg); +#endif + + + vcpu_load(vcpu); switch (ioctl) { case KVM_RUN: r = -EINVAL; @@ -1566,9 +1578,12 @@ out_free2: break; } default: + vcpu_put(vcpu); r = kvm_arch_vcpu_ioctl(filp, ioctl, arg); + vcpu_load(vcpu); } out: + vcpu_put(vcpu); kfree(fpu); kfree(kvm_sregs); return r; |