Skip to content

Commit af2e7aa

Browse files
committed
arm64/spinlock: Replace ACCESS_ONCE 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) Change the spinlock code to replace ACCESS_ONCE with READ_ONCE. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
1 parent 4218091 commit af2e7aa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm64/include/asm/spinlock.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ static inline int arch_spin_value_unlocked(arch_spinlock_t lock)
9999

100100
static inline int arch_spin_is_locked(arch_spinlock_t *lock)
101101
{
102-
return !arch_spin_value_unlocked(ACCESS_ONCE(*lock));
102+
return !arch_spin_value_unlocked(READ_ONCE(*lock));
103103
}
104104

105105
static inline int arch_spin_is_contended(arch_spinlock_t *lock)
106106
{
107-
arch_spinlock_t lockval = ACCESS_ONCE(*lock);
107+
arch_spinlock_t lockval = READ_ONCE(*lock);
108108
return (lockval.next - lockval.owner) > 1;
109109
}
110110
#define arch_spin_is_contended arch_spin_is_contended

0 commit comments

Comments
 (0)