]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: s390: no need to hold the kvm->mutex for floating interrupts
authorChristian Borntraeger <borntraeger@de.ibm.com>
Wed, 17 Dec 2014 09:36:04 +0000 (10:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 May 2015 20:01:42 +0000 (22:01 +0200)
commit 69a8d456263849152826542c7cb0a164b90e68a8 upstream.

The kvm mutex was (probably) used to protect against cpu hotplug.
The current code no longer needs to protect against that, as we only
rely on CPU data structures that are guaranteed to be available
if we can access the CPU. (e.g. vcpu_create will put the cpu
in the array AFTER the cpu is ready).

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/s390/kvm/interrupt.c

index 154a7b6c486a1d7c68f5bbd5921dbfb92f059ad5..18bfbec2231eba5802067f67fa897781894f241c 100644 (file)
@@ -1131,7 +1131,6 @@ struct kvm_s390_interrupt_info *kvm_s390_get_io_int(struct kvm *kvm,
 
        if ((!schid && !cr6) || (schid && cr6))
                return NULL;
-       mutex_lock(&kvm->lock);
        fi = &kvm->arch.float_int;
        spin_lock(&fi->lock);
        inti = NULL;
@@ -1159,7 +1158,6 @@ struct kvm_s390_interrupt_info *kvm_s390_get_io_int(struct kvm *kvm,
        if (list_empty(&fi->list))
                atomic_set(&fi->active, 0);
        spin_unlock(&fi->lock);
-       mutex_unlock(&kvm->lock);
        return inti;
 }
 
@@ -1172,7 +1170,6 @@ static int __inject_vm(struct kvm *kvm, struct kvm_s390_interrupt_info *inti)
        int sigcpu;
        int rc = 0;
 
-       mutex_lock(&kvm->lock);
        fi = &kvm->arch.float_int;
        spin_lock(&fi->lock);
        if (fi->irq_count >= KVM_S390_MAX_FLOAT_IRQS) {
@@ -1225,7 +1222,6 @@ static int __inject_vm(struct kvm *kvm, struct kvm_s390_interrupt_info *inti)
        kvm_s390_vcpu_wakeup(kvm_get_vcpu(kvm, sigcpu));
 unlock_fi:
        spin_unlock(&fi->lock);
-       mutex_unlock(&kvm->lock);
        return rc;
 }
 
@@ -1379,7 +1375,6 @@ void kvm_s390_clear_float_irqs(struct kvm *kvm)
        struct kvm_s390_float_interrupt *fi;
        struct kvm_s390_interrupt_info  *n, *inti = NULL;
 
-       mutex_lock(&kvm->lock);
        fi = &kvm->arch.float_int;
        spin_lock(&fi->lock);
        list_for_each_entry_safe(inti, n, &fi->list, list) {
@@ -1389,7 +1384,6 @@ void kvm_s390_clear_float_irqs(struct kvm *kvm)
        fi->irq_count = 0;
        atomic_set(&fi->active, 0);
        spin_unlock(&fi->lock);
-       mutex_unlock(&kvm->lock);
 }
 
 static inline int copy_irq_to_user(struct kvm_s390_interrupt_info *inti,
@@ -1429,7 +1423,6 @@ static int get_all_floating_irqs(struct kvm *kvm, __u8 *buf, __u64 len)
        int ret = 0;
        int n = 0;
 
-       mutex_lock(&kvm->lock);
        fi = &kvm->arch.float_int;
        spin_lock(&fi->lock);
 
@@ -1448,7 +1441,6 @@ static int get_all_floating_irqs(struct kvm *kvm, __u8 *buf, __u64 len)
        }
 
        spin_unlock(&fi->lock);
-       mutex_unlock(&kvm->lock);
 
        return ret < 0 ? ret : n;
 }