]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.19.7/kvm-s390-no-need-to-hold-the-kvm-mutex-for-floating-interrupts.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.19.7 / kvm-s390-no-need-to-hold-the-kvm-mutex-for-floating-interrupts.patch
CommitLineData
c9c77b0b
GKH
1From 69a8d456263849152826542c7cb0a164b90e68a8 Mon Sep 17 00:00:00 2001
2From: Christian Borntraeger <borntraeger@de.ibm.com>
3Date: Wed, 17 Dec 2014 10:36:04 +0100
4Subject: KVM: s390: no need to hold the kvm->mutex for floating interrupts
5
6From: Christian Borntraeger <borntraeger@de.ibm.com>
7
8commit 69a8d456263849152826542c7cb0a164b90e68a8 upstream.
9
10The kvm mutex was (probably) used to protect against cpu hotplug.
11The current code no longer needs to protect against that, as we only
12rely on CPU data structures that are guaranteed to be available
13if we can access the CPU. (e.g. vcpu_create will put the cpu
14in the array AFTER the cpu is ready).
15
16Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
17Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
18Reviewed-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
19Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21---
22 arch/s390/kvm/interrupt.c | 8 --------
23 1 file changed, 8 deletions(-)
24
25--- a/arch/s390/kvm/interrupt.c
26+++ b/arch/s390/kvm/interrupt.c
27@@ -1131,7 +1131,6 @@ struct kvm_s390_interrupt_info *kvm_s390
28
29 if ((!schid && !cr6) || (schid && cr6))
30 return NULL;
31- mutex_lock(&kvm->lock);
32 fi = &kvm->arch.float_int;
33 spin_lock(&fi->lock);
34 inti = NULL;
35@@ -1159,7 +1158,6 @@ struct kvm_s390_interrupt_info *kvm_s390
36 if (list_empty(&fi->list))
37 atomic_set(&fi->active, 0);
38 spin_unlock(&fi->lock);
39- mutex_unlock(&kvm->lock);
40 return inti;
41 }
42
43@@ -1172,7 +1170,6 @@ static int __inject_vm(struct kvm *kvm,
44 int sigcpu;
45 int rc = 0;
46
47- mutex_lock(&kvm->lock);
48 fi = &kvm->arch.float_int;
49 spin_lock(&fi->lock);
50 if (fi->irq_count >= KVM_S390_MAX_FLOAT_IRQS) {
51@@ -1225,7 +1222,6 @@ static int __inject_vm(struct kvm *kvm,
52 kvm_s390_vcpu_wakeup(kvm_get_vcpu(kvm, sigcpu));
53 unlock_fi:
54 spin_unlock(&fi->lock);
55- mutex_unlock(&kvm->lock);
56 return rc;
57 }
58
59@@ -1379,7 +1375,6 @@ void kvm_s390_clear_float_irqs(struct kv
60 struct kvm_s390_float_interrupt *fi;
61 struct kvm_s390_interrupt_info *n, *inti = NULL;
62
63- mutex_lock(&kvm->lock);
64 fi = &kvm->arch.float_int;
65 spin_lock(&fi->lock);
66 list_for_each_entry_safe(inti, n, &fi->list, list) {
67@@ -1389,7 +1384,6 @@ void kvm_s390_clear_float_irqs(struct kv
68 fi->irq_count = 0;
69 atomic_set(&fi->active, 0);
70 spin_unlock(&fi->lock);
71- mutex_unlock(&kvm->lock);
72 }
73
74 static inline int copy_irq_to_user(struct kvm_s390_interrupt_info *inti,
75@@ -1429,7 +1423,6 @@ static int get_all_floating_irqs(struct
76 int ret = 0;
77 int n = 0;
78
79- mutex_lock(&kvm->lock);
80 fi = &kvm->arch.float_int;
81 spin_lock(&fi->lock);
82
83@@ -1448,7 +1441,6 @@ static int get_all_floating_irqs(struct
84 }
85
86 spin_unlock(&fi->lock);
87- mutex_unlock(&kvm->lock);
88
89 return ret < 0 ? ret : n;
90 }