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 57E76A0096 for ; Wed, 10 Apr 2019 18:45:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4CEBE1B105; Wed, 10 Apr 2019 18:45:16 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 705271B105 for ; Wed, 10 Apr 2019 18:45:14 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C77128830F; Wed, 10 Apr 2019 16:45:13 +0000 (UTC) Received: from rh.redhat.com (ovpn-117-94.ams2.redhat.com [10.36.117.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id 598745D961; Wed, 10 Apr 2019 16:45:05 +0000 (UTC) From: Kevin Traynor To: Tiwei Bie Cc: Maxime Coquelin , dpdk stable Date: Wed, 10 Apr 2019 17:43:41 +0100 Message-Id: <20190410164411.10546-33-ktraynor@redhat.com> In-Reply-To: <20190410164411.10546-1-ktraynor@redhat.com> References: <20190410164411.10546-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 10 Apr 2019 16:45:13 +0000 (UTC) Subject: [dpdk-stable] patch 'vhost: restore mbuf first when freeing zmbuf' 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/16/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 17b72dcd5c6f0ea86bb76a867789e34c218500a0 Mon Sep 17 00:00:00 2001 From: Tiwei Bie Date: Fri, 22 Feb 2019 10:42:06 +0800 Subject: [PATCH] vhost: restore mbuf first when freeing zmbuf [ upstream commit 041d37b2ef25faeb1c00ed70a5fc2ea6e93c4828 ] The mbufs should also be restored in free_zmbufs(). Fixes: b0a985d1f340 ("vhost: add dequeue zero copy") Fixes: 3ebd930588b7 ("vhost: fix mbuf free") Signed-off-by: Tiwei Bie Reviewed-by: Maxime Coquelin --- lib/librte_vhost/vhost.h | 16 ++++++++++++++++ lib/librte_vhost/vhost_user.c | 1 + lib/librte_vhost/virtio_net.c | 16 ---------------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index 552b9298d..d4f34c34a 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -756,3 +756,19 @@ kick: } +static __rte_always_inline void +restore_mbuf(struct rte_mbuf *m) +{ + uint32_t mbuf_size, priv_size; + + while (m) { + priv_size = rte_pktmbuf_priv_size(m->pool); + mbuf_size = sizeof(struct rte_mbuf) + priv_size; + /* start of buffer is after mbuf structure and priv data */ + + m->buf_addr = (char *)m + mbuf_size; + m->buf_iova = rte_mempool_virt2iova(m) + mbuf_size; + m = m->next; + } +} + #endif /* _VHOST_NET_CDEV_H_ */ diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 19e04c953..e078473ec 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1219,4 +1219,5 @@ free_zmbufs(struct vhost_virtqueue *vq) next = TAILQ_NEXT(zmbuf, next); + restore_mbuf(zmbuf->mbuf); rte_pktmbuf_free(zmbuf->mbuf); TAILQ_REMOVE(&vq->zmbuf_list, zmbuf, next); diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 15d682c3c..d8b6bdea5 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -1344,20 +1344,4 @@ mbuf_is_consumed(struct rte_mbuf *m) } -static __rte_always_inline void -restore_mbuf(struct rte_mbuf *m) -{ - uint32_t mbuf_size, priv_size; - - while (m) { - priv_size = rte_pktmbuf_priv_size(m->pool); - mbuf_size = sizeof(struct rte_mbuf) + priv_size; - /* start of buffer is after mbuf structure and priv data */ - - m->buf_addr = (char *)m + mbuf_size; - m->buf_iova = rte_mempool_virt2iova(m) + mbuf_size; - m = m->next; - } -} - static __rte_always_inline uint16_t virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq, -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-04-10 14:06:10.447418507 +0100 +++ 0033-vhost-restore-mbuf-first-when-freeing-zmbuf.patch 2019-04-10 14:06:07.911293167 +0100 @@ -1,13 +1,14 @@ -From 041d37b2ef25faeb1c00ed70a5fc2ea6e93c4828 Mon Sep 17 00:00:00 2001 +From 17b72dcd5c6f0ea86bb76a867789e34c218500a0 Mon Sep 17 00:00:00 2001 From: Tiwei Bie Date: Fri, 22 Feb 2019 10:42:06 +0800 Subject: [PATCH] vhost: restore mbuf first when freeing zmbuf +[ upstream commit 041d37b2ef25faeb1c00ed70a5fc2ea6e93c4828 ] + The mbufs should also be restored in free_zmbufs(). Fixes: b0a985d1f340 ("vhost: add dequeue zero copy") Fixes: 3ebd930588b7 ("vhost: fix mbuf free") -Cc: stable@dpdk.org Signed-off-by: Tiwei Bie Reviewed-by: Maxime Coquelin @@ -18,10 +19,10 @@ 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h -index fc31796bf..bcfce274b 100644 +index 552b9298d..d4f34c34a 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h -@@ -742,3 +742,19 @@ free_ind_table(void *idesc) +@@ -756,3 +756,19 @@ kick: } +static __rte_always_inline void @@ -42,7 +43,7 @@ + #endif /* _VHOST_NET_CDEV_H_ */ diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c -index b086ad95f..e3ddf2589 100644 +index 19e04c953..e078473ec 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1219,4 +1219,5 @@ free_zmbufs(struct vhost_virtqueue *vq) @@ -52,10 +53,10 @@ rte_pktmbuf_free(zmbuf->mbuf); TAILQ_REMOVE(&vq->zmbuf_list, zmbuf, next); diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c -index 37a4c00d2..862ca5e1a 100644 +index 15d682c3c..d8b6bdea5 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c -@@ -1319,20 +1319,4 @@ mbuf_is_consumed(struct rte_mbuf *m) +@@ -1344,20 +1344,4 @@ mbuf_is_consumed(struct rte_mbuf *m) } -static __rte_always_inline void