RE: [PATCH v9 14/14] powerpc: rewrite local_t using soft_irq

2017-08-04 Thread David Laight
From: Nicholas Piggin > Sent: 04 August 2017 10:04 > On Fri, 04 Aug 2017 11:40:43 +1000 > Benjamin Herrenschmidt wrote: > > > On Fri, 2017-08-04 at 03:50 +1000, Nicholas Piggin wrote: > > > Hey, so... why are any of these implemented in asm? We should > > > just do them

Re: [PATCH v9 14/14] powerpc: rewrite local_t using soft_irq

2017-08-04 Thread Nicholas Piggin
On Fri, 04 Aug 2017 11:40:43 +1000 Benjamin Herrenschmidt wrote: > On Fri, 2017-08-04 at 03:50 +1000, Nicholas Piggin wrote: > > Hey, so... why are any of these implemented in asm? We should > > just do them all in C, right? I looked a bit harder at code gen > > and a

Re: [PATCH v9 14/14] powerpc: rewrite local_t using soft_irq

2017-08-03 Thread Benjamin Herrenschmidt
On Fri, 2017-08-04 at 03:50 +1000, Nicholas Piggin wrote: > Hey, so... why are any of these implemented in asm? We should > just do them all in C, right? I looked a bit harder at code gen > and a couple of them are still emitting larx/stcx. As long as we can guarantee that the C compiler won't

Re: [PATCH v9 14/14] powerpc: rewrite local_t using soft_irq

2017-08-03 Thread Nicholas Piggin
On Thu, 3 Aug 2017 09:19:18 +0530 Madhavan Srinivasan wrote: > @@ -14,6 +17,202 @@ typedef struct > #define local_read(l)atomic_long_read(&(l)->a) > #define local_set(l,i) atomic_long_set(&(l)->a, (i)) > > +#ifdef CONFIG_PPC64 > + > +static __inline__

[PATCH v9 14/14] powerpc: rewrite local_t using soft_irq

2017-08-02 Thread Madhavan Srinivasan
Local atomic operations are fast and highly reentrant per CPU counters. Used for percpu variable updates. Local atomic operations only guarantee variable modification atomicity wrt the CPU which owns the data and these needs to be executed in a preemption safe way. Here is the design of this