Re: [PATCH 2/5] riscv: Add QUEUED_SPINLOCKS & QUEUED_RWLOCKS supported

2020-11-26 Thread Will Deacon
On Thu, Nov 26, 2020 at 09:36:34AM +0800, Guo Ren wrote: > On Wed, Nov 25, 2020 at 10:31 PM Will Deacon wrote: > > On Wed, Nov 25, 2020 at 03:16:45PM +0100, Peter Zijlstra wrote: > > > @@ -207,6 +187,32 @@ static __always_inline void > > > clear_pending_set_locked(struct qspinlock *lock) > > >

Re: [PATCH 2/5] riscv: Add QUEUED_SPINLOCKS & QUEUED_RWLOCKS supported

2020-11-25 Thread Guo Ren
Hi Will, On Wed, Nov 25, 2020 at 10:31 PM Will Deacon wrote: > > On Wed, Nov 25, 2020 at 03:16:45PM +0100, Peter Zijlstra wrote: > > @@ -207,6 +187,32 @@ static __always_inline void > > clear_pending_set_locked(struct qspinlock *lock) > > atomic_add(-_Q_PENDING_VAL + _Q_LOCKED_VAL, &lock->

Re: [PATCH 2/5] riscv: Add QUEUED_SPINLOCKS & QUEUED_RWLOCKS supported

2020-11-25 Thread Will Deacon
On Wed, Nov 25, 2020 at 03:16:45PM +0100, Peter Zijlstra wrote: > @@ -207,6 +187,32 @@ static __always_inline void > clear_pending_set_locked(struct qspinlock *lock) > atomic_add(-_Q_PENDING_VAL + _Q_LOCKED_VAL, &lock->val); > } > > +#endif /* _Q_PENDING_BITS == 8 */ > + > +#if _Q_PENDING

Re: [PATCH 2/5] riscv: Add QUEUED_SPINLOCKS & QUEUED_RWLOCKS supported

2020-11-25 Thread Peter Zijlstra
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/2019

Re: [PATCH 2/5] riscv: Add QUEUED_SPINLOCKS & QUEUED_RWLOCKS supported

2020-11-25 Thread Peter Zijlstra
On Tue, Nov 24, 2020 at 04:00:14PM +0100, Arnd Bergmann wrote: > On Tue, Nov 24, 2020 at 3:39 PM Peter Zijlstra wrote: > > On Tue, Nov 24, 2020 at 01:43:54PM +, guo...@kernel.org wrote: > > > diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild > > > > + if (

Re: [PATCH 2/5] riscv: Add QUEUED_SPINLOCKS & QUEUED_RWLOCKS supported

2020-11-25 Thread Guo Ren
On Tue, Nov 24, 2020 at 11:00 PM Arnd Bergmann wrote: > > On Tue, Nov 24, 2020 at 3:39 PM Peter Zijlstra wrote: > > On Tue, Nov 24, 2020 at 01:43:54PM +, guo...@kernel.org wrote: > > > diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild > > > > + if (align)

Re: [PATCH 2/5] riscv: Add QUEUED_SPINLOCKS & QUEUED_RWLOCKS supported

2020-11-24 Thread Guo Ren
Thx Peter, On Tue, Nov 24, 2020 at 10:39 PM Peter Zijlstra wrote: > > On Tue, Nov 24, 2020 at 01:43:54PM +, guo...@kernel.org wrote: > > diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild > > index 59dd7be..6f5f438 100644 > > --- a/arch/riscv/include/asm/Kbuild > > +++

Re: [PATCH 2/5] riscv: Add QUEUED_SPINLOCKS & QUEUED_RWLOCKS supported

2020-11-24 Thread Arnd Bergmann
On Tue, Nov 24, 2020 at 3:39 PM Peter Zijlstra wrote: > On Tue, Nov 24, 2020 at 01:43:54PM +, guo...@kernel.org wrote: > > diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild > > + if (align) {\ > > + _

Re: [PATCH 2/5] riscv: Add QUEUED_SPINLOCKS & QUEUED_RWLOCKS supported

2020-11-24 Thread Peter Zijlstra
On Tue, Nov 24, 2020 at 01:43:54PM +, guo...@kernel.org wrote: > diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild > index 59dd7be..6f5f438 100644 > --- a/arch/riscv/include/asm/Kbuild > +++ b/arch/riscv/include/asm/Kbuild > @@ -6,3 +6,6 @@ generic-y += kvm_para.h > ge

[PATCH 2/5] riscv: Add QUEUED_SPINLOCKS & QUEUED_RWLOCKS supported

2020-11-24 Thread guoren
From: Guo Ren riscv only support lr.wd/s(c).w(d) with word(double word) size & align access. There are not lr.h/sc.h instructions. But qspinlock.c need xchg with short type variable: xchg_tail -> xchg_releaxed(&lock->tail, ... typedef struct qspinlock { union { atomic_t