patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yongseok Koh <yskoh@mellanox.com>
To: Ilya Maximets <i.maximets@samsung.com>
Cc: dpdk stable <stable@dpdk.org>,
	Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: Re: [dpdk-stable] [PATCH 17.11] net/virtio: add barrier before reading the flags
Date: Wed, 27 Mar 2019 18:30:33 +0000	[thread overview]
Message-ID: <8C42CC9F-1107-4653-9815-5F519BDBDEE7@mellanox.com> (raw)
In-Reply-To: <20190313152718.17888-1-i.maximets@samsung.com>


> On Mar 13, 2019, at 8:27 AM, Ilya Maximets <i.maximets@samsung.com> wrote:
> 
> [ backported from 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")
> Cc: stable@dpdk.org
> 
> Reported-by: Shahaf Shuler <shahafs@mellanox.com>
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
applied to stable/17.11

Thanks,
Yongseok


> 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 788d04dfa..6efd4f01c 100644
> --- a/drivers/net/virtio/virtqueue.h
> +++ b/drivers/net/virtio/virtqueue.h
> @@ -354,6 +354,11 @@ vq_update_avail_ring(struct virtqueue *vq, uint16_t desc_idx)
> 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);
> }
> 
> -- 
> 2.17.1
> 


      reply	other threads:[~2019-03-27 18:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190313152727eucas1p1e43a9a297b7a40581c84b173063f6dc0@eucas1p1.samsung.com>
2019-03-13 15:27 ` Ilya Maximets
2019-03-27 18:30   ` Yongseok Koh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8C42CC9F-1107-4653-9815-5F519BDBDEE7@mellanox.com \
    --to=yskoh@mellanox.com \
    --cc=i.maximets@samsung.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).