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 432BAA034F for ; Wed, 10 Nov 2021 07:42:38 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 306BA4014D; Wed, 10 Nov 2021 07:42:38 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2062.outbound.protection.outlook.com [40.107.223.62]) by mails.dpdk.org (Postfix) with ESMTP id C4E1F4014D for ; Wed, 10 Nov 2021 07:42:36 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zf9SB6EC//82Go97azyr+zWLkVWeLhVJ+3RwJxf4wSGWyZcR8Hcvk1NO+LSLHPy11M7sHA3X9JlwRirA/TMqTb2rgjwud0aGQU/M59V7RagwCNKgnfwGB30YV/SinEXj3uHCEiRyI3Fh7ppO/Vksut5WIRz+w87nB0UZJa0FuPcuQqyQasquOSQIftej9BORCo+rclYL1msX4I18AO287u9bPC1dXesfhh1hxIPRxG/gDpgxH6VeiJB61aBljUg7d76nxsvIgiiWyIB7Lvn3ce5FfSr+oNzL9SNqni0KjqJg4O82IpJS7fhtrTgK/37counwKm7ziA6jk08vd71/jg== 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=zEM7iV+/1dpsppX23yNQsZV2602/GWtbLdQehdgSWjM=; b=U65HEsnr0p8t6UMEYqu79YeFcBkVhjt7i7MyXLTxb/JjdnGvulbBnHdqxEHDMpQ+fkTb6yNWJKuIRxLxIwpT3LFJh0tmMY2wAWwM/gpvpPJLI9+rwHQYygJNJnKYvhmV0dgl6ZuCPSLxZZ99joUKrKzdZhGi3paiWoHx4fg8E9brtG9CG4nUhC+lepT4mnY6TO0ICIWXztE3jahZbLdiEE9S1+m+lpTzQOTBu5jaul9yA7o1GYg+U3TwIC21/3KblyIFZKAngEYSVeG61ZjHKxRcVbO1NlK3XyPfsatEMfxCKKhI3SDTvUYei1GjJIQKCfqYQ241hQ4GcRyp+xG/sg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=redhat.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=zEM7iV+/1dpsppX23yNQsZV2602/GWtbLdQehdgSWjM=; b=Dfo8y7gQXAbk64eRCKfEYSYcntzaOh2a0wJT8Kkl/kqoLPcUgPL73mmiZAWyjhHM6xmaigj1KhbEQtTfFaBczlZoqbIvjPTJ8LrsrMcOZ8w3NP0/dHAgzs9ze7MDqH+c9nWtx9qMrXCt6v5fvBl9MVevtcHJJAqnxZDatTOh3KT2y6c1FEU2OQMt2er8RjMD4rSTlJaUcDWma1TkN6bA6ffbWaZC5M9p/EN+Z29JsZGRInIC4XuCGq9GxXDJBZzOxIqkcsB2v9gjtFS9h5k+aZPFkvHLaCQZnHEEtBdM3iYY2k9cun6HfcSVxNlLeQl8x8gVG9ECyzJTeXpLe3XFnw== Received: from DM6PR06CA0092.namprd06.prod.outlook.com (2603:10b6:5:336::25) by MW2PR12MB2553.namprd12.prod.outlook.com (2603:10b6:907:9::32) 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:42:34 +0000 Received: from DM6NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:5:336:cafe::e2) by DM6PR06CA0092.outlook.office365.com (2603:10b6:5:336::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.15 via Frontend Transport; Wed, 10 Nov 2021 06:42:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.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 DM6NAM11FT004.mail.protection.outlook.com (10.13.172.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Wed, 10 Nov 2021 06:42:32 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 10 Nov 2021 06:42:30 +0000 From: Xueming Li To: Ivan Ilchenko CC: Luca Boccassi , Andrew Rybchenko , Maxime Coquelin , dpdk stable Date: Wed, 10 Nov 2021 14:29:34 +0800 Message-ID: <20211110063216.2744012-91-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.5] 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: e07f3b96-298e-46c3-95ac-08d9a4154626 X-MS-TrafficTypeDiagnostic: MW2PR12MB2553: 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: GtlORL2W5dP6KEFidsnkYHZwLnVFKqQX6TQFmEH35+RgXEzIw6uTbtpeDn4DfbFrvoBrmRtaLsKB56+3zNz06Dp1CF/ow1q+9KkXWw91cG2IOIKqLci+P4Nagptrdve1bOQXGlM8pqdpM6MeNwE/yl+tDQqgSEnX1kmD0Vgo26FS7rai7pSfTo+Uh5XykcoSEa3e+nqwvIKt2ocKGtaqjOcA2OB/T2YlXci9uiyHatoYD8m5HaHhet2NFjQ7ToqZJpYQvSfBEsnWuXnlV+34EcgpYLtBdhT4jwguqFnoHEvxDWHl7bq0ntTsrAUC7v+42adSbgKcb9BL9sK4zvkrtVWA51Hk7zGJHVg6mlRBhKCbrhH6ec2ZzOI/Pg+W9kedZKQqdctt45g8wJP72oM+nfPSru+TiKFSf0EM7I4XCuuxjZi1BtHle9l7XjkVSVhzukFrzlIa/CV9Jqy6mJhcpUQqqL0IApEm3IRxNSHdPBeSbDTG7hLvAmiro7WmyQskcP69ApNz9TTlbVOc5bT6fpox1P72h3Yl63nBnEMkaelJeVlKb4EDWg0NSsysKb3IpQIm721mmAhE8zcdsXt68GkDfSjXHvEQwGDjXhvqHCvr7JujwGqqPblrDyqigfgB2WLfHK5kF0O1O45cdFW1EMY+7nJUBar9a3pM6OlBYYt930Ymv/Xq/sdkPulkEaeVgBq8AlpQwR/W15pf/UbST/lJk7wDK1/RDrBbxAUvm/YWuCnF6/fugWZCzWBAlrECCjDZeMtRa9VIx8DHCVx5kkFD6DNG27Fduea2XSISBaR8LY4xRTGbqQZilj3lkf2xTUSsmak6Qrrcdm+9UpszfA== 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)(46966006)(36840700001)(508600001)(966005)(54906003)(2906002)(1076003)(16526019)(316002)(55016002)(70586007)(6286002)(70206006)(426003)(36756003)(5660300002)(186003)(336012)(6916009)(26005)(2616005)(86362001)(36860700001)(53546011)(356005)(8936002)(83380400001)(4326008)(47076005)(7696005)(82310400003)(8676002)(4001150100001)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:42:32.6708 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e07f3b96-298e-46c3-95ac-08d9a4154626 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: DM6NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2553 Subject: [dpdk-stable] patch 'net/virtio: fix Tx completed mbuf leak on device stop' 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/758eb05f2b576e4bd2267dca6b3142247f98d963 Thanks. Xueming Li --- >From 758eb05f2b576e4bd2267dca6b3142247f98d963 Mon Sep 17 00:00:00 2001 From: Ivan Ilchenko Date: Wed, 15 Sep 2021 12:19:42 +0300 Subject: [PATCH] net/virtio: fix Tx completed mbuf leak on device stop Cc: Xueming Li [ upstream commit 9de76dfb929807f6fbf0b7ceec4bc8274221ddde ] Free Tx completed mbufs on device stop. Not completed Tx mbufs cannot be freed since they are still in use. Fixes: c1f86306a026 ("virtio: add new driver") Signed-off-by: Ivan Ilchenko Signed-off-by: Andrew Rybchenko Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtio_ethdev.c | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 7bbd483952..ed20b1427e 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -2590,6 +2590,35 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev) PMD_INIT_LOG(DEBUG, "%d mbufs freed", mbuf_num); } +static void +virtio_tx_completed_cleanup(struct rte_eth_dev *dev) +{ + struct virtio_hw *hw = dev->data->dev_private; + struct virtqueue *vq; + uint32_t qidx; + void (*xmit_cleanup)(struct virtqueue *vq, uint16_t nb_used); + + if (vtpci_packed_queue(hw)) { + if (hw->use_vec_tx) + xmit_cleanup = &virtio_xmit_cleanup_inorder_packed; + else if (vtpci_with_feature(hw, VIRTIO_F_IN_ORDER)) + xmit_cleanup = &virtio_xmit_cleanup_inorder_packed; + else + xmit_cleanup = &virtio_xmit_cleanup_normal_packed; + } else { + if (hw->use_inorder_tx) + xmit_cleanup = &virtio_xmit_cleanup_inorder; + else + xmit_cleanup = &virtio_xmit_cleanup; + } + + for (qidx = 0; qidx < hw->max_queue_pairs; qidx++) { + vq = hw->vqs[2 * qidx + VTNET_SQ_TQ_QUEUE_IDX]; + if (vq != NULL) + xmit_cleanup(vq, virtqueue_nused(vq)); + } +} + /* * Stop device: disable interrupt and mark link down */ @@ -2608,6 +2637,8 @@ virtio_dev_stop(struct rte_eth_dev *dev) goto out_unlock; hw->started = false; + virtio_tx_completed_cleanup(dev); + if (intr_conf->lsc || intr_conf->rxq) { virtio_intr_disable(dev); -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:06.032792987 +0800 +++ 0090-net-virtio-fix-Tx-completed-mbuf-leak-on-device-stop.patch 2021-11-10 14:17:01.847412948 +0800 @@ -1 +1 @@ -From 9de76dfb929807f6fbf0b7ceec4bc8274221ddde Mon Sep 17 00:00:00 2001 +From 758eb05f2b576e4bd2267dca6b3142247f98d963 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 9de76dfb929807f6fbf0b7ceec4bc8274221ddde ] @@ -10 +12,0 @@ -Cc: stable@dpdk.org @@ -20 +22 @@ -index da1633d77e..3e3b42eaf6 100644 +index 7bbd483952..ed20b1427e 100644 @@ -23 +25 @@ -@@ -2401,6 +2401,35 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev) +@@ -2590,6 +2590,35 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev) @@ -32 +34 @@ -+ int qidx; ++ uint32_t qidx; @@ -35 +37 @@ -+ if (virtio_with_packed_queue(hw)) { ++ if (vtpci_packed_queue(hw)) { @@ -38 +40 @@ -+ else if (virtio_with_feature(hw, VIRTIO_F_IN_ORDER)) ++ else if (vtpci_with_feature(hw, VIRTIO_F_IN_ORDER)) @@ -59 +61 @@ -@@ -2419,6 +2448,8 @@ virtio_dev_stop(struct rte_eth_dev *dev) +@@ -2608,6 +2637,8 @@ virtio_dev_stop(struct rte_eth_dev *dev) @@ -61 +63 @@ - hw->started = 0; + hw->started = false;