From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Herrenschmidt Subject: Re: RFC on writel and writel_relaxed Date: Tue, 27 Mar 2018 19:56:59 +1100 Message-ID: <1522141019.7364.43.camel@kernel.crashing.org> References: <1521854626.16434.359.camel@kernel.crashing.org> <58ce5b83f40f4775bec1be8db66adb0d@AcuMS.aculab.com> <20180326165425.GA15554@ziepe.ca> <20180326202545.GB15554@ziepe.ca> <20180326210951.GD15554@ziepe.ca> <1522101717.7364.14.camel@kernel.crashing.org> <20180326222756.GJ15554@ziepe.ca> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane.org@lists.ozlabs.org Sender: "Linuxppc-dev" To: Arnd Bergmann , Jason Gunthorpe Cc: "Paul E. McKenney" , "linux-rdma@vger.kernel.org" , Will Deacon , Sinan Kaya , David Laight , Oliver , Alexander Duyck , "open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)" List-Id: linux-rdma@vger.kernel.org On Tue, 2018-03-27 at 09:56 +0200, Arnd Bergmann wrote: > On Tue, Mar 27, 2018 at 12:27 AM, Jason Gunthorpe wrote: > > On Tue, Mar 27, 2018 at 09:01:57AM +1100, Benjamin Herrenschmidt wrote: > > > On Mon, 2018-03-26 at 17:46 -0400, Sinan Kaya wrote: > > > > I even see patches adding wmb() based on actual observed memory > > corruption during testing on Intel: > > > > https://patchwork.kernel.org/patch/10177207/ > > > > So you think all of this is unnecessary and writel is totally strongly > > ordered, even on multi-socket Intel? > > This example adds a wmb() between two writes to a coherent DMA > area, it is definitely required there. Ah you are right, I incorrectly assumed that the "prod_db" function was an MMIO. So we do NOT have a counter example where wmb is needed on x86, pfiew ! :-) > I'm pretty sure I've never seen > any bug reports pointing to a missing wmb() between memory > and MMIO write accesses, but if you remember seeing them in the > list, maybe you can look again for some evidence of something going > wrong on x86 without it? The interesting thing is that we do seem to have a whole LOT of these spurrious wmb before writel all over the tree, I suspect because of that incorrect recommendation in memory-barriers.txt. We should fix that. Cheers, Ben.