Re: [RFC][PATCH] atomic: Fix atomic_set_release() for 'funny' architectures

From: Chris Metcalf
Date: Fri Jun 09 2017 - 10:03:59 EST


On 6/9/2017 7:05 AM, Peter Zijlstra wrote:
Subject: atomic: Fix atomic_set_release() for 'funny' architectures

Those architectures that have a special atomic_set implementation also
need a special atomic_set_release(), because for the very same reason
WRITE_ONCE() is broken for them, smp_store_release() is too.

The vast majority is architectures that have spinlock hash based atomic
implementation except hexagon which seems to have a hardware 'feature'.

The spinlock based atomics should be SC, that is, none of them appear to
place extra barriers in atomic_cmpxchg() or any of the other SC atomic
primitives and therefore seem to rely on their spinlock implementation
being SC (I did not fully validate all that).

Therefore, the normal atomic_set() is SC and can be used at
atomic_set_release().

Acked-by: Chris Metcalf <cmetcalf@xxxxxxxxxxxx> [for tile]

--
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com