Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753176AbdLSQFv (ORCPT ); Tue, 19 Dec 2017 11:05:51 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:41644 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752052AbdLSQFp (ORCPT ); Tue, 19 Dec 2017 11:05:45 -0500 Date: Tue, 19 Dec 2017 11:05:44 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: afzal mohammed cc: "Paul E. McKenney" , Peter Zijlstra , , , , , , , , , Subject: Re: Prototype patch for Linux-kernel memory model In-Reply-To: <20171219083650.GA10215@afzalpc> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1155 Lines: 46 On Tue, 19 Dec 2017, afzal mohammed wrote: > Hi, > > A trivial & late (sorry) comment, > > On Wed, Nov 15, 2017 at 08:37:49AM -0800, Paul E. McKenney wrote: > > > +THE HAPPENS-BEFORE RELATION: hb > > +------------------------------- > > > +Less trivial examples of prop all involve fences. Unlike the simple > > +examples above, they can require that some instructions are executed > > +out of program order. This next one should look familiar: > > + > > + int buf = 0, flag = 0; > > + > > + P0() > > + { > > + WRITE_ONCE(buf, 1); > > + smp_wmb(); > > + WRITE_ONCE(flag, 1); > > + } > > + > > + P1() > > + { > > + int r1; > > + int r2; > > + > > + r1 = READ_ONCE(flag); > > + r2 = READ_ONCE(buf); > > + } > > + > > +This is the MP pattern again, with an smp_wmb() fence between the two > > +stores. If r1 = 1 and r2 = 0 at the end then there is a prop link > > +from P1's second load to its first (backwards!). The reason is > > +similar to the previous examples: The value P1 loads from buf gets > > +overwritten by P1's store to buf, > > P0's store to buf > > afzal Thank you; I have applied the change. Alan Stern