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 13:56:55 +0200 [thread overview]
Message-ID: <20160606115655.GD30909@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1465213340.2658.1.camel@ellerman.id.au>
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.
next prev parent reply other threads:[~2016-06-06 11:57 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 [this message]
2016-06-06 12:17 ` Michael Ellerman
2016-06-06 14:46 ` Peter Zijlstra
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=20160606115655.GD30909@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=benh@kernel.crashing.org \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulmck@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=will.deacon@arm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).