linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Metcalf <cmetcalf@mellanox.com>
To: Peter Zijlstra <peterz@infradead.org>,
	<linux-kernel@vger.kernel.org>, <torvalds@linux-foundation.org>,
	<manfred@colorfullife.com>, <dave@stgolabs.net>,
	<paulmck@linux.vnet.ibm.com>, <will.deacon@arm.com>
Cc: <boqun.feng@gmail.com>, <Waiman.Long@hpe.com>, <tj@kernel.org>,
	<pablo@netfilter.org>, <kaber@trash.net>, <davem@davemloft.net>,
	<oleg@redhat.com>, <netfilter-devel@vger.kernel.org>,
	<sasha.levin@oracle.com>, <hofrat@osadl.org>, <rth@twiddle.net>,
	<vgupta@synopsys.com>, <linux@armlinux.org.uk>,
	<realmz6@gmail.com>, <rkuo@codeaurora.org>, <tony.luck@intel.com>,
	<james.hogan@imgtec.com>, <ralf@linux-mips.org>,
	<dhowells@redhat.com>, <jejb@parisc-linux.org>,
	<mpe@ellerman.id.au>, <schwidefsky@de.ibm.com>,
	<ysato@users.sourceforge.jp>, <chris@zankel.net>
Subject: Re: [PATCH -v2 4/6] locking, arch: Update spin_unlock_wait()
Date: Thu, 26 May 2016 17:10:36 -0400	[thread overview]
Message-ID: <bff5e0b4-c572-cf4c-82fe-a672b8b5fb14@mellanox.com> (raw)
In-Reply-To: <20160526142354.293350777@infradead.org>

On 5/26/2016 10:19 AM, Peter Zijlstra wrote:
> --- a/arch/tile/lib/spinlock_32.c
> +++ b/arch/tile/lib/spinlock_32.c
> @@ -72,10 +72,14 @@ void arch_spin_unlock_wait(arch_spinlock
>   	if (next == curr)
>   		return;
>   
> +	smp_rmb();
> +
>   	/* Wait until the current locker has released the lock. */
>   	do {
>   		delay_backoff(iterations++);
>   	} while (READ_ONCE(lock->current_ticket) == curr);
> +
> +	smp_acquire__after_ctrl_dep();
>   }
>   EXPORT_SYMBOL(arch_spin_unlock_wait);
>   
> --- a/arch/tile/lib/spinlock_64.c
> +++ b/arch/tile/lib/spinlock_64.c
> @@ -72,10 +72,14 @@ void arch_spin_unlock_wait(arch_spinlock
>   	if (arch_spin_next(val) == curr)
>   		return;
>   
> +	smp_rmb();
> +
>   	/* Wait until the current locker has released the lock. */
>   	do {
>   		delay_backoff(iterations++);
>   	} while (arch_spin_current(READ_ONCE(lock->lock)) == curr);
> +
> +	smp_acquire__after_ctrl_dep();
>   }
>   EXPORT_SYMBOL(arch_spin_unlock_wait);

The smp_rmb() are unnecessary for tile.  We READ_ONCE next/curr from the
lock and compare them, so we know the load(s) are complete.  There's no
microarchitectural speculation going on so that's that.  Then we READ_ONCE
the next load on the lock from within the wait loop, so our load/load
ordering is guaranteed.

With that change,

Acked-by: Chris Metcalf <cmetcalf@mellanox.com> [for tile]

-- 
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com

  reply	other threads:[~2016-05-26 21:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26 14:19 [PATCH -v2 0/6] spin_unlock_wait borkage Peter Zijlstra
2016-05-26 14:19 ` [PATCH -v2 1/6] locking: Replace smp_cond_acquire with smp_cond_load_acquire Peter Zijlstra
2016-05-26 14:19 ` [PATCH -v2 2/6] locking: Introduce cmpwait() Peter Zijlstra
2016-05-26 14:19 ` [PATCH -v2 3/6] locking: Introduce smp_acquire__after_ctrl_dep Peter Zijlstra
2016-05-26 14:19 ` [PATCH -v2 4/6] locking, arch: Update spin_unlock_wait() Peter Zijlstra
2016-05-26 21:10   ` Chris Metcalf [this message]
2016-05-27  9:05     ` Peter Zijlstra
2016-05-27 19:34       ` Chris Metcalf
2016-05-30  9:25         ` Peter Zijlstra
2016-05-27  6:46   ` Martin Schwidefsky
2016-05-27  9:02     ` Peter Zijlstra
2016-05-26 14:19 ` [PATCH -v2 5/6] locking: Update spin_unlock_wait users Peter Zijlstra
2016-05-26 14:19 ` [PATCH -v2 6/6] locking,netfilter: Fix nf_conntrack_lock() Peter Zijlstra

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=bff5e0b4-c572-cf4c-82fe-a672b8b5fb14@mellanox.com \
    --to=cmetcalf@mellanox.com \
    --cc=Waiman.Long@hpe.com \
    --cc=boqun.feng@gmail.com \
    --cc=chris@zankel.net \
    --cc=dave@stgolabs.net \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=hofrat@osadl.org \
    --cc=james.hogan@imgtec.com \
    --cc=jejb@parisc-linux.org \
    --cc=kaber@trash.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=manfred@colorfullife.com \
    --cc=mpe@ellerman.id.au \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=ralf@linux-mips.org \
    --cc=realmz6@gmail.com \
    --cc=rkuo@codeaurora.org \
    --cc=rth@twiddle.net \
    --cc=sasha.levin@oracle.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=tj@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=vgupta@synopsys.com \
    --cc=will.deacon@arm.com \
    --cc=ysato@users.sourceforge.jp \
    /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).