aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kvm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kvm')
-rw-r--r--arch/s390/kvm/gaccess.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/arch/s390/kvm/gaccess.c b/arch/s390/kvm/gaccess.c
index 0f961a1c64b3..6dc0ad9c7050 100644
--- a/arch/s390/kvm/gaccess.c
+++ b/arch/s390/kvm/gaccess.c
@@ -229,10 +229,12 @@ static void ipte_lock_simple(struct kvm_vcpu *vcpu)
229 goto out; 229 goto out;
230 ic = &vcpu->kvm->arch.sca->ipte_control; 230 ic = &vcpu->kvm->arch.sca->ipte_control;
231 do { 231 do {
232 old = ACCESS_ONCE(*ic); 232 old = *ic;
233 barrier();
233 while (old.k) { 234 while (old.k) {
234 cond_resched(); 235 cond_resched();
235 old = ACCESS_ONCE(*ic); 236 old = *ic;
237 barrier();
236 } 238 }
237 new = old; 239 new = old;
238 new.k = 1; 240 new.k = 1;
@@ -251,7 +253,9 @@ static void ipte_unlock_simple(struct kvm_vcpu *vcpu)
251 goto out; 253 goto out;
252 ic = &vcpu->kvm->arch.sca->ipte_control; 254 ic = &vcpu->kvm->arch.sca->ipte_control;
253 do { 255 do {
254 new = old = ACCESS_ONCE(*ic); 256 old = *ic;
257 barrier();
258 new = old;
255 new.k = 0; 259 new.k = 0;
256 } while (cmpxchg(&ic->val, old.val, new.val) != old.val); 260 } while (cmpxchg(&ic->val, old.val, new.val) != old.val);
257 wake_up(&vcpu->kvm->arch.ipte_wq); 261 wake_up(&vcpu->kvm->arch.ipte_wq);
@@ -265,10 +269,12 @@ static void ipte_lock_siif(struct kvm_vcpu *vcpu)
265 269
266 ic = &vcpu->kvm->arch.sca->ipte_control; 270 ic = &vcpu->kvm->arch.sca->ipte_control;
267 do { 271 do {
268 old = ACCESS_ONCE(*ic); 272 old = *ic;
273 barrier();
269 while (old.kg) { 274 while (old.kg) {
270 cond_resched(); 275 cond_resched();
271 old = ACCESS_ONCE(*ic); 276 old = *ic;
277 barrier();
272 } 278 }
273 new = old; 279 new = old;
274 new.k = 1; 280 new.k = 1;
@@ -282,7 +288,9 @@ static void ipte_unlock_siif(struct kvm_vcpu *vcpu)
282 288
283 ic = &vcpu->kvm->arch.sca->ipte_control; 289 ic = &vcpu->kvm->arch.sca->ipte_control;
284 do { 290 do {
285 new = old = ACCESS_ONCE(*ic); 291 old = *ic;
292 barrier();
293 new = old;
286 new.kh--; 294 new.kh--;
287 if (!new.kh) 295 if (!new.kh)
288 new.k = 0; 296 new.k = 0;