public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: James Hogan <james.hogan@imgtec.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Oleg Nesterov <oleg@redhat.com>,
	Dmitry Vyukov <dvyukov@google.com>, <ebiederm@xmission.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	Paul McKenney <paulmck@linux.vnet.ibm.com>, <mhocko@suse.cz>,
	LKML <linux-kernel@vger.kernel.org>, <ktsan@googlegroups.com>,
	Kostya Serebryany <kcc@google.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	"Alexander Potapenko" <glider@google.com>,
	Hans Boehm <hboehm@google.com>
Subject: Re: [PATCH] kernel: fix data race in put_pid
Date: Fri, 18 Sep 2015 13:31:27 +0100	[thread overview]
Message-ID: <20150918123127.GC26975@jhogan-linux.le.imgtec.org> (raw)
In-Reply-To: <20150918092732.GD11639@twins.programming.kicks-ass.net>

[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]

Hi Peter,

On Fri, Sep 18, 2015 at 11:27:32AM +0200, Peter Zijlstra wrote:
> On Fri, Sep 18, 2015 at 10:57:32AM +0200, Peter Zijlstra wrote:
> > diff --git a/arch/metag/include/asm/atomic_lnkget.h b/arch/metag/include/asm/atomic_lnkget.h
> > index 21c4c268b86c..1bd21c933435 100644
> > --- a/arch/metag/include/asm/atomic_lnkget.h
> > +++ b/arch/metag/include/asm/atomic_lnkget.h
> > @@ -3,7 +3,8 @@
> >  
> >  #define ATOMIC_INIT(i)	{ (i) }
> >  
> > -#define atomic_set(v, i)		((v)->counter = (i))
> > +/* XXX: should be LNKSETD ? */
> > +#define atomic_set(v, i)		WRITE_ONCE((v)->counter, (i))
> >  
> >  #include <linux/compiler.h>
> >  
> 
> James?

It should be fine without a LNKSET. The only reason LNKGET is required
for atomic_read() is that on certain cores the LNKGET/LNKSET
instructions went around the cache, but those cores also have write
through caches, so it shouldn't result in incoherence.

I've just double checked, and the pipeline seems to handle the linked
read after write correctly, so e.g. after:

0220002c    MOV       D0FrT,#0x5
b6208042    SETD      [D1Ar3],D0FrT
ad1080cc    LNKGETD   D0Ar4,[D1Ar3]

D0Ar4 is correct (0x5).

Cheers
James

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-09-18 12:32 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-17 13:24 [PATCH] kernel: fix data race in put_pid Dmitry Vyukov
2015-09-17 16:08 ` Oleg Nesterov
2015-09-17 16:41   ` Dmitry Vyukov
2015-09-17 17:44     ` Oleg Nesterov
2015-09-17 17:57       ` Dmitry Vyukov
2015-09-17 17:59         ` Dmitry Vyukov
2015-09-17 18:09         ` Oleg Nesterov
2015-09-17 18:38           ` Dmitry Vyukov
2015-09-18  8:51           ` Peter Zijlstra
2015-09-18  8:57             ` Peter Zijlstra
2015-09-18  9:27               ` Peter Zijlstra
2015-09-18 12:31                 ` James Hogan [this message]
2015-09-18 12:34                   ` Peter Zijlstra
2015-09-18 15:56               ` Paul E. McKenney
2015-09-18  9:06             ` Dmitry Vyukov
2015-09-18  9:28               ` Will Deacon
2015-09-18  9:33                 ` Peter Zijlstra
2015-09-18 11:22                 ` Peter Zijlstra
2015-09-18 11:30                   ` Will Deacon
2015-09-18 11:50                   ` Dmitry Vyukov
2015-09-18 11:56                     ` Peter Zijlstra
2015-09-18 12:19                       ` Peter Zijlstra
2015-09-18 12:44                         ` Will Deacon
2015-09-18 13:10                           ` Peter Zijlstra
2015-09-18 13:44                       ` Oleg Nesterov
2015-09-18 13:49                         ` Peter Zijlstra
2015-09-18 13:53                         ` Dmitry Vyukov
2015-09-18 14:41                           ` Oleg Nesterov
2015-09-22  8:38                       ` Dmitry Vyukov
2015-09-23  8:48                       ` [tip:locking/core] atomic: Implement atomic_read_ctrl() tip-bot for Peter Zijlstra
2015-09-18 16:15                   ` [PATCH] kernel: fix data race in put_pid Eric Dumazet
2015-09-18 16:20                     ` Peter Zijlstra
2015-09-18 15:57                 ` Paul E. McKenney
2015-09-18 13:28             ` Oleg Nesterov
2015-09-18 13:31               ` Oleg Nesterov
2015-09-18 13:46               ` Peter Zijlstra
2015-09-18 15:00                 ` Oleg Nesterov
2015-09-18 15:30                 ` Oleg Nesterov
2015-09-18 16:00                 ` Paul E. McKenney
2015-09-17 17:56     ` Paul E. McKenney

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=20150918123127.GC26975@jhogan-linux.le.imgtec.org \
    --to=james.hogan@imgtec.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@google.com \
    --cc=dvyukov@google.com \
    --cc=ebiederm@xmission.com \
    --cc=glider@google.com \
    --cc=hboehm@google.com \
    --cc=kcc@google.com \
    --cc=ktsan@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.cz \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=viro@zeniv.linux.org.uk \
    /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