patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Xueming(Steven) Li" <xuemingl@nvidia.com>
To: David Marchand <david.marchand@redhat.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Cc: Sunil Pai G <sunil.pai.g@intel.com>,
	Maxime Coquelin <maxime.coquelin@redhat.com>,
	Patrick Fu <patrick.fu@intel.com>, Jiayu Hu <jiayu.hu@intel.com>
Subject: RE: [PATCH 20.11] vhost: fix async access
Date: Mon, 20 Jun 2022 07:01:53 +0000	[thread overview]
Message-ID: <DM4PR12MB537327509451C6682DC8187AA1B09@DM4PR12MB5373.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20220617055227.1292067-1-david.marchand@redhat.com>

Hi David,

Applied, thanks!

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Friday, June 17, 2022 1:52 PM
> To: Xueming(Steven) Li <xuemingl@nvidia.com>; stable@dpdk.org
> Cc: Sunil Pai G <sunil.pai.g@intel.com>; Maxime Coquelin <maxime.coquelin@redhat.com>; Patrick Fu <patrick.fu@intel.com>; Jiayu Hu
> <jiayu.hu@intel.com>
> Subject: [PATCH 20.11] vhost: fix async access
> 
> [ upstream commit 2d47fd3dfb596d266b89d82c2c4b2351c3d6fe20 ]
> 
> vq->async accesses must be protected with vq->access_lock.
> 
> Fixes: eb666d24085f ("vhost: fix async unregister deadlock")
> Fixes: 0c0935c5f794 ("vhost: allow to check in-flight packets for async vhost")
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/librte_vhost/vhost.c | 27 +++++++++++----------------
>  1 file changed, 11 insertions(+), 16 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 1a7c240492..40a2554417 100644
> --- a/lib/librte_vhost/vhost.c
> +++ b/lib/librte_vhost/vhost.c
> @@ -1693,31 +1693,26 @@ int rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)
>  	if (vq == NULL)
>  		return ret;
> 
> -	ret = 0;
> -
> -	if (!vq->async_registered)
> -		return ret;
> -
>  	if (!rte_spinlock_trylock(&vq->access_lock)) {
>  		VHOST_LOG_CONFIG(ERR, "Failed to unregister async channel. "
>  			"virt queue busy.\n");
> -		return -1;
> +		return ret;
>  	}
> 
> -	if (vq->async_pkts_inflight_n) {
> +	if (!vq->async_registered) {
> +		ret = 0;
> +	} else if (vq->async_pkts_inflight_n) {
>  		VHOST_LOG_CONFIG(ERR, "Failed to unregister async channel. "
>  			"async inflight packets must be completed before unregistration.\n");
> -		ret = -1;
> -		goto out;
> -	}
> -
> -	vhost_free_async_mem(vq);
> +	} else {
> +		ret = 0;
> +		vhost_free_async_mem(vq);
> 
> -	vq->async_ops.transfer_data = NULL;
> -	vq->async_ops.check_completed_copies = NULL;
> -	vq->async_registered = false;
> +		vq->async_ops.transfer_data = NULL;
> +		vq->async_ops.check_completed_copies = NULL;
> +		vq->async_registered = false;
> +	}
> 
> -out:
>  	rte_spinlock_unlock(&vq->access_lock);
> 
>  	return ret;
> --
> 2.36.1


      reply	other threads:[~2022-06-20  7:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17  5:52 David Marchand
2022-06-20  7:01 ` Xueming(Steven) Li [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=DM4PR12MB537327509451C6682DC8187AA1B09@DM4PR12MB5373.namprd12.prod.outlook.com \
    --to=xuemingl@nvidia.com \
    --cc=david.marchand@redhat.com \
    --cc=jiayu.hu@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=patrick.fu@intel.com \
    --cc=stable@dpdk.org \
    --cc=sunil.pai.g@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).