Commit 5de72a2247ac05bde7c89039631b3d0c6186fafb

Authored by Christian Borntraeger
1 parent 488beef144

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>

Showing 1 changed file with 6 additions and 12 deletions Side-by-side Diff

arch/s390/kvm/gaccess.c
... ... @@ -229,12 +229,10 @@
229 229 goto out;
230 230 ic = &vcpu->kvm->arch.sca->ipte_control;
231 231 do {
232   - old = *ic;
233   - barrier();
  232 + old = READ_ONCE(*ic);
234 233 while (old.k) {
235 234 cond_resched();
236   - old = *ic;
237   - barrier();
  235 + old = READ_ONCE(*ic);
238 236 }
239 237 new = old;
240 238 new.k = 1;
... ... @@ -253,8 +251,7 @@
253 251 goto out;
254 252 ic = &vcpu->kvm->arch.sca->ipte_control;
255 253 do {
256   - old = *ic;
257   - barrier();
  254 + old = READ_ONCE(*ic);
258 255 new = old;
259 256 new.k = 0;
260 257 } while (cmpxchg(&ic->val, old.val, new.val) != old.val);
261 258  
... ... @@ -269,12 +266,10 @@
269 266  
270 267 ic = &vcpu->kvm->arch.sca->ipte_control;
271 268 do {
272   - old = *ic;
273   - barrier();
  269 + old = READ_ONCE(*ic);
274 270 while (old.kg) {
275 271 cond_resched();
276   - old = *ic;
277   - barrier();
  272 + old = READ_ONCE(*ic);
278 273 }
279 274 new = old;
280 275 new.k = 1;
... ... @@ -288,8 +283,7 @@
288 283  
289 284 ic = &vcpu->kvm->arch.sca->ipte_control;
290 285 do {
291   - old = *ic;
292   - barrier();
  286 + old = READ_ONCE(*ic);
293 287 new = old;
294 288 new.kh--;
295 289 if (!new.kh)