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 2/2] net/vhost: fix queue update
Date: Mon, 27 Jul 2020 13:54:59 +0000	[thread overview]
Message-ID: <MN2PR11MB40638CF0FD5E2FC8184388A69C720@MN2PR11MB4063.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200723130854.322771-3-maxime.coquelin@redhat.com>

Hi Maxime,

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Thursday, July 23, 2020 9:09 PM
> 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 2/2] 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>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  drivers/net/vhost/rte_eth_vhost.c | 25 ++++++-------------------
>  1 file changed, 6 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c
> b/drivers/net/vhost/rte_eth_vhost.c
> index bbf79b2c0e..14b7b59f67 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,14 @@ 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)
> +			return ret;

Do you think it'll be better to add a VHOST_LOG here to show the get_vring failure
like it's done in other place? But since it's the only place that will fail, it's also easy
for user to find out. 😊

Thanks,
Chenbo

> 
> -			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


  reply	other threads:[~2020-07-27 13:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 13:08 [dpdk-dev] [PATCH 0/2] Fix vhost performance regression Maxime Coquelin
2020-07-23 13:08 ` [dpdk-dev] [PATCH 1/2] vhost: fix guest notification setting Maxime Coquelin
2020-07-27 13:46   ` Xia, Chenbo
2020-07-23 13:08 ` [dpdk-dev] [PATCH 2/2] net/vhost: fix queue update Maxime Coquelin
2020-07-27 13:54   ` Xia, Chenbo [this message]
2020-07-24  4:55 ` [dpdk-dev] [PATCH 0/2] Fix vhost performance regression Wang, Yinan
2020-07-24  7:06   ` Maxime Coquelin
2020-07-24  8:54     ` Maxime Coquelin
2020-07-24 15:43       ` Maxime Coquelin
2020-07-27  8:28         ` Matan Azrad
2020-07-24 12:42     ` David Marchand

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=MN2PR11MB40638CF0FD5E2FC8184388A69C720@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).