From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 1AC28A00E6 for ; Tue, 16 Apr 2019 16:38:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EF9571B4EC; Tue, 16 Apr 2019 16:38:30 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 344381B4D0 for ; Tue, 16 Apr 2019 16:38:27 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9422A3092678; Tue, 16 Apr 2019 14:38:26 +0000 (UTC) Received: from rh.redhat.com (ovpn-117-214.ams2.redhat.com [10.36.117.214]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B9371001E93; Tue, 16 Apr 2019 14:38:25 +0000 (UTC) From: Kevin Traynor To: Jiayu Hu Cc: Yinan Wang , Tiwei Bie , dpdk stable Date: Tue, 16 Apr 2019 15:36:49 +0100 Message-Id: <20190416143719.21601-31-ktraynor@redhat.com> In-Reply-To: <20190416143719.21601-1-ktraynor@redhat.com> References: <20190416143719.21601-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 16 Apr 2019 14:38:26 +0000 (UTC) Subject: [dpdk-stable] patch 'vhost: fix interrupt suppression for the split ring' has been queued to LTS release 18.11.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/24/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Kevin Traynor --- >From 771777c9191f025077b60ee93d5d747f7e63d571 Mon Sep 17 00:00:00 2001 From: Jiayu Hu Date: Sun, 17 Mar 2019 14:38:32 +0800 Subject: [PATCH] vhost: fix interrupt suppression for the split ring [ upstream commit 2f706027c8ee1bfcf4895cc35a42f0d2270dc819 ] 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") Signed-off-by: Jiayu Hu Tested-by: Yinan Wang Reviewed-by: Tiwei Bie --- 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 0f9fc9edd..bb9cff9f7 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -687,4 +687,8 @@ vhost_vring_call_split(struct virtio_net *dev, struct vhost_virtqueue *vq) 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", @@ -692,9 +696,9 @@ vhost_vring_call_split(struct virtio_net *dev, struct vhost_virtqueue *vq) 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. */ diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 2d1123e60..7952ef700 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1299,4 +1299,6 @@ 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); -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-04-16 15:34:26.574932928 +0100 +++ 0031-vhost-fix-interrupt-suppression-for-the-split-ring.patch 2019-04-16 15:34:25.177180016 +0100 @@ -1,8 +1,10 @@ -From 2f706027c8ee1bfcf4895cc35a42f0d2270dc819 Mon Sep 17 00:00:00 2001 +From 771777c9191f025077b60ee93d5d747f7e63d571 Mon Sep 17 00:00:00 2001 From: Jiayu Hu Date: Sun, 17 Mar 2019 14:38:32 +0800 Subject: [PATCH] vhost: fix interrupt suppression for the split ring +[ upstream commit 2f706027c8ee1bfcf4895cc35a42f0d2270dc819 ] + 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. @@ -13,7 +15,6 @@ more interrupts. Fixes: e37ff954405a ("vhost: support virtqueue interrupt/notification suppression") -Cc: stable@dpdk.org Signed-off-by: Jiayu Hu Tested-by: Yinan Wang @@ -24,10 +25,10 @@ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h -index f008ec43b..e9138dfab 100644 +index 0f9fc9edd..bb9cff9f7 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h -@@ -634,4 +634,8 @@ vhost_vring_call_split(struct virtio_net *dev, struct vhost_virtqueue *vq) +@@ -687,4 +687,8 @@ vhost_vring_call_split(struct virtio_net *dev, struct vhost_virtqueue *vq) uint16_t old = vq->signalled_used; uint16_t new = vq->last_used_idx; + bool signalled_used_valid = vq->signalled_used_valid; @@ -36,7 +37,7 @@ + vq->signalled_used_valid = true; VHOST_LOG_DEBUG(VHOST_DATA, "%s: used_event_idx=%d, old=%d, new=%d\n", -@@ -639,9 +643,9 @@ vhost_vring_call_split(struct virtio_net *dev, struct vhost_virtqueue *vq) +@@ -692,9 +696,9 @@ vhost_vring_call_split(struct virtio_net *dev, struct vhost_virtqueue *vq) vhost_used_event(vq), old, new); - if (vhost_need_event(vhost_used_event(vq), new, old) @@ -51,7 +52,7 @@ } else { /* Kick the guest if necessary. */ diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c -index 555d09ad9..4f215769f 100644 +index 2d1123e60..7952ef700 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1299,4 +1299,6 @@ vhost_user_get_vring_base(struct virtio_net **pdev,