All of lore.kernel.org
 help / color / mirror / Atom feed
From: nicolas.pitre@linaro.org (Nicolas Pitre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: locks: remove opencoded #16 for ticket shift
Date: Thu, 18 Jul 2013 13:53:06 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.03.1307181350440.14924@syhkavp.arg> (raw)
In-Reply-To: <20130718172159.GC9837@mudshark.cambridge.arm.com>

On Thu, 18 Jul 2013, Will Deacon wrote:

> On Wed, Jul 17, 2013 at 02:56:59PM +0100, Nicolas Pitre wrote:
> > On Mon, 15 Jul 2013, Will Deacon wrote:
> > 
> > > The ticket width of our spinlocks is defined by TICKET_SHIFT, so remove
> > > the opencoded #16 from the trylock implementation.
> > > 
> > > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > 
> > This is pointless.
> 
> I disagree (see below).
> 
> > >  		"	ldrex	%0, [%3]\n"
> > >  		"	mov	%2, #0\n"
> > > -		"	subs	%1, %0, %0, ror #16\n"
> > 
> > Any value other than 16 would break that code.  You'd rather ensure it 
> > never gets defined to anything else.
> 
> There are two aspects to the ticket lock:
> 
>   1. The size of each ticket
>   2. The location of the next ticket within the 32-bit lock word
> 
> TICKET_SHIFT actually defines (2) and could be 0 or 16, hence why I was
> making this small cosmetic change.

Doesn't matter where the location of the next ticket is.  Whether it is 
0 or 16, for the above code to work, it *must* always perform a ror #16.  
Hence tying the ror constant with TICKET_SHIFT is wrong.


Nicolas

  reply	other threads:[~2013-07-18 17:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-15 13:27 [PATCH] ARM: locks: remove opencoded #16 for ticket shift Will Deacon
2013-07-16 16:35 ` Dave Martin
2013-07-17 13:56 ` Nicolas Pitre
2013-07-18 17:21   ` Will Deacon
2013-07-18 17:53     ` Nicolas Pitre [this message]
2013-07-19  9:05       ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.03.1307181350440.14924@syhkavp.arg \
    --to=nicolas.pitre@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.