DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xia, Chenbo" <chenbo.xia@intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"matan@mellanox.com" <matan@mellanox.com>,
	"Liu, Yong" <yong.liu@intel.com>,
	"Wang, Yinan" <yinan.wang@intel.com>
Cc: "thomas@monjalon.net" <thomas@monjalon.net>,
	"Yigit, Ferruh" <ferruh.yigit@intel.com>,
	"david.marchand@redhat.com" <david.marchand@redhat.com>
Subject: Re: [dpdk-dev] [PATCH v2 2/3] net/vhost: fix queue update
Date: Wed, 29 Jul 2020 02:52:54 +0000	[thread overview]
Message-ID: <MN2PR11MB40639F8586599BE677B778319C700@MN2PR11MB4063.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200728165021.216291-3-maxime.coquelin@redhat.com>


> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Wednesday, July 29, 2020 12:50 AM
> To: dev@dpdk.org; matan@mellanox.com; Xia, Chenbo
> <chenbo.xia@intel.com>; Liu, Yong <yong.liu@intel.com>; Wang, Yinan
> <yinan.wang@intel.com>
> Cc: thomas@monjalon.net; Yigit, Ferruh <ferruh.yigit@intel.com>;
> david.marchand@redhat.com; Maxime Coquelin
> <maxime.coquelin@redhat.com>
> Subject: [PATCH v2 2/3] net/vhost: fix queue update
> 
> Now that the vhost library saves the guest notifications enablement value in its
> virtqueues metadata, it is not necessary to do it in the vring_state_changed
> callback.
> 
> One effect of the patch is also to prevent possible deadlock happening in vhost
> library.
> 
> Fixes: 604052ae5395 ("net/vhost: support queue update")
> 
> Reported-by: Yinan Wang <yinan.wang@intel.com>
> Tested-by: Yinan Wang <yinan.wang@intel.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  drivers/net/vhost/rte_eth_vhost.c | 28 +++++++++-------------------
>  1 file changed, 9 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c
> b/drivers/net/vhost/rte_eth_vhost.c
> index bbf79b2c0e..951929c663 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -94,7 +94,6 @@ struct vhost_queue {
>  	struct rte_mempool *mb_pool;
>  	uint16_t port;
>  	uint16_t virtqueue_id;
> -	bool intr_en;
>  	struct vhost_stats stats;
>  };
> 
> @@ -547,8 +546,6 @@ eth_rxq_intr_enable(struct rte_eth_dev *dev, uint16_t
> qid)
>  	rte_vhost_enable_guest_notification(vq->vid, (qid << 1) + 1, 1);
>  	rte_wmb();
> 
> -	vq->intr_en = true;
> -
>  	return ret;
>  }
> 
> @@ -574,8 +571,6 @@ eth_rxq_intr_disable(struct rte_eth_dev *dev, uint16_t
> qid)
>  	rte_vhost_enable_guest_notification(vq->vid, (qid << 1) + 1, 0);
>  	rte_wmb();
> 
> -	vq->intr_en = false;
> -
>  	return 0;
>  }
> 
> @@ -841,7 +836,6 @@ vring_conf_update(int vid, struct rte_eth_dev *eth_dev,
> uint16_t vring_id)
>  	struct rte_eth_conf *dev_conf = &eth_dev->data->dev_conf;
>  	struct pmd_internal *internal = eth_dev->data->dev_private;
>  	struct rte_vhost_vring vring;
> -	struct vhost_queue *vq;
>  	int rx_idx = vring_id % 2 ? (vring_id - 1) >> 1 : -1;
>  	int ret = 0;
> 
> @@ -853,21 +847,17 @@ vring_conf_update(int vid, struct rte_eth_dev
> *eth_dev, uint16_t vring_id)
>  	    rte_atomic32_read(&internal->dev_attached) &&
>  	    rte_atomic32_read(&internal->started) &&
>  	    dev_conf->intr_conf.rxq) {
> -		vq = eth_dev->data->rx_queues[rx_idx];
>  		ret = rte_vhost_get_vhost_vring(vid, vring_id, &vring);
> -		if (!ret) {
> -			if (vring.kickfd !=
> -			    eth_dev->intr_handle->efds[rx_idx]) {
> -				VHOST_LOG(INFO,
> -					  "kickfd for rxq-%d was changed.\n",
> -					  rx_idx);
> -				eth_dev->intr_handle->efds[rx_idx] =
> -								   vring.kickfd;
> -			}
> +		if (ret) {
> +			VHOST_LOG(ERR, "Failed to get vring %d
> information.\n",
> +					vring_id);
> +			return ret;
> +		}
> 
> -			rte_vhost_enable_guest_notification(vid, vring_id,
> -							    vq->intr_en);
> -			rte_wmb();
> +		if (vring.kickfd != eth_dev->intr_handle->efds[rx_idx]) {
> +			VHOST_LOG(INFO, "kickfd for rxq-%d was changed.\n",
> +					  rx_idx);
> +			eth_dev->intr_handle->efds[rx_idx] = vring.kickfd;
>  		}
>  	}
> 
> --
> 2.26.2

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>

  reply	other threads:[~2020-07-29  2:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-28 16:50 [dpdk-dev] [PATCH v2 0/3] Fix Vhost regressions Maxime Coquelin
2020-07-28 16:50 ` [dpdk-dev] [PATCH v2 1/3] vhost: fix guest notification setting Maxime Coquelin
2020-07-28 16:50 ` [dpdk-dev] [PATCH v2 2/3] net/vhost: fix queue update Maxime Coquelin
2020-07-29  2:52   ` Xia, Chenbo [this message]
2020-07-29  6:09     ` Wang, Yinan
2020-07-28 16:50 ` [dpdk-dev] [PATCH v2 3/3] net/vhost: fix interrupt mode Maxime Coquelin
2020-07-28 19:03   ` Matan Azrad
2020-07-29  7:52     ` Maxime Coquelin
2020-07-29  8:43       ` Matan Azrad
2020-07-29  9:10         ` Maxime Coquelin
2020-07-29  6:08 ` [dpdk-dev] [PATCH v2 0/3] Fix Vhost regressions Wang, Yinan

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=MN2PR11MB40639F8586599BE677B778319C700@MN2PR11MB4063.namprd11.prod.outlook.com \
    --to=chenbo.xia@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=matan@mellanox.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=thomas@monjalon.net \
    --cc=yinan.wang@intel.com \
    --cc=yong.liu@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).