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 B50E4A0C43; Wed, 12 May 2021 15:18:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9E7FF410F6; Wed, 12 May 2021 15:18:40 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 00B8E410E3; Wed, 12 May 2021 15:18:38 +0200 (CEST) Received: from dggeml712-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FgFcZ01WWzWYCX; Wed, 12 May 2021 21:14:22 +0800 (CST) Received: from dggpemm500008.china.huawei.com (7.185.36.136) by dggeml712-chm.china.huawei.com (10.3.17.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 12 May 2021 21:18:37 +0800 Received: from localhost (10.174.243.60) by dggpemm500008.china.huawei.com (7.185.36.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 12 May 2021 21:18:37 +0800 From: wangyunjian To: CC: , , , , Yunjian Wang , Date: Wed, 12 May 2021 21:18:35 +0800 Message-ID: <1620825515-19740-1-git-send-email-wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.243.60] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500008.china.huawei.com (7.185.36.136) X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 2/2] net/mlx5: fix mem leak when a device configured repeatedly X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Yunjian Wang Currently, configuring a mlx device, it will allocate its own process private in mlx5_proc_priv_init() and only frees it when closing the device. This will lead to a memory leak, when a device is configured repeatedly. For example: for(...) do rte_eth_dev_configure rte_eth_rx_queue_setup rte_eth_tx_queue_setup rte_eth_dev_start rte_eth_dev_stop done Fixes: 120dc4a7dcd3 ("net/mlx5: remove device register remap") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang --- drivers/net/mlx5/mlx5.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 35f91e965e..916744f141 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1455,6 +1455,8 @@ mlx5_proc_priv_init(struct rte_eth_dev *dev) struct mlx5_proc_priv *ppriv; size_t ppriv_size; + mlx5_proc_priv_uninit(dev); + /* * UAR register table follows the process private structure. BlueFlame * registers for Tx queues are stored in the table. -- 2.23.0