On 09.10.23 12:53, Viresh Kumar wrote:
On 09-10-23, 10:40, Alex Bennée wrote:
I thought generally sync points act as full barriers. Doing a bunch of grepping I think ends at:
static __always_inline bool __mutex_unlock_fast(struct mutex *lock) { unsigned long curr = (unsigned long)current;
return atomic_long_try_cmpxchg_release(&lock->owner, &curr, 0UL);
}
so you should already have completed your writes by that point.
I am not sure if depending on such indirect mechanisms to implement barriers for you is a good idea.
The situation here probably requires explicit barriers to make sure it doesn't break in future ?
Depending on lock implementations to include the needed barriers is fine IMO.
That is one central objective locks must ensure: to make sure any updates in a locked region are operating on consistent data and being observable by others after leaving the locked region.
Juergen