DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wang, Yinan" <yinan.wang@intel.com>
To: "Hu, Jiayu" <jiayu.hu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "Bie, Tiwei" <tiwei.bie@intel.com>,
	"maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] vhost: fix interrupt suppression for the split ring
Date: Wed, 20 Mar 2019 00:45:55 +0000	[thread overview]
Message-ID: <E0CBA5A1980F1F408E1F28F9991B5B1D50E4E416@SHSMSX104.ccr.corp.intel.com> (raw)
Message-ID: <20190320004555.QFK-R93MTAGNGL9eE6UpLp4o3QiE4nOaNxykhrMjVaM@z> (raw)
In-Reply-To: <1552804712-9973-1-git-send-email-jiayu.hu@intel.com>

Test-by: Wang, Yinan <yinan.wang@intel.com>

Best Wishes,
Yinan

> -----Original Message-----
> From: Hu, Jiayu
> Sent: 2019^[$BG/^[(B3^[$B7n^[(B17^[$BF|^[(B 14:39
> To: dev@dpdk.org
> Cc: Bie, Tiwei <tiwei.bie@intel.com>; maxime.coquelin@redhat.com; Wang,
> Yinan <yinan.wang@intel.com>; Hu, Jiayu <jiayu.hu@intel.com>;
> stable@dpdk.org
> Subject: [PATCH v2] vhost: fix interrupt suppression for the split ring
> 
> The VIRTIO_RING_F_EVENT_IDX feature of split ring might be broken, as the
> value of signalled_used is invalid after live migration, start up and virtio driver
> reload.
> This patch fixes it by using signalled_used_valid.
> 
> In addition, this patch makes the VIRTIO_RING_F_EVENT_IDX implementation
> of split ring match kernel backend to suppress more interrupts.
> 
> Fixes: e37ff954405a ("vhost: support virtqueue interrupt/notification
> suppression")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> ---
> change in v2:
> - fix virtio-net driver reload
> 
>  lib/librte_vhost/vhost.h      | 12 ++++++++----
>  lib/librte_vhost/vhost_user.c |  2 ++
>  2 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index
> f008ec4..e9138df 100644
> --- a/lib/librte_vhost/vhost.h
> +++ b/lib/librte_vhost/vhost.h
> @@ -633,16 +633,20 @@ vhost_vring_call_split(struct virtio_net *dev, struct
> vhost_virtqueue *vq)
>  	if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) {
>  		uint16_t old = vq->signalled_used;
>  		uint16_t new = vq->last_used_idx;
> +		bool signalled_used_valid = vq->signalled_used_valid;
> +
> +		vq->signalled_used = new;
> +		vq->signalled_used_valid = true;
> 
>  		VHOST_LOG_DEBUG(VHOST_DATA, "%s: used_event_idx=%d,
> old=%d, new=%d\n",
>  			__func__,
>  			vhost_used_event(vq),
>  			old, new);
> -		if (vhost_need_event(vhost_used_event(vq), new, old)
> -			&& (vq->callfd >= 0)) {
> -			vq->signalled_used = vq->last_used_idx;
> +
> +		if ((vhost_need_event(vhost_used_event(vq), new, old) &&
> +					(vq->callfd >= 0)) ||
> +				unlikely(!signalled_used_valid))
>  			eventfd_write(vq->callfd, (eventfd_t) 1);
> -		}
>  	} else {
>  		/* Kick the guest if necessary. */
>  		if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT) diff --git
> a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index
> 36c0c67..01a8d80 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -1298,6 +1298,8 @@ vhost_user_get_vring_base(struct virtio_net
> **pdev,
> 
>  	vq->callfd = VIRTIO_UNINITIALIZED_EVENTFD;
> 
> +	vq->signalled_used_valid = false;
> +
>  	if (dev->dequeue_zero_copy)
>  		free_zmbufs(vq);
>  	if (vq_is_packed(dev)) {
> --
> 2.7.4


  parent reply	other threads:[~2019-03-20  0:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22  8:13 [dpdk-dev] [PATCH] " Jiayu Hu
2019-02-25  7:06 ` Tiwei Bie
2019-02-27  5:38   ` Hu, Jiayu
2019-02-27 10:55     ` Tiwei Bie
2019-03-17  6:38 ` [dpdk-dev] [PATCH v2] " Jiayu Hu
2019-03-17  6:38   ` Jiayu Hu
2019-03-20  0:45   ` Wang, Yinan [this message]
2019-03-20  0:45     ` Wang, Yinan
2019-03-20  4:56   ` Tiwei Bie
2019-03-20  4:56     ` Tiwei Bie
2019-03-20  7:36   ` Maxime Coquelin
2019-03-20  7:36     ` Maxime Coquelin

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=E0CBA5A1980F1F408E1F28F9991B5B1D50E4E416@SHSMSX104.ccr.corp.intel.com \
    --to=yinan.wang@intel.com \
    --cc=dev@dpdk.org \
    --cc=jiayu.hu@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=tiwei.bie@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).