[dpdk-stable] patch 'net/virtio: add barrier before reading the flags' has been queued to LTS release 18.11.1

Kevin Traynor ktraynor at redhat.com
Thu Jan 31 17:02:07 CET 2019


On 01/31/2019 03:48 PM, Kevin Traynor wrote:
> Hi,
> 
> FYI, your patch has been queued to LTS release 18.11.1
> 
> Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
> It will be pushed if I get no objections before 02/07/19. So please
> shout if anyone has objections.
> 
> Also note that after the patch there's a diff of the upstream commit vs the
> patch applied to the branch. This will indicate if there was any rebasing
> needed to apply to the stable branch. If there were code changes for rebasing
> (ie: not only metadata diffs), please double check that the rebase was
> correctly done.
> 

Note: packed case is not in 18.11, so just done for non-packed case

> Thanks.
> 
> Kevin Traynor
> 
> ---
> From 60b2f24165822233009a22a81e2bfa2d90650f12 Mon Sep 17 00:00:00 2001
> From: Ilya Maximets <i.maximets at samsung.com>
> Date: Wed, 9 Jan 2019 17:50:13 +0300
> Subject: [PATCH] net/virtio: add barrier before reading the flags
> 
> [ upstream commit d21d05c7a9c1c49ec927f961c4ab797a598af5ca ]
> 
> Reading the used->flags could be reordered with avail->idx update.
> vhost in kernel disables notifications for the time of packets
> receiving, like this:
> 
>     1. disable notify
>     2. process packets
>     3. enable notify
>     4. has more packets ? goto 1
> 
> In case of reordering, virtio driver could read the flags on
> step 2 while notifications disabled and update avail->idx after
> the step 4, i.e. vhost will exit the loop on step 4 with
> notifications enabled, but virtio will not notify.
> 
> Fixes: c1f86306a026 ("virtio: add new driver")
> 
> Reported-by: Shahaf Shuler <shahafs at mellanox.com>
> Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
> Acked-by: Michael S. Tsirkin <mst at redhat.com>
> ---
>  drivers/net/virtio/virtqueue.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
> index 26518ed98..2e2abf15b 100644
> --- a/drivers/net/virtio/virtqueue.h
> +++ b/drivers/net/virtio/virtqueue.h
> @@ -337,4 +337,9 @@ static inline int
>  virtqueue_kick_prepare(struct virtqueue *vq)
>  {
> +	/*
> +	 * Ensure updated avail->idx is visible to vhost before reading
> +	 * the used->flags.
> +	 */
> +	virtio_mb();
>  	return !(vq->vq_ring.used->flags & VRING_USED_F_NO_NOTIFY);
>  }
> 



More information about the stable mailing list