From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B7F74A034F for ; Wed, 10 Nov 2021 07:45:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB3C540683; Wed, 10 Nov 2021 07:45:02 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2076.outbound.protection.outlook.com [40.107.93.76]) by mails.dpdk.org (Postfix) with ESMTP id C3D174014D for ; Wed, 10 Nov 2021 07:45:00 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DNaGm9iSATzvUUZucUBQVD9KwXf9Uxc+fbApGNaqsMTW2hUCz2GzKXoUGJDnQ10wDcLIWdGcLQCtB+c7tSkr4B4zwuVGX45zf8I2lbfKJk0OKet/HvCxkVCTctQYybkV9y35qYrIOBGaSIiYIlwekntY2exybRhD9mXJsuTDDqJujp8wVq7CzygBGS52eeXukYYA7oP+KW+gVE+Ls69gIPCWXVa8ybEarqB1jMmG+3PDP0N2JD7W/WUfOWaOY0RgW2WASZ9oIT8zGxILWAT0Kz4krQzEuEkWq2wtMW/JwFc6Usm3sSH2SoISAHu/I2QP5XfA4QB82IjohcPpzcWEUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3NXfs5LFlWrZYutItSVuuHa9EKI3AUDaXzSt4kQDHo0=; b=ZZNlBcjAzYl/BetLxQ3434T4C46C1RPn6jOxLWUKUL9jzlFyKFmjLkyfeA39R9WmF2VzbWRumxOmmhDOT/erQSR4awH6neYWfgdOnYRKfXW74sikfVy3zVVtVez4kVcwt3mIPC4cPGD5HnTRv6aWDE4iv8lgidX7prU7Bx2/DorUCv36sac7+zy2x27RC3KQGJHABxYL1uoNmqu4Cu9KSQ2Lwl4S/ZIM7B1rVn+A3kZF9BK3TQpj/ssd5glJOMzIpPcBzRgQfapnG9ScF0SdoIFlczWDqVWEpYp3fUrkC+C5lX9jdCY8aqLX4hSH+si9WCPZmtNzR+jMHiSxLUgFqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3NXfs5LFlWrZYutItSVuuHa9EKI3AUDaXzSt4kQDHo0=; b=jwJqO93Wx8HaYYMrGfp28PKBeIBfHVez4K/rww1rJ67PLeGnAjHf+CLLXOculItu4/zj4C+eUSdqBT07bNgQc/2vQp10UCLmr03PLp/bLxtZD36xXA/sMo0RpiWzPxHWGodxEQr/L5VDSDydCLIjayP3KDV/OuuWmKcKVEK64rZn0V8O0YihaXQQugF/GLGwbjpeFPS3GQzs/g7EmqfIVTEL2SB8MkFW7f4ggnsHQuGe1vApOeuIaiPvQDMtVYHDQivaz3Ga4k09+OUVuLwIg4BugJuLWGXhqpwBQ/adaZqGK9/3ZsaXx2xRuwa38m+nqM8ooz4HfRdC4pzevN4EQg== Received: from BN6PR22CA0070.namprd22.prod.outlook.com (2603:10b6:404:ca::32) by BL1PR12MB5320.namprd12.prod.outlook.com (2603:10b6:208:314::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13; Wed, 10 Nov 2021 06:44:59 +0000 Received: from BN8NAM11FT049.eop-nam11.prod.protection.outlook.com (2603:10b6:404:ca:cafe::5d) by BN6PR22CA0070.outlook.office365.com (2603:10b6:404:ca::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13 via Frontend Transport; Wed, 10 Nov 2021 06:44:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT049.mail.protection.outlook.com (10.13.177.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Wed, 10 Nov 2021 06:44:58 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 10 Nov 2021 06:44:56 +0000 From: Xueming Li To: Yunjian Wang CC: Luca Boccassi , Haiyue Wang , dpdk stable Date: Wed, 10 Nov 2021 14:29:54 +0800 Message-ID: <20211110063216.2744012-111-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110063216.2744012-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 66d6f7b7-629a-4bda-97e6-08d9a4159d3d X-MS-TrafficTypeDiagnostic: BL1PR12MB5320: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s6ElIVpmDMtkRjFqdQ1Ti+/3h+fbRMMbb6lYE70dOQflAVAZG4te8TtypRRVrvzvnOajtCJRdz3jbqb7XmdjWGT7CEFpXcfwNwCPwsdshQTawqhLCe5Mo9zLN/0ZHzRKz5fLQhcqmGNFW9Qhuvl41bnpQVp/9AonEDCZ3asv4p6QhV3LK9glm7IFjPf8FeOERs6jhQqVitI7+PcJJTUPsgX+5jCH7UbCb4yzG5gJS+ijn9MmAQHJCUcrhAOxLFHATxlEs+0HT1uTywpN1u4GVt3FUrmgouoQaoxrmWNS7CcfB/tffZCqZ922R6Q2FOa1j8/D+j0DC+5FPbTReoFNQLZ8w7lghIKgfdj8pLkDJirGN5RH/8CQYhG68op+Y3piWCO8Dk7CJNiHV6OcXCCZKvHGlsM8XKR3jf1lO2gyzFIDr35RpkxHTNY9fmZZxcvA4ylPw7zgRWd7W61Qa9Ar8ufTmcX24PdQK3KLtva3EIfC2f7xSAj8FdXf6cbxff4jSWjAkYTj5j2u86KKNNdrDRGAOdjcfA48iJMdmx96sGdZKcDk7H1bSUv9AV4Bk2ASl1rXrbqi2HiSVLwgMkBCDASsO02dW0VZ66I2uVCDBFPxMQTv9jdS6gEmqQKZsr9ffZ6DfZYdseksuy8zZatHzf/PjSKQLJzs6mLEhQHSXGanFLK/FIfyYBINQyw/Wmo+Y57BlnYCk9zUM26JasyG2BGgKQ7TTjl5d9Zyp55PoXtsof3NepyjA7aRBa+HqKqdpk/d0Sh5JLrlUdlQZPAaBjYjntQWBJ8zZ/hiqxSjl0IKBKREVAHGj5TD7nwyFNPpFa9YuGdeIeXDiHDCLryUgg== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(6916009)(2616005)(426003)(508600001)(47076005)(7696005)(82310400003)(53546011)(1076003)(336012)(8676002)(5660300002)(2906002)(70586007)(356005)(8936002)(4326008)(55016002)(4001150100001)(70206006)(16526019)(7636003)(186003)(316002)(86362001)(36860700001)(966005)(6286002)(54906003)(26005)(83380400001)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:44:58.7234 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66d6f7b7-629a-4bda-97e6-08d9a4159d3d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT049.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5320 Subject: [dpdk-stable] patch 'net/ixgbe: fix memzone leak on queue re-configure' has been queued to stable release 20.11.4 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 stable release 20.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/12/21. 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/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/2adcdc8cc791f517ada0cf99f9f7138d4cd4bbe5 Thanks. Xueming Li --- >From 2adcdc8cc791f517ada0cf99f9f7138d4cd4bbe5 Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Wed, 22 Sep 2021 21:30:04 +0800 Subject: [PATCH] net/ixgbe: fix memzone leak on queue re-configure Cc: Xueming Li [ upstream commit a4ae7f51d21af6f59d6ce1e1117de227b352a4cc ] Normally when closing the device the queue memzone should be freed. But the memzone will be not freed, when device setup ops like: rte_eth_bond_slave_remove -->__eth_bond_slave_remove_lock_free ---->slave_remove ------>rte_eth_dev_internal_reset -------->rte_eth_dev_rx_queue_config ---------->eth_dev_rx_queue_config ------------>ixgbe_dev_rx_queue_release rte_eth_dev_close -->ixgbe_dev_close ---->ixgbe_dev_free_queues ------>ixgbe_dev_rx_queue_release (not been called due to nb_rx_queues and nb_tx_queues are 0) And when queue number is changed to small size, the BIG memzone queue index will be lost. This will lead to a memory leak. So we should release the memzone when releasing queues. Fixes: 460d1679586e ("drivers/net: delete HW rings while freeing queues") Signed-off-by: Yunjian Wang Acked-by: Haiyue Wang --- drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++++-- drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 3d983d4db7..c0ab36ad86 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -2449,6 +2449,7 @@ ixgbe_tx_queue_release(struct ixgbe_tx_queue *txq) if (txq != NULL && txq->ops != NULL) { txq->ops->release_mbufs(txq); txq->ops->free_swring(txq); + rte_memzone_free(txq->mz); rte_free(txq); } } @@ -2730,6 +2731,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, return -ENOMEM; } + txq->mz = tz; txq->nb_tx_desc = nb_desc; txq->tx_rs_thresh = tx_rs_thresh; txq->tx_free_thresh = tx_free_thresh; @@ -2854,6 +2856,7 @@ ixgbe_rx_queue_release(struct ixgbe_rx_queue *rxq) ixgbe_rx_queue_release_mbufs(rxq); rte_free(rxq->sw_ring); rte_free(rxq->sw_sc_ring); + rte_memzone_free(rxq->mz); rte_free(rxq); } } @@ -3129,6 +3132,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, return -ENOMEM; } + rxq->mz = rz; /* * Zero init all the descriptors in the ring. */ @@ -3400,14 +3404,12 @@ ixgbe_dev_free_queues(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_rx_queues; i++) { ixgbe_dev_rx_queue_release(dev->data->rx_queues[i]); dev->data->rx_queues[i] = NULL; - rte_eth_dma_zone_free(dev, "rx_ring", i); } dev->data->nb_rx_queues = 0; for (i = 0; i < dev->data->nb_tx_queues; i++) { ixgbe_dev_tx_queue_release(dev->data->tx_queues[i]); dev->data->tx_queues[i] = NULL; - rte_eth_dma_zone_free(dev, "tx_ring", i); } dev->data->nb_tx_queues = 0; } diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h index bcadaf79ce..d18cac29bf 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.h +++ b/drivers/net/ixgbe/ixgbe_rxtx.h @@ -138,6 +138,7 @@ struct ixgbe_rx_queue { struct rte_mbuf fake_mbuf; /** hold packets to return to application */ struct rte_mbuf *rx_stage[RTE_PMD_IXGBE_RX_MAX_BURST*2]; + const struct rte_memzone *mz; }; /** @@ -236,6 +237,7 @@ struct ixgbe_tx_queue { uint8_t using_ipsec; /**< indicates that IPsec TX feature is in use */ #endif + const struct rte_memzone *mz; }; struct ixgbe_txq_ops { -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:06.879051789 +0800 +++ 0110-net-ixgbe-fix-memzone-leak-on-queue-re-configure.patch 2021-11-10 14:17:01.877412703 +0800 @@ -1 +1 @@ -From a4ae7f51d21af6f59d6ce1e1117de227b352a4cc Mon Sep 17 00:00:00 2001 +From 2adcdc8cc791f517ada0cf99f9f7138d4cd4bbe5 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit a4ae7f51d21af6f59d6ce1e1117de227b352a4cc ] @@ -28 +30,0 @@ -Cc: stable@dpdk.org @@ -38 +40 @@ -index 176daaff9d..349180e7c1 100644 +index 3d983d4db7..c0ab36ad86 100644 @@ -41 +43 @@ -@@ -2482,6 +2482,7 @@ ixgbe_tx_queue_release(struct ixgbe_tx_queue *txq) +@@ -2449,6 +2449,7 @@ ixgbe_tx_queue_release(struct ixgbe_tx_queue *txq) @@ -49 +51 @@ -@@ -2763,6 +2764,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, +@@ -2730,6 +2731,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, @@ -57 +59 @@ -@@ -2887,6 +2889,7 @@ ixgbe_rx_queue_release(struct ixgbe_rx_queue *rxq) +@@ -2854,6 +2856,7 @@ ixgbe_rx_queue_release(struct ixgbe_rx_queue *rxq) @@ -65 +67 @@ -@@ -3162,6 +3165,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, +@@ -3129,6 +3132,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, @@ -73 +75 @@ -@@ -3433,14 +3437,12 @@ ixgbe_dev_free_queues(struct rte_eth_dev *dev) +@@ -3400,14 +3404,12 @@ ixgbe_dev_free_queues(struct rte_eth_dev *dev) @@ -75 +77 @@ - ixgbe_dev_rx_queue_release(dev, i); + ixgbe_dev_rx_queue_release(dev->data->rx_queues[i]); @@ -82 +84 @@ - ixgbe_dev_tx_queue_release(dev, i); + ixgbe_dev_tx_queue_release(dev->data->tx_queues[i]); @@ -89 +91 @@ -index 476ef62cfd..a1764f2b08 100644 +index bcadaf79ce..d18cac29bf 100644