Re: [PATCH 2/3] vringh: kill off ACCESS_ONCE()
On 2016年11月24日 18:25, 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 RutlandCc: Jason Wang Cc: Michael S. Tsirkin Cc: k...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: netdev@vger.kernel.org Cc: virtualizat...@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; } Reviewed-by: Jason Wang
Re: [PATCH 2/3] vringh: kill off ACCESS_ONCE()
On Thu, 24 Nov 2016 10:25:13 + Mark Rutlandwrote: > 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: k...@vger.kernel.org > Cc: linux-ker...@vger.kernel.org > Cc: netdev@vger.kernel.org > Cc: virtualizat...@lists.linux-foundation.org > --- > drivers/vhost/vringh.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) Reviewed-by: Cornelia Huck
Re: [PATCH 2/3] vringh: kill off ACCESS_ONCE()
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: k...@vger.kernel.org > Cc: linux-ker...@vger.kernel.org > Cc: netdev@vger.kernel.org > Cc: virtualizat...@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