Re: [RFC PATCH] riscv/locking: Strengthen spin_lock() and spin_unlock()
From: Peter Zijlstra
Date: Tue Mar 06 2018 - 08:01:20 EST
On Mon, Feb 26, 2018 at 09:00:43AM -0800, Linus Torvalds wrote:
> On Mon, Feb 26, 2018 at 8:24 AM, Will Deacon <will.deacon@xxxxxxx> wrote:
> >
> > Strictly speaking, that's not what we've got implemented on arm64: only
> > the read part of the RmW has Acquire semantics, but there is a total
> > order on the lock/unlock operations for the lock.
>
> Hmm.
>
> I thought we had exactly that bug on some architecture with the queued
> spinlocks, and people decided it was wrong.
So ARM64 and Power have the acquire-on-load only thing, but qspinlock
has it per construction on anything that allowes reordering stores.
Given that unlock/lock are ordered, which covers about 99% of the users
out there, and fixing the issue would make things significantly slower
on the weak architectures we let it be.
But yes, its a pesky detail.