Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755492AbcKYQSB (ORCPT ); Fri, 25 Nov 2016 11:18:01 -0500 Received: from foss.arm.com ([217.140.101.70]:50708 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755074AbcKYQRx (ORCPT ); Fri, 25 Nov 2016 11:17:53 -0500 Date: Fri, 25 Nov 2016 16:10:04 +0000 From: Mark Rutland To: Dmitry Vyukov Cc: Boqun Feng , Peter Zijlstra , Christian Borntraeger , "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: <20161125161004.GA30181@leverpostej> References: <1479983114-17190-1-git-send-email-mark.rutland@arm.com> <20161124222357-mutt-send-email-mst@kernel.org> <20161125112203.GA26611@leverpostej> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1018 Lines: 29 On Fri, Nov 25, 2016 at 04:21:39PM +0100, Dmitry Vyukov wrote: > > READ/WRITE_ONCE imply atomicity. Even if their names don't spell it (a > function name doesn't have to spell all of its guarantees). Most of > the uses of READ/WRITE_ONCE will be broken if they are not atomic. In practice, this is certainly the assumption made by many/most users of the *_ONCE() accessors. Looking again, Linus does seem to agree that word-sized accesses should result in single instructions (and be single-copy atomic) [1], so in contrast to [2], that's clearly *part* of the point of the *_ONCE() accessors... > "Read once but not necessary atomically" is a very subtle primitive > which is very easy to misuse. I agree. Unfortunately, Linus does not appear to [2]. > What are use cases for such primitive that won't be OK with "read once > _and_ atomically"? I have none to hand. Thanks, Mark. [1] http://lkml.iu.edu/hypermail/linux/kernel/1503.3/02674.html [2] http://lkml.iu.edu/hypermail/linux/kernel/1503.3/02670.html