public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Michel Lespinasse <walken@google.com>,
	arc-linux-dev@synopsys.com, lkml <linux-kernel@vger.kernel.org>,
	David Hildenbrand <dahi@linux.vnet.ibm.com>,
	Will Deacon <will.deacon@arm.com>,
	ralf@linux-mips.org
Subject: Re: [PATCH 1/4] ARC: add barriers to futex code
Date: Thu, 6 Aug 2015 15:48:26 +0200	[thread overview]
Message-ID: <20150806134826.GF25159@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1438864523-31340-2-git-send-email-vgupta@synopsys.com>

On Thu, Aug 06, 2015 at 06:05:20PM +0530, Vineet Gupta wrote:
> The atomic ops on futex need to provide the full barrier just like
> regular atomics in kernel.
> 
> Also remove pagefault_enable/disable in futex_atomic_cmpxchg_inatomic()
> as core code already does that

Urgh, and of course tglx just left for holidays :-)

> +++ b/arch/arc/include/asm/futex.h
> @@ -20,6 +20,7 @@
>  
>  #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg)\
>  							\
> +	smp_mb();					\
>  	__asm__ __volatile__(				\
>  	"1:	llock	%1, [%2]		\n"	\
>  		insn				"\n"	\
> @@ -40,12 +41,14 @@
>  							\
>  	: "=&r" (ret), "=&r" (oldval)			\
>  	: "r" (uaddr), "r" (oparg), "ir" (-EFAULT)	\
> -	: "cc", "memory")
> +	: "cc", "memory");				\
> +	smp_mb();					\
>  


So:

 - alhpa: only has the first smp_mb(), suggesting RELEASE
 - arm: only has the first smp_mb(), suggesting RELEASE
 - arm64: has store-release + smp_mb(), suggesting full barriers
 - MIPS: has LLSC_MB after, suggesting ACQUIRE
 - powerpc: lwsync before, sync after, full barrier

x86 is of course boring and fully ordered

Looking at the usage site of futex_atomic_op_inuser(), that's in
futex_wake_op() which might suggest RELEASE is indeed sufficient.

Which leaves me puzzled on MIPS, but what do I know.

At the very least this patch isn't wrong, fully ordered is sufficient.

  parent reply	other threads:[~2015-08-06 13:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-06 12:35 [PATCH 0/4] ARC futex fixes Vineet Gupta
2015-08-06 12:35 ` [PATCH 1/4] ARC: add barriers to futex code Vineet Gupta
2015-08-06 13:15   ` David Hildenbrand
2015-08-06 13:28     ` Vineet Gupta
2015-08-06 13:48   ` Peter Zijlstra [this message]
2015-08-06 14:11     ` Will Deacon
2015-08-07 11:40     ` Peter Zijlstra
2015-08-06 12:35 ` [PATCH 2/4] ARC: futex cosmetics Vineet Gupta
2015-08-06 12:35 ` [PATCH 3/4] ARC: make futex_atomic_cmpxchg_inatomic() return bimodal Vineet Gupta
2015-08-06 12:35 ` [PATCH 4/4] ARC: Enable HAVE_FUTEX_CMPXCHG Vineet Gupta
2015-08-06 13:46 ` [PATCH 5/4] ARC: ensure futex ops are atomic in !LLSC config Vineet Gupta
2015-08-17  7:46 ` [PATCH 0/4] ARC futex fixes Vineet Gupta

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=20150806134826.GF25159@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=arc-linux-dev@synopsys.com \
    --cc=dahi@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=tglx@linutronix.de \
    --cc=walken@google.com \
    --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