diff options
author | Christian Borntraeger <borntraeger@de.ibm.com> | 2014-11-25 07:17:34 -0500 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2014-12-18 03:54:41 -0500 |
commit | 5de72a2247ac05bde7c89039631b3d0c6186fafb (patch) | |
tree | 8ba7addcad7793f8e5ce0034c7f0a41a9039e222 /arch | |
parent | 488beef1440e845751365202faace2465840ea98 (diff) |
s390/kvm: REPLACE barrier fixup with READ_ONCE
ACCESS_ONCE does not work reliably on non-scalar types. For
example gcc 4.6 and 4.7 might remove the volatile tag for such
accesses during the SRA (scalar replacement of aggregates) step
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145)
Commit 1365039d0cb3 ("KVM: s390: Fix ipte locking") replace
ACCESS_ONCE with barriers. Lets use READ_ONCE instead.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/s390/kvm/gaccess.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/arch/s390/kvm/gaccess.c b/arch/s390/kvm/gaccess.c index 6dc0ad9c7050..8f195fa904a1 100644 --- a/arch/s390/kvm/gaccess.c +++ b/arch/s390/kvm/gaccess.c | |||
@@ -229,12 +229,10 @@ 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 = *ic; | 232 | old = READ_ONCE(*ic); |
233 | barrier(); | ||
234 | while (old.k) { | 233 | while (old.k) { |
235 | cond_resched(); | 234 | cond_resched(); |
236 | old = *ic; | 235 | old = READ_ONCE(*ic); |
237 | barrier(); | ||
238 | } | 236 | } |
239 | new = old; | 237 | new = old; |
240 | new.k = 1; | 238 | new.k = 1; |
@@ -253,8 +251,7 @@ static void ipte_unlock_simple(struct kvm_vcpu *vcpu) | |||
253 | goto out; | 251 | goto out; |
254 | ic = &vcpu->kvm->arch.sca->ipte_control; | 252 | ic = &vcpu->kvm->arch.sca->ipte_control; |
255 | do { | 253 | do { |
256 | old = *ic; | 254 | old = READ_ONCE(*ic); |
257 | barrier(); | ||
258 | new = old; | 255 | new = old; |
259 | new.k = 0; | 256 | new.k = 0; |
260 | } while (cmpxchg(&ic->val, old.val, new.val) != old.val); | 257 | } while (cmpxchg(&ic->val, old.val, new.val) != old.val); |
@@ -269,12 +266,10 @@ static void ipte_lock_siif(struct kvm_vcpu *vcpu) | |||
269 | 266 | ||
270 | ic = &vcpu->kvm->arch.sca->ipte_control; | 267 | ic = &vcpu->kvm->arch.sca->ipte_control; |
271 | do { | 268 | do { |
272 | old = *ic; | 269 | old = READ_ONCE(*ic); |
273 | barrier(); | ||
274 | while (old.kg) { | 270 | while (old.kg) { |
275 | cond_resched(); | 271 | cond_resched(); |
276 | old = *ic; | 272 | old = READ_ONCE(*ic); |
277 | barrier(); | ||
278 | } | 273 | } |
279 | new = old; | 274 | new = old; |
280 | new.k = 1; | 275 | new.k = 1; |
@@ -288,8 +283,7 @@ static void ipte_unlock_siif(struct kvm_vcpu *vcpu) | |||
288 | 283 | ||
289 | ic = &vcpu->kvm->arch.sca->ipte_control; | 284 | ic = &vcpu->kvm->arch.sca->ipte_control; |
290 | do { | 285 | do { |
291 | old = *ic; | 286 | old = READ_ONCE(*ic); |
292 | barrier(); | ||
293 | new = old; | 287 | new = old; |
294 | new.kh--; | 288 | new.kh--; |
295 | if (!new.kh) | 289 | if (!new.kh) |