Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1703281

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

From "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [RFC][PATCH v3]: documentation,atomic: Add new documents
Date 2017-08-03 19:10 +0200
Message-ID <uarNf-32O-9@gated-at.bofh.it> (permalink)
References (5 earlier) <u9I3M-6bX-15@gated-at.bofh.it> <u9YrU-89Z-11@gated-at.bofh.it> <uaoZ4-12B-7@gated-at.bofh.it> <uapLr-1ol-17@gated-at.bofh.it> <uar0T-2qL-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Aug 03, 2017 at 05:12:24PM +0100, Will Deacon wrote:
> On Thu, Aug 03, 2017 at 07:55:14AM -0700, Paul E. McKenney wrote:
> > On Thu, Aug 03, 2017 at 10:05:16PM +0800, Boqun Feng wrote:
> > > Hi Will,
> > > 
> > > On Wed, Aug 02, 2017 at 10:45:32AM +0100, Will Deacon wrote:
> > > [...]
> > > > 
> > > > It's worth noting that we don't have the problem with any value-returning
> > > > atomics, so all flavours of xchg in this test would be forbidden on arm64
> > > > too.
> > > > 
> > > > > 	C C-WillDeacon-MP+o-r+ai-rmb-o.litmus
> > > > > 
> > > > > 	(*
> > > > > 	 * Expected result: Never.
> > > > > 	 *
> > > > > 	 * Desired litmus test, with atomic_inc() emulated by xchg_relaxed():
> > > > > 	 *
> > > > > 	 *     WRITE_ONCE(x, 1);               atomic_inc(&y);
> > > > > 	 *     r0 = xchg_release(&y, 5);       smp_rmb();
> > > > > 	 *                                     r1 = READ_ONCE(x);
> > > > > 	 *
> > > > > 	 *
> > > > > 	 *     WARN_ON(r0 == 0 && r1 == 0);
> > > > > 	 *)
> > > > > 
> > > > > 	{
> > > > > 	}
> > > > > 
> > > > > 	P0(int *x, int *y)
> > > > > 	{
> > > > > 		WRITE_ONCE(*x, 1);
> > > > > 		r0 = xchg_release(y, 5);
> > > > > 	}
> > > > > 
> > > > > 	P1(int *x, int *y)
> > > > > 	{
> > > > > 		r2 = xchg_relaxed(y, 1);
> > > > > 		smp_rmb();
> > > > > 		r1 = READ_ONCE(*x);
> > > > > 	}
> > > > > 
> > > > > 	exists
> > > > > 	(0:r0=0 /\ 1:r1=0)
> > > > > 
> > > 
> > > How about a litmus test like this?
> > > 
> > >  	C C-AMO-global-transitivity.litmus
> > >  
> > >  	{
> > >  	}
> > >  
> > >  	P0(int *x, int *y)
> > >  	{
> > >  		WRITE_ONCE(*x, 1);
> > >  		r0 = xchg_release(y, 5);
> > >  	}
> > >  
> > >  	P1(int *y, int *z)
> > >  	{
> > >  		atomic_inc(y);
> > >  		smp_mb();
> > 
> > I am going to guess that the smp_mb() enforces the needed ordering,
> > but Will will let me know.  ;-)
> 
> Yup, that would be forbidden on arm64, and would also be forbidden if
> you used WRITE_ONCE instead of atomic_inc (remember that we recently
> became multi-copy atomic).

Thank you for the confirmation!

							Thanx, Paul

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-31 19:50 +0200
  Re: [RFC][PATCH v3]: documentation,atomic: Add new documents Boqun Feng <boqun.feng@gmail.com> - 2017-08-01 04:20 +0200
  Re: [RFC][PATCH v3]: documentation,atomic: Add new documents Peter Zijlstra <peterz@infradead.org> - 2017-08-01 11:10 +0200
    Re: [RFC][PATCH v3]: documentation,atomic: Add new documents Will Deacon <will.deacon@arm.com> - 2017-08-01 12:20 +0200
      Re: [RFC][PATCH v3]: documentation,atomic: Add new documents Peter Zijlstra <peterz@infradead.org> - 2017-08-01 13:50 +0200
        Re: [RFC][PATCH v3]: documentation,atomic: Add new documents Will Deacon <will.deacon@arm.com> - 2017-08-01 14:20 +0200
          Re: [RFC][PATCH v3]: documentation,atomic: Add new documents Peter Zijlstra <peterz@infradead.org> - 2017-08-01 15:00 +0200
          Re: [RFC][PATCH v3]: documentation,atomic: Add new documents "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-08-01 18:20 +0200
            Re: [RFC][PATCH v3]: documentation,atomic: Add new documents Peter Zijlstra <peterz@infradead.org> - 2017-08-01 18:50 +0200
              Re: [RFC][PATCH v3]: documentation,atomic: Add new documents Will Deacon <will.deacon@arm.com> - 2017-08-01 19:00 +0200
              Re: [RFC][PATCH v3]: documentation,atomic: Add new documents "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-08-02 00:20 +0200
                Re: [RFC][PATCH v3]: documentation,atomic: Add new documents Will Deacon <will.deacon@arm.com> - 2017-08-02 10:50 +0200
            Re: [RFC][PATCH v3]: documentation,atomic: Add new documents "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-08-01 20:40 +0200
            Re: [RFC][PATCH v3]: documentation,atomic: Add new documents Will Deacon <will.deacon@arm.com> - 2017-08-02 11:50 +0200
              Re: [RFC][PATCH v3]: documentation,atomic: Add new documents "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-08-02 18:20 +0200
              Re: [RFC][PATCH v3]: documentation,atomic: Add new documents Boqun Feng <boqun.feng@gmail.com> - 2017-08-03 16:10 +0200
                Re: [RFC][PATCH v3]: documentation,atomic: Add new documents "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-08-03 17:00 +0200
                Re: [RFC][PATCH v3]: documentation,atomic: Add new documents Will Deacon <will.deacon@arm.com> - 2017-08-03 18:20 +0200
                Re: [RFC][PATCH v3]: documentation,atomic: Add new documents "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-08-03 19:10 +0200
    Re: [RFC][PATCH v3]: documentation,atomic: Add new documents "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-08-01 15:40 +0200

csiph-web