Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S940134AbcKXLKU (ORCPT ); Thu, 24 Nov 2016 06:10:20 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34265 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S937225AbcKXLKT (ORCPT ); Thu, 24 Nov 2016 06:10:19 -0500 Subject: Re: [PATCH 2/3] vringh: kill off ACCESS_ONCE() To: Mark Rutland , linux-kernel@vger.kernel.org References: <1479983114-17190-1-git-send-email-mark.rutland@arm.com> <1479983114-17190-3-git-send-email-mark.rutland@arm.com> Cc: dave@stgolabs.net, dbueso@suse.de, dvyukov@google.com, jasowang@redhat.com, kvm@vger.kernel.org, mst@redhat.com, netdev@vger.kernel.org, paulmck@linux.vnet.ibm.com, virtualization@lists.linux-foundation.org From: Christian Borntraeger Date: Thu, 24 Nov 2016 12:10:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1479983114-17190-3-git-send-email-mark.rutland@arm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112411-0024-0000-0000-00000263CBA4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112411-0025-0000-0000-0000215F7180 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-24_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611240197 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1774 Lines: 52 On 11/24/2016 11:25 AM, Mark Rutland wrote: > Despite living under drivers/ vringh.c is also used as part of the userspace > virtio tools. Before we can kill off the ACCESS_ONCE()definition in the tools, > we must convert vringh.c to use {READ,WRITE}_ONCE(). > > This patch does so, along with the required include of for > the relevant definitions. The userspace tools provide their own definitions in > their own . > > Signed-off-by: Mark Rutland > Cc: Jason Wang > Cc: Michael S. Tsirkin > Cc: kvm@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Cc: netdev@vger.kernel.org > Cc: virtualization@lists.linux-foundation.org > --- > drivers/vhost/vringh.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c > index 3bb02c6..bb8971f 100644 > --- a/drivers/vhost/vringh.c > +++ b/drivers/vhost/vringh.c > @@ -3,6 +3,7 @@ > * > * Since these may be in userspace, we use (inline) accessors. > */ > +#include > #include > #include > #include > @@ -820,13 +821,13 @@ EXPORT_SYMBOL(vringh_need_notify_user); > static inline int getu16_kern(const struct vringh *vrh, > u16 *val, const __virtio16 *p) > { > - *val = vringh16_to_cpu(vrh, ACCESS_ONCE(*p)); > + *val = vringh16_to_cpu(vrh, READ_ONCE(*p)); > return 0; > } > > static inline int putu16_kern(const struct vringh *vrh, __virtio16 *p, u16 val) > { > - ACCESS_ONCE(*p) = cpu_to_vringh16(vrh, val); > + WRITE_ONCE(*p, cpu_to_vringh16(vrh, val)); > return 0; > } > Makes sense Reviewed-by: Christian Borntraeger