Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752757AbcKYLXc (ORCPT ); Fri, 25 Nov 2016 06:23:32 -0500 Received: from foss.arm.com ([217.140.101.70]:43372 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751041AbcKYLXW (ORCPT ); Fri, 25 Nov 2016 06:23:22 -0500 Date: Fri, 25 Nov 2016 11:22:03 +0000 From: Mark Rutland To: "Michael S. Tsirkin" , Christian Borntraeger Cc: linux-kernel@vger.kernel.org, dave@stgolabs.net, dbueso@suse.de, dvyukov@google.com, jasowang@redhat.com, kvm@vger.kernel.org, netdev@vger.kernel.org, paulmck@linux.vnet.ibm.com, virtualization@lists.linux-foundation.org Subject: Re: [PATCH 0/3] virtio/vringh: kill off ACCESS_ONCE() Message-ID: <20161125112203.GA26611@leverpostej> References: <1479983114-17190-1-git-send-email-mark.rutland@arm.com> <20161124222357-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161124222357-mutt-send-email-mst@kernel.org> 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: 1682 Lines: 41 On Thu, Nov 24, 2016 at 10:36:58PM +0200, Michael S. Tsirkin wrote: > On Thu, Nov 24, 2016 at 10:25:11AM +0000, Mark Rutland wrote: > > For several reasons, it would be beneficial to kill off ACCESS_ONCE() > > tree-wide, in favour of {READ,WRITE}_ONCE(). These work with aggregate types, > > more obviously document their intended behaviour, and are necessary for tools > > like KTSAN to work correctly (as otherwise reads and writes cannot be > > instrumented separately). > > > > While it's possible to script the bulk of this tree-wide conversion, some cases > > such as the virtio code, require some manual intervention. This series moves > > the virtio and vringh code over to {READ,WRITE}_ONCE(), in the process fixing a > > bug in the virtio headers. > > > > Thanks, > > Mark. > > I don't have a problem with this specific patchset. Good to hear. :) Does that mean you're happy to queue these patches? Or would you prefer a new posting at some later point, with ack/review tags accumulated? > Though I really question the whole _ONCE APIs esp with > aggregate types - these seem to generate a memcpy and > an 8-byte read/writes sometimes, and I'm pretty sure this simply > can't be read/written at once on all architectures. Yes, in cases where the access is larger than the machine can perform in a single access, this will result in a memcpy. My understanding is that this has always been the case with ACCESS_ONCE(), where multiple accesses were silently/implicitly generated by the compiler. We could add some compile-time warnings for those cases. I'm not sure if there's a reason we avoided doing that so far; perhaps Christian has a some idea. Thanks, Mark.