DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: patrick.fu@intel.com, dev@dpdk.org, chenbo.xia@intel.com
Subject: Re: [dpdk-dev] [PATCH v2] vhost: fix missing virtqueue status check in async path
Date: Tue, 21 Jul 2020 10:36:21 +0200	[thread overview]
Message-ID: <9e7cfd50-28f4-6e6b-7537-cbcd64ef4107@redhat.com> (raw)
In-Reply-To: <20200721033557.3372262-1-patrick.fu@intel.com>



On 7/21/20 5:35 AM, patrick.fu@intel.com wrote:
> From: Patrick Fu <patrick.fu@intel.com>
> 
> Vring should not be touched if vq is disabled. This patch adds the vq
> status check in async enqueue polling to avoid accessing to a disabled
> queue.
> 
> Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring")
> 
> Signed-off-by: Patrick Fu <patrick.fu@intel.com>
> ---
> v2:
>  revise commit title
> 
>  lib/librte_vhost/virtio_net.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 1d0be3dd4..b197d76d3 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -1686,9 +1686,11 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,
>  
>  	if (n_pkts_put) {
>  		vq->async_pkts_inflight_n -= n_pkts_put;
> -		__atomic_add_fetch(&vq->used->idx, n_descs, __ATOMIC_RELEASE);
> -
> -		vhost_vring_call_split(dev, vq);
> +		if (likely(vq->enabled && vq->access_ok)) {
> +			__atomic_add_fetch(&vq->used->idx,
> +					n_descs, __ATOMIC_RELEASE);
> +			vhost_vring_call_split(dev, vq);
> +		}
>  	}
>  
>  	if (start_idx + n_pkts_put <= vq_size) {
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


  reply	other threads:[~2020-07-21  8:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16 15:30 [dpdk-dev] [PATCH v1] vhost: add vq status check in async enqueue poll patrick.fu
2020-07-17  8:09 ` Xia, Chenbo
2020-07-17 13:09   ` Ferruh Yigit
2020-07-20 15:57 ` Maxime Coquelin
2020-07-20 16:49   ` Ferruh Yigit
2020-07-21  3:38   ` Fu, Patrick
2020-07-21  3:35 ` [dpdk-dev] [PATCH v2] vhost: fix missing virtqueue status check in async path patrick.fu
2020-07-21  8:36   ` Maxime Coquelin [this message]
2020-07-21 14:53     ` Ferruh Yigit

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=9e7cfd50-28f4-6e6b-7537-cbcd64ef4107@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=patrick.fu@intel.com \
    /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).