Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933184AbcKYRmj (ORCPT ); Fri, 25 Nov 2016 12:42:39 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:53829 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933172AbcKYRmc (ORCPT ); Fri, 25 Nov 2016 12:42:32 -0500 Date: Fri, 25 Nov 2016 18:42:23 +0100 From: Peter Zijlstra To: Mark Rutland Cc: Christian Borntraeger , Dmitry Vyukov , Boqun Feng , "Michael S. Tsirkin" , LKML , Davidlohr Bueso , dbueso@suse.de, jasowang@redhat.com, KVM list , netdev , Paul McKenney , virtualization@lists.linux-foundation.org, Linus Torvalds Subject: Re: [PATCH 0/3] virtio/vringh: kill off ACCESS_ONCE() Message-ID: <20161125174223.GS3092@twins.programming.kicks-ass.net> References: <32dfca07-59f3-b75a-3154-cf6b6c8538f0@de.ibm.com> <20161125122356.GB26611@leverpostej> <20161125124044.GN3092@twins.programming.kicks-ass.net> <20161125124404.GI3174@twins.programming.kicks-ass.net> <20161125145512.GA4014@Boquns-MacBook-Pro.local> <20161125161004.GA30181@leverpostej> <20161125161709.GQ3092@twins.programming.kicks-ass.net> <20161125172624.GA30811@leverpostej> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161125172624.GA30811@leverpostej> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 985 Lines: 24 On Fri, Nov 25, 2016 at 05:28:01PM +0000, Mark Rutland wrote: > On Fri, Nov 25, 2016 at 05:49:45PM +0100, Christian Borntraeger wrote: > > On 11/25/2016 05:17 PM, Peter Zijlstra wrote: > > There were several cases that I found during writing the *ONCE stuff. > > For example there are some 32bit ppc variants with 64bit PTEs. Some for > > others (I think sparc). > > We have similar on 32-bit ARM w/ LPAE. LPAE implies that a naturally > aligned 64-bit access is single-copy atomic, which is what makes that > ok. > > > And the mm/ code is perfectly fine with these PTE accesses being done > > NOT atomic. > > That strikes me as surprising. Is there some mutual exclusion that > prevents writes from occuring wherever a READ_ONCE() happens to a PTE? > > Otherwise, how is tearing not a problem? Does it have some pattern like > the lockref cmpxchg? On x86 PAE we play silly games, see arch/x86/mm/gup.c:gup_get_ptr(). Those two loads really should be READ_ONCE()/LOAD_SINGLE().