diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-20 19:48:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-20 19:48:59 -0500 |
commit | 60815cf2e05057db5b78e398d9734c493560b11e (patch) | |
tree | 23d7f55df13cc5a0c072cc8a6f361f8e7050b825 /arch/s390/kvm | |
parent | bfc7249cc293deac8f2678b7ec3d2407b68c0a33 (diff) | |
parent | 5de72a2247ac05bde7c89039631b3d0c6186fafb (diff) |
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/borntraeger/linux
Pull ACCESS_ONCE cleanup preparation from Christian Borntraeger:
"kernel: Provide READ_ONCE and ASSIGN_ONCE
As discussed on LKML http://marc.info/?i=54611D86.4040306%40de.ibm.com
ACCESS_ONCE might fail with specific compilers for non-scalar
accesses.
Here is a set of patches to tackle that problem.
The first patch introduce READ_ONCE and ASSIGN_ONCE. If the data
structure is larger than the machine word size memcpy is used and a
warning is emitted. The next patches fix up several in-tree users of
ACCESS_ONCE on non-scalar types.
This does not yet contain a patch that forces ACCESS_ONCE to work only
on scalar types. This is targetted for the next merge window as Linux
next already contains new offenders regarding ACCESS_ONCE vs.
non-scalar types"
* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/borntraeger/linux:
s390/kvm: REPLACE barrier fixup with READ_ONCE
arm/spinlock: Replace ACCESS_ONCE with READ_ONCE
arm64/spinlock: Replace ACCESS_ONCE READ_ONCE
mips/gup: Replace ACCESS_ONCE with READ_ONCE
x86/gup: Replace ACCESS_ONCE with READ_ONCE
x86/spinlock: Replace ACCESS_ONCE with READ_ONCE
mm: replace ACCESS_ONCE with READ_ONCE or barriers
kernel: Provide READ_ONCE and ASSIGN_ONCE
Diffstat (limited to 'arch/s390/kvm')
-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 8b9ccf02a2c5..8a1be9017730 100644 --- a/arch/s390/kvm/gaccess.c +++ b/arch/s390/kvm/gaccess.c | |||
@@ -227,12 +227,10 @@ static void ipte_lock_simple(struct kvm_vcpu *vcpu) | |||
227 | goto out; | 227 | goto out; |
228 | ic = &vcpu->kvm->arch.sca->ipte_control; | 228 | ic = &vcpu->kvm->arch.sca->ipte_control; |
229 | do { | 229 | do { |
230 | old = *ic; | 230 | old = READ_ONCE(*ic); |
231 | barrier(); | ||
232 | while (old.k) { | 231 | while (old.k) { |
233 | cond_resched(); | 232 | cond_resched(); |
234 | old = *ic; | 233 | old = READ_ONCE(*ic); |
235 | barrier(); | ||
236 | } | 234 | } |
237 | new = old; | 235 | new = old; |
238 | new.k = 1; | 236 | new.k = 1; |
@@ -251,8 +249,7 @@ static void ipte_unlock_simple(struct kvm_vcpu *vcpu) | |||
251 | goto out; | 249 | goto out; |
252 | ic = &vcpu->kvm->arch.sca->ipte_control; | 250 | ic = &vcpu->kvm->arch.sca->ipte_control; |
253 | do { | 251 | do { |
254 | old = *ic; | 252 | old = READ_ONCE(*ic); |
255 | barrier(); | ||
256 | new = old; | 253 | new = old; |
257 | new.k = 0; | 254 | new.k = 0; |
258 | } while (cmpxchg(&ic->val, old.val, new.val) != old.val); | 255 | } while (cmpxchg(&ic->val, old.val, new.val) != old.val); |
@@ -267,12 +264,10 @@ static void ipte_lock_siif(struct kvm_vcpu *vcpu) | |||
267 | 264 | ||
268 | ic = &vcpu->kvm->arch.sca->ipte_control; | 265 | ic = &vcpu->kvm->arch.sca->ipte_control; |
269 | do { | 266 | do { |
270 | old = *ic; | 267 | old = READ_ONCE(*ic); |
271 | barrier(); | ||
272 | while (old.kg) { | 268 | while (old.kg) { |
273 | cond_resched(); | 269 | cond_resched(); |
274 | old = *ic; | 270 | old = READ_ONCE(*ic); |
275 | barrier(); | ||
276 | } | 271 | } |
277 | new = old; | 272 | new = old; |
278 | new.k = 1; | 273 | new.k = 1; |
@@ -286,8 +281,7 @@ static void ipte_unlock_siif(struct kvm_vcpu *vcpu) | |||
286 | 281 | ||
287 | ic = &vcpu->kvm->arch.sca->ipte_control; | 282 | ic = &vcpu->kvm->arch.sca->ipte_control; |
288 | do { | 283 | do { |
289 | old = *ic; | 284 | old = READ_ONCE(*ic); |
290 | barrier(); | ||
291 | new = old; | 285 | new = old; |
292 | new.kh--; | 286 | new.kh--; |
293 | if (!new.kh) | 287 | if (!new.kh) |