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 47554A034F for ; Wed, 10 Nov 2021 07:40:21 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 41E3C40E28; Wed, 10 Nov 2021 07:40:21 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2056.outbound.protection.outlook.com [40.107.220.56]) by mails.dpdk.org (Postfix) with ESMTP id 653E740E28 for ; Wed, 10 Nov 2021 07:40:20 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fb0UrYXqwIlJk4Uc7yAcbXlVcLXzM+WKMZ0uh3LEcCPAeFtns9SZjMUs6cSA/2ui87bwExs5bQXR5chHN3Gjb+NJr+JiUihe1MAlBmVlcQj4vzFyzTfWSGQtMA/eJiWmn4CT4dGNSOHotzn9JfFUWVdEm61j/Zh69vK0UvLmiCIPebVUpgikBp4LOzGL1HD0LwEfOBJmbRk5+1hu4+pGSSJqQKUQV+IFvmIKu+ROFxA6jI+mUfCHazHY8uaJ93h0+IzqfVOgNZOen/csdygbCDz2xSWIAWrUMtFDUsuH6ME7WLvWi47Oea6fPZVa7okU/WZamSm4aMBzW4XmFdYLWw== 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=wlGwtYy7jkzK2uyZ1P2DLYrbc1zX7QyoQJeilw8h674=; b=jHlZoeamoOfxDwVq3K1vSHOmWIbOD5bLAbLEIV4tXxM4NB94iRdO7RkPL5fE8wB4wxdAZluxL8faQABw59Mkc/rZUxVTlv0z5hZ9Xa0luHb6EVO5E2t/Rn5Ym9EwtbOWF/v0TUruWKpG7FBVCA6WRkDuDl07nQ3D/fsCfmSJ2sVlmhryPBk52pC4rNWPUxQcjl+fFgFk4HzdnkpwhIkptZsEtUJdM3lCAaFCa9wH4dAHq97xI1yphhjIffNY+cqWdaYFlc6Jp1U6bk49r2jvUeZZoDneFIEaKYX84ZTqX0u/IyniRE63wPZBnnrZ30Z+AdGy41jweNPirVqwnbQqFA== 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=wlGwtYy7jkzK2uyZ1P2DLYrbc1zX7QyoQJeilw8h674=; b=klr9uYOJGq5FB1PAQes4hgl8ZAEwkIFTRtllp4AjHu1DYM5dEVjomSOeeIRo0wpSjEYs/MfA6sR8va34F/UtRenn9HrmFq/tgvZPTdFDtpjU8GwoGXrq5DOJJuYrqWyOXP92X2SypyMkrIP2AjAfdsRS1dUYep1f+wshqO/Wo3XWlb4+my7QxrUfFHDrjoFEqSXoHBiziUhTduvNLTg0YQeDH3CMiN4gTq+xCC90A+QLP4Axqj+aKIpB4bI8inLAoqpPpbxrO7MJkEur/yee1DSM1S+TRPmUnbR+P0uOLNFn6NNph0JgM3dpett+WSUnbC2ALrN7krAuryAzgLKEwA== Received: from DM6PR06CA0022.namprd06.prod.outlook.com (2603:10b6:5:120::35) by MWHPR1201MB2478.namprd12.prod.outlook.com (2603:10b6:300:e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Wed, 10 Nov 2021 06:40:18 +0000 Received: from DM6NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:5:120:cafe::ea) by DM6PR06CA0022.outlook.office365.com (2603:10b6:5:120::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Wed, 10 Nov 2021 06:40:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;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 DM6NAM11FT060.mail.protection.outlook.com (10.13.173.63) 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:40:18 +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:40:15 +0000 From: Xueming Li To: Qiming Chen CC: Luca Boccassi , Qi Zhang , dpdk stable Date: Wed, 10 Nov 2021 14:29:17 +0800 Message-ID: <20211110063216.2744012-74-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: f7a77178-fa54-4c87-e1e6-08d9a414f5f1 X-MS-TrafficTypeDiagnostic: MWHPR1201MB2478: 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: LFgHVLm6gsOGH7FX2IgMaTpMQ1PmXz8yUBZqm77fmboecxxHaDyt+XSMRsKjMDIE5QG13jNhkfvotAlpiGO7foBlOX3ZrnceB/ruZh1L6wKcy9b4nWQ3c94pLShl1HwqtMyPj3XLmoOaSe3gs9szi8dhRs5nH3RqKyvP8Bx9bFRiTezl/kLY4MQl3Ea01ceZI5nTbI9CrgluuZKepoNqEqqxwIRjIuruBoyJFYG8LRrtX6BPWhX2Vmh8DXyTCc1PU561J8J7BniWzgiti4CiuXdvmzBLSt3Df0hvNbg3GgBY8MCaphh0H1H+yvRf4v7r41bZ8cqX8TfW2o0rvQgClCVYCUk4oFb3qm38iDZ1g9fjSrHQeCf0FPAGNwpoNu2OAhn1cyiY8eUcBfVZap2dveMA7tOyTc0yyRGxzB1ZnmAemKdlqrxLRI+jrnUEaISNeqwWpSQ91jn59vIze8g6qklaTYHn1xNFnncxFslOL2mkPyfzPlsXHzxF51ixCFLvIT8B2uG7KLczQIKHllOozgGyHD731A+7hjUHXqtaLwLw9kS1qyKYjLvIgBhOjp6t24k2qqXgLmXMGZPA87BAG0ZLHKh3DVsiKJNlU4SA6f1bXzu+3dEp12fMiSryKTvR9EuZfcAdd4wRP+aKdb2duB9N/027LjRqx9xDmpoc3b4bLvJgTsWM2oZxG9R/HXwQmoF1MVVKZOc6w3b7+UBM0pKIw3K/pzDljmnYCL3qPzKj21GXmX/8SZr5CN8RiZ4GNq2uP6XghNhVSQwufne5h/7JQ3TzbdVPgXIHOqZ4rUJWLIg+skqYC6VOqcD5P/R6Qtf03fgqPrqhTIHfJ3DbkQ== 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)(82310400003)(316002)(86362001)(7636003)(5660300002)(4001150100001)(54906003)(36860700001)(36756003)(70586007)(26005)(2906002)(16526019)(6286002)(186003)(8676002)(83380400001)(7696005)(4326008)(70206006)(1076003)(47076005)(55016002)(966005)(53546011)(8936002)(426003)(508600001)(336012)(2616005)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:40:18.1227 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7a77178-fa54-4c87-e1e6-08d9a414f5f1 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: DM6NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB2478 Subject: [dpdk-stable] patch 'net/iavf: fix mbuf leak' 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/474bbafd6f2d216f7d7a2a09e2e98200597f20ad Thanks. Xueming Li --- >From 474bbafd6f2d216f7d7a2a09e2e98200597f20ad Mon Sep 17 00:00:00 2001 From: Qiming Chen Date: Thu, 16 Sep 2021 22:04:00 +0800 Subject: [PATCH] net/iavf: fix mbuf leak Cc: Xueming Li [ upstream commit 1028e5bc36b4dd4ae51580eb3e45410b6c82e153 ] In the iavf_dev_rx_queue_start function, if the iavf_switch_queue or iavf_switch_queue_lv function fails, the previously applied mbuf is not released, resulting in leakage. The patch fixes the problem. Fixes: 9cf9c02bf6ee ("net/iavf: add enable/disable queues for large VF") Signed-off-by: Qiming Chen Acked-by: Qi Zhang --- drivers/net/iavf/iavf_rxtx.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index b0e86f022b..b475aa0cc5 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -245,11 +245,15 @@ alloc_rxq_mbufs(struct iavf_rx_queue *rxq) volatile union iavf_rx_desc *rxd; struct rte_mbuf *mbuf = NULL; uint64_t dma_addr; - uint16_t i; + uint16_t i, j; for (i = 0; i < rxq->nb_rx_desc; i++) { mbuf = rte_mbuf_raw_alloc(rxq->mp); if (unlikely(!mbuf)) { + for (j = 0; j < i; j++) { + rte_pktmbuf_free_seg(rxq->sw_ring[j]); + rxq->sw_ring[j] = NULL; + } PMD_DRV_LOG(ERR, "Failed to allocate mbuf for RX"); return -ENOMEM; } @@ -757,12 +761,14 @@ iavf_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) else err = iavf_switch_queue_lv(adapter, rx_queue_id, true, true); - if (err) + if (err) { + release_rxq_mbufs(rxq); PMD_DRV_LOG(ERR, "Failed to switch RX queue %u on", rx_queue_id); - else + } else { dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED; + } return err; } -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:05.321815673 +0800 +++ 0073-net-iavf-fix-mbuf-leak.patch 2021-11-10 14:17:01.837413030 +0800 @@ -1 +1 @@ -From 1028e5bc36b4dd4ae51580eb3e45410b6c82e153 Mon Sep 17 00:00:00 2001 +From 474bbafd6f2d216f7d7a2a09e2e98200597f20ad Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 1028e5bc36b4dd4ae51580eb3e45410b6c82e153 ] @@ -11 +13,0 @@ -Cc: stable@dpdk.org @@ -20 +22 @@ -index 6de8ad3fe3..87afc0b4cb 100644 +index b0e86f022b..b475aa0cc5 100644 @@ -23 +25 @@ -@@ -278,11 +278,15 @@ alloc_rxq_mbufs(struct iavf_rx_queue *rxq) +@@ -245,11 +245,15 @@ alloc_rxq_mbufs(struct iavf_rx_queue *rxq) @@ -40 +42 @@ -@@ -852,12 +856,14 @@ iavf_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) +@@ -757,12 +761,14 @@ iavf_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)