[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140207104530.GG5126@laptop.programming.kicks-ass.net>
Date: Fri, 7 Feb 2014 11:45:30 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Torsten Duwe <duwe@....de>
Cc: Scott Wood <scottwood@...escale.com>, linux-kernel@...r.kernel.org,
Paul Mackerras <paulus@...ba.org>,
Anton Blanchard <anton@...ba.org>,
Tom Musta <tommusta@...il.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
linuxppc-dev@...ts.ozlabs.org, Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH] Convert powerpc simple spinlocks into ticket locks
On Fri, Feb 07, 2014 at 11:31:39AM +0100, Peter Zijlstra wrote:
> Anyway, what might work is something like (please forgive my ppc asm, I
> can barely read the thing, I've never before attempted writing it):
>
> lock:
> 1: lharx %0, 0, &head
> mov %1, %0
> addic %0, %0, 1
> stwcd %0, 0, &head
> bne- 1b
> 2: lhax %0, 0, &tail
That might need to be lhz too, I'm confused on all the load variants.
> lwsync
> cmp 0, %0, %0
cmp 0, %0, %1
So we compare the &tail load to the xadd return %1 above.
> bne- 2b
>
>
> unlock:
> lhz %0, 0, &tail
> addic %0, %0, 1
> lwsync
> sth %0, 0, &tail
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists