public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead•org>
To: Michael Ellerman <mpe@ellerman•id.au>
Cc: linuxppc-dev@lists•ozlabs.org,
	Linux Kernel Mailing List <linux-kernel@vger•kernel.org>,
	Benjamin Herrenschmidt <benh@kernel•crashing.org>,
	Paul Mackerras <paulus@samba•org>,
	"Paul E. McKenney" <paulmck@linux•vnet.ibm.com>,
	Will Deacon <will.deacon@arm•com>,
	Boqun Feng <boqun.feng@gmail•com>
Subject: Re: [PATCH v3] powerpc: spinlock: Fix spin_unlock_wait()
Date: Mon, 6 Jun 2016 16:46:59 +0200	[thread overview]
Message-ID: <20160606144659.GG30909@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1465215445.2658.4.camel@ellerman.id.au>

On Mon, Jun 06, 2016 at 10:17:25PM +1000, Michael Ellerman wrote:
> On Mon, 2016-06-06 at 13:56 +0200, Peter Zijlstra wrote:
> > On Mon, Jun 06, 2016 at 09:42:20PM +1000, Michael Ellerman wrote:
> > > +static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
> > > +{
> > > +	arch_spinlock_t lock_val;
> > > +
> > > +	smp_mb();
> > > +
> > > +	/*
> > > +	 * Atomically load and store back the lock value (unchanged). This
> > > +	 * ensures that our observation of the lock value is ordered with
> > > +	 * respect to other lock operations.
> > > +	 */
> > > +	__asm__ __volatile__(
> > > +"1:	" PPC_LWARX(%0, 0, %2, 0) "\n"
> > > +"	stwcx. %0, 0, %2\n"
> > > +"	bne- 1b\n"
> > > +	: "=&r" (lock_val), "+m" (*lock)
> > > +	: "r" (lock)
> > > +	: "cr0", "xer");
> > > +
> > > +	if (arch_spin_value_unlocked(lock_val))
> > > +		goto out;
> > > +
> > > +	while (!arch_spin_value_unlocked(*lock)) {
> > > +		HMT_low();
> > > +		if (SHARED_PROCESSOR)
> > > +			__spin_yield(lock);
> > > +	}
> > > +	HMT_medium();
> > > +
> > > +out:
> > > +	smp_mb();
> > > +}
> > 
> > Why the move to in-line this implementation? It looks like a fairly big
> > function.
> 
> I agree it's not pretty.

> 
> I'm not beholden to v3 though if you hate it.

I don't mind; its just that I am in a similar boat with qspinlock and
chose the other option. So I just figured I'd ask :-)

  reply	other threads:[~2016-06-06 14:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 11:42 [PATCH v3] powerpc: spinlock: Fix spin_unlock_wait() Michael Ellerman
2016-06-06 11:56 ` Peter Zijlstra
2016-06-06 12:17   ` Michael Ellerman
2016-06-06 14:46     ` Peter Zijlstra [this message]
2016-06-08 11:20       ` Michael Ellerman
2016-06-08 12:35         ` Peter Zijlstra
2016-06-08 13:49           ` Michael Ellerman
2016-06-08 13:59             ` Peter Zijlstra
2016-06-09 12:23               ` Michael Ellerman
2016-06-09 17:25                 ` Boqun Feng
2016-06-10  3:06                   ` Boqun Feng
2016-06-09 17:50                 ` Peter Zijlstra
2016-06-10  0:57                   ` Michael Ellerman

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=20160606144659.GG30909@twins.programming.kicks-ass.net \
    --to=peterz@infradead$(echo .)org \
    --cc=benh@kernel$(echo .)crashing.org \
    --cc=boqun.feng@gmail$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=mpe@ellerman$(echo .)id.au \
    --cc=paulmck@linux$(echo .)vnet.ibm.com \
    --cc=paulus@samba$(echo .)org \
    --cc=will.deacon@arm$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox