On Wed, Nov 25, 2020 at 08:52:23AM +0800, Guo Ren wrote: > > I'm pretty sure there's a handfull of implementations like this out > > there... if only we could share. > Michael has sent qspinlock before, ref to Link below. He reused mips' code. > > Link: https://lore.kernel.org/linux-riscv/20190211043829.30096-1-michaeljclark@xxxxxxx/ > > Which short xchg implementation do you prefer (Mine or his)? Well, it would be very nice to have mips/riscv/csky all use the same header to implement these I suppose. But then we're back to a cmpxchg-loop, in which case Arnd's suggestion isn't worse.