From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5C20EA0093 for ; Thu, 28 May 2020 18:26:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5237D1DC1A; Thu, 28 May 2020 18:26:07 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id F1D741DC1A for ; Thu, 28 May 2020 18:26:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590683165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GOs9AcGZzTEgB+c5filyOSpY6VRuktCehPToZgFtO1s=; b=PU1dLup7Xvg2J4wMfXAfBeA/et2H+7n/Q5OxS2dsIsfBGTjxXRKvbFmju19eoXXU8zfJaM Ns+CR1jDTeD0TC3sVjW+TPP5rFmo/vzCeRwfo1g9YIwUbCiltZqTzFxarUvGPapRT27RIX DicMdsG+eckgn1omMskXmGWn1S5icrU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-311-h0glq4xEMX6d0w5XNHAiUg-1; Thu, 28 May 2020 12:26:02 -0400 X-MC-Unique: h0glq4xEMX6d0w5XNHAiUg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 30FC6107ACCA; Thu, 28 May 2020 16:26:01 +0000 (UTC) Received: from rh.redhat.com (unknown [10.33.36.235]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22F8A60C05; Thu, 28 May 2020 16:25:59 +0000 (UTC) From: Kevin Traynor To: Yunjian Wang Cc: Ferruh Yigit , Stephen Hemminger , dpdk stable Date: Thu, 28 May 2020 17:23:06 +0100 Message-Id: <20200528162322.7863-79-ktraynor@redhat.com> In-Reply-To: <20200528162322.7863-1-ktraynor@redhat.com> References: <20200528162322.7863-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/tap: fix mbuf and mem leak during queue release' has been queued to LTS release 18.11.9 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.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/03/20. 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. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/19bab2b4d6b9be326eb04f84eebd09de4d5ebdc3 Thanks. Kevin. --- >From 19bab2b4d6b9be326eb04f84eebd09de4d5ebdc3 Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Thu, 16 Apr 2020 11:04:25 +0800 Subject: [PATCH] net/tap: fix mbuf and mem leak during queue release [ upstream commit 710aa4279097e9ee5a131b7e0732e5a8ef8bcfc1 ] For the tap PMD, we should release mbufs and iovecs from the Rx queue when closing device. In order to remove duplicated code, rte_pmd_tap_remove() calls tap_dev_close(). Fixes: 0781f5762cfe ("net/tap: support segmented mbufs") Signed-off-by: Yunjian Wang Reviewed-by: Ferruh Yigit Acked-by: Stephen Hemminger --- drivers/net/tap/rte_eth_tap.c | 36 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 7b3954621e..c6cfb4c683 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1008,13 +1008,23 @@ tap_dev_close(struct rte_eth_dev *dev) struct pmd_internals *internals = dev->data->dev_private; struct pmd_process_private *process_private = dev->process_private; + struct rx_queue *rxq; tap_link_set_down(dev); - tap_flow_flush(dev, NULL); - tap_flow_implicit_flush(internals, NULL); + if (internals->nlsk_fd != -1) { + tap_flow_flush(dev, NULL); + tap_flow_implicit_flush(internals, NULL); + tap_nl_final(internals->nlsk_fd); + internals->nlsk_fd = -1; + } for (i = 0; i < RTE_PMD_TAP_MAX_QUEUES; i++) { if (process_private->rxq_fds[i] != -1) { + rxq = &internals->rxq[i]; close(process_private->rxq_fds[i]); process_private->rxq_fds[i] = -1; + rte_pktmbuf_free(rxq->pool); + rte_free(rxq->iovecs); + rxq->pool = NULL; + rxq->iovecs = NULL; } if (process_private->txq_fds[i] != -1) { @@ -2291,6 +2301,4 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev) struct rte_eth_dev *eth_dev = NULL; struct pmd_internals *internals; - struct pmd_process_private *process_private; - int i; /* find the ethdev entry */ @@ -2305,27 +2313,11 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev) return rte_eth_dev_release_port(eth_dev); + tap_dev_close(eth_dev); + internals = eth_dev->data->dev_private; - process_private = eth_dev->process_private; - TAP_LOG(DEBUG, "Closing %s Ethernet device on numa %u", (internals->type == ETH_TUNTAP_TYPE_TAP) ? "TAP" : "TUN", rte_socket_id()); - if (internals->nlsk_fd) { - tap_flow_flush(eth_dev, NULL); - tap_flow_implicit_flush(internals, NULL); - tap_nl_final(internals->nlsk_fd); - } - for (i = 0; i < RTE_PMD_TAP_MAX_QUEUES; i++) { - if (process_private->rxq_fds[i] != -1) { - close(process_private->rxq_fds[i]); - process_private->rxq_fds[i] = -1; - } - if (process_private->txq_fds[i] != -1) { - close(process_private->txq_fds[i]); - process_private->txq_fds[i] = -1; - } - } - close(internals->ioctl_sock); rte_free(eth_dev->process_private); -- 2.21.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-28 17:13:03.194480912 +0100 +++ 0079-net-tap-fix-mbuf-and-mem-leak-during-queue-release.patch 2020-05-28 17:12:59.164554975 +0100 @@ -1 +1 @@ -From 710aa4279097e9ee5a131b7e0732e5a8ef8bcfc1 Mon Sep 17 00:00:00 2001 +From 19bab2b4d6b9be326eb04f84eebd09de4d5ebdc3 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 710aa4279097e9ee5a131b7e0732e5a8ef8bcfc1 ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ -index 6d54c254d7..9c88b9268e 100644 +index 7b3954621e..c6cfb4c683 100644 @@ -24 +25 @@ -@@ -1021,13 +1021,23 @@ tap_dev_close(struct rte_eth_dev *dev) +@@ -1008,13 +1008,23 @@ tap_dev_close(struct rte_eth_dev *dev) @@ -50 +51 @@ -@@ -2399,6 +2409,4 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev) +@@ -2291,6 +2301,4 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev) @@ -57 +58 @@ -@@ -2413,26 +2421,10 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev) +@@ -2305,27 +2313,11 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev) @@ -66 +67,2 @@ - tuntap_types[internals->type], rte_socket_id()); + (internals->type == ETH_TUNTAP_TYPE_TAP) ? "TAP" : "TUN", + rte_socket_id());