[PATCH v9 14/14] powerpc: rewrite local_t using soft_irq
Nicholas Piggin
npiggin at gmail.com
Fri Aug 4 03:50:05 AEST 2017
On Thu, 3 Aug 2017 09:19:18 +0530
Madhavan Srinivasan <maddy at linux.vnet.ibm.com> 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__ void local_add(long i, local_t *l)
> +{
> + long t;
> + unsigned long flags;
> +
> + powerpc_local_irq_pmu_save(flags);
> + __asm__ __volatile__(
> + PPC_LL" %0,0(%2)\n\
> + add %0,%1,%0\n"
> + PPC_STL" %0,0(%2)\n"
> + : "=&r" (t)
> + : "r" (i), "r" (&(l->a.counter)));
> + powerpc_local_irq_pmu_restore(flags);
> +}
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.
> +
> +#define local_cmpxchg(l, o, n) \
> + (cmpxchg_local(&((l)->a.counter), (o), (n)))
> +#define local_xchg(l, n) (xchg_local(&((l)->a.counter), (n)))
e.g., these.
Thanks,
Nick
More information about the Linuxppc-dev
mailing list