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 10ACC4625C for ; Tue, 18 Feb 2025 13:39:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 00D72402A0; Tue, 18 Feb 2025 13:39:59 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2051.outbound.protection.outlook.com [40.107.93.51]) by mails.dpdk.org (Postfix) with ESMTP id 69FF7402A0 for ; Tue, 18 Feb 2025 13:39:57 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=brNWXIjIqDjmhKsDkVbkalqxZHwo0VZtNVb4wogItnRwfvmStRlvlF+BQ5SR6w/7GriqLBaWSq24N3uHnXP2r3PcP1CEb54sy92PlGoNjIC1PbOda4i/ngyvErePWt19eperpqN4pbjVf4sgDUKTmIjAfmtgFlgA8tcqccbBXbgvdD2XG+u4vHgEBrQE8GDgVUoyDjoZLC/x0PafpUwl9Tq4AZGG2L02gU5fzEh1X1cwdZi995tK1/2w0r6ztxWZsglEP0IqjEiuzngXOwYBGIgxFIgO4Jo97lJ6Gqy0XHNelLQ1WagYLlHKIYSvdFV3VRG/9XQ3yWX/DeNt8xVm6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=XLWSmM8tLiw0Jlr1rLtzUc8l59UthnUzNmd79K1LXW8=; b=HFo9il5gvgT4djZjfn4bnDVGr/gKifq8eiG2VXorO6TtR7g8ZfvVgZ2q1eA6DtbPplMYT960Y33UvIM0euoSPM+y/dkXoV7JcGzM1w9aJDHRw+I207MoxmFtvbOGlbg9lWtokCRgkDNQc9kGx0FFA2nK48RHyINpJ4n+McB8wcXvkxO5fdF+63h5jKvGEG+1CPXpAntnTnodReV/NDjSw5Bs2lv2/ECc05kTI1pX+zZG1CHzUrGv1soRtepZMXGW+eMjPssG5anntouR7WhKDwlq+rpzsjofVOBJ4TKPkWB99Ctys9XWsVEtDJxxje7OdCVYUP7+p5elBSayOEzM6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=broadcom.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=XLWSmM8tLiw0Jlr1rLtzUc8l59UthnUzNmd79K1LXW8=; b=MxqM3O+eqsHqq2WUk3yootmVOGzzYW8VEypL/xBiLvO2GNWURC1slmcc8R0cJqiH2DPJtLbBf52wxwcjr6+MLjWQy8IJx9Q7l20nx3svLud81vNoRuYdUw6axT54VEw5LIOdDr/dBImpEj7bdy8q/zM4PJVYmqwV+FHK52vRNM0h6QUs4jcl/Y9jj87veoahG/9cmn2FR2lZMb04OOvgA76V6yAKt9gZm7FNuj7WXTTBm/p4Gr91wJt5VTMWQXO0+Jww+pYUQ3k2JojFIWKEhzJKoiY1Mgr/QOAryjeYCjR7qu72UB+vPYZnm3fak/EAIUSfToNj2hy5caWIn9bjeA== Received: from MW4P220CA0022.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::27) by CY5PR12MB6299.namprd12.prod.outlook.com (2603:10b6:930:20::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8445.18; Tue, 18 Feb 2025 12:39:54 +0000 Received: from MWH0EPF000989EC.namprd02.prod.outlook.com (2603:10b6:303:115:cafe::94) by MW4P220CA0022.outlook.office365.com (2603:10b6:303:115::27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8398.31 via Frontend Transport; Tue, 18 Feb 2025 12:39:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by MWH0EPF000989EC.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8466.11 via Frontend Transport; Tue, 18 Feb 2025 12:39:53 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 18 Feb 2025 04:39:45 -0800 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Tue, 18 Feb 2025 04:39:42 -0800 From: Xueming Li To: Sangtani Parag Satishbhai CC: , Somnath Kotur , "Kalesh AP" , Ajit Khaparde , dpdk stable Subject: patch 'net/bnxt: fix crash when representor is re-attached' has been queued to stable release 23.11.4 Date: Tue, 18 Feb 2025 20:34:35 +0800 Message-ID: <20250218123523.36836-41-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250218123523.36836-1-xuemingl@nvidia.com> References: <20250218123523.36836-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989EC:EE_|CY5PR12MB6299:EE_ X-MS-Office365-Filtering-Correlation-Id: 81db1a40-8ce7-462b-ccdf-08dd5019581d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|1800799024|36860700013|7053199007|13003099007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?QXEHCcQRid/kB3qOHnJwEx0G/iO9DiP4n+JbEdJCbeNvYTUItxeDj4q14+Px?= =?us-ascii?Q?gzE9BmHmHy+DJi7qFS6ZGd1bAUlBfGDOdPn1+DPODqLVO+Fj7FHIVhNcPIZt?= =?us-ascii?Q?ZEk2RDTwsmejHXHipwLN260NyDXcEGTZndrPcibVyZbGQlY1HrwPP2x1T8ka?= =?us-ascii?Q?JURLHznhYIXiMyfbK6PDkDBETZdlG03IkScrvvtEhi+nNrv1vcTjJSd1vDBz?= =?us-ascii?Q?vsGEpqG/2KQPcRzVeDgE9Dg5FBL2nAm3EA4m9nuVfrcoYlRx2p1I83K2BfZW?= =?us-ascii?Q?AoAQrpl0GRRCDmHKi8d5y46ZZQm9JZwybOczvtD8D0a+VG9ICWJZCqX6OBxK?= =?us-ascii?Q?JraZOGkllT9Px/AD/Emn/szzl6wcBmxWXdLHAsmNv+F4QwilVxSg2BjHPSsE?= =?us-ascii?Q?fevr+/BSt8jwvp4RefLEifOkioLWhRwxfnU7lqOMEIJlPEjHx5a59xb560t1?= =?us-ascii?Q?ThsOxCV9VAj9eYKBdDCOPNz2c+luZxKGK7phFO3CEOf2xZFe7fdVkfDyzNAn?= =?us-ascii?Q?DZ6ejveBKww1rbJfXTCv7ZQyMnwdD1/62Wto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hnmW+g61sSyq4EPI/mF4qhRVqwKoTqQbQu3upnC8LwG/Tp5Q8ZwABNrEv?= =?us-ascii?Q?WsqVacpVdpYJrDc=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013)(7053199007)(13003099007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2025 12:39:53.8293 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81db1a40-8ce7-462b-ccdf-08dd5019581d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989EC.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6299 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 Hi, FYI, your patch has been queued to stable release 23.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. 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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=5bdead115568a2e275aa60e36752d22ad25dad61 Thanks. Xueming Li --- >From 5bdead115568a2e275aa60e36752d22ad25dad61 Mon Sep 17 00:00:00 2001 From: Sangtani Parag Satishbhai Date: Thu, 19 Dec 2024 17:31:13 -0800 Subject: [PATCH] net/bnxt: fix crash when representor is re-attached Cc: Xueming Li [ upstream commit fca6cf68bbcf9b84e4388239031fb168a6624375 ] When the PCI port is detached using the testpmd command, as part of cleanup testpmd removes resources of parent port and all the children's ports and calls the driver specific pci_remove API with the parent rte ethdev to clean-up ethdevs. For the bnxt driver, a condition to check type of ethdev is added in bnxt_pci_remove and based on the condition relevant ethdev is removed (VF/PF or VFR). As the RTE layer always calls PCI remove with the parent ethdev, the bnxt_pci_remove never frees children (VFRs) ethdev. As, these ethdevs were not freed it gives spurious status in re-allocation check(when pci port attach command is executed) and when RTE layers tries to access interrupt specific info from the ethdev due to uninitialized members it access NULL pointer which results in seg fault. The fix is made in bnxt_pci_remove to clean ethdev for parent (PF/VF) along with children (VFRs). Fixes: 322bd6e70272 ("net/bnxt: add port representor infrastructure") Signed-off-by: Sangtani Parag Satishbhai Reviewed-by: Somnath Kotur Reviewed-by: Kalesh AP Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 988895a065..35d9e0b53b 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -6440,6 +6440,8 @@ static int bnxt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, static int bnxt_pci_remove(struct rte_pci_device *pci_dev) { struct rte_eth_dev *eth_dev; + uint16_t port_id; + int rc = 0; eth_dev = rte_eth_dev_allocated(pci_dev->device.name); if (!eth_dev) @@ -6449,14 +6451,20 @@ static int bnxt_pci_remove(struct rte_pci_device *pci_dev) * +ve value will at least help in proper cleanup */ - PMD_DRV_LOG(DEBUG, "BNXT Port:%d pci remove\n", eth_dev->data->port_id); if (rte_eal_process_type() == RTE_PROC_PRIMARY) { - if (eth_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) - return rte_eth_dev_destroy(eth_dev, - bnxt_representor_uninit); - else - return rte_eth_dev_destroy(eth_dev, - bnxt_dev_uninit); + RTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device) { + PMD_DRV_LOG(DEBUG, "BNXT Port:%d pci remove", port_id); + eth_dev = &rte_eth_devices[port_id]; + if (eth_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) + rc = rte_eth_dev_destroy(eth_dev, + bnxt_representor_uninit); + else + rc = rte_eth_dev_destroy(eth_dev, + bnxt_dev_uninit); + if (rc != 0) + return rc; + } + return rc; } else { return rte_eth_dev_pci_generic_remove(pci_dev, NULL); } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-02-18 19:39:02.154466185 +0800 +++ 0040-net-bnxt-fix-crash-when-representor-is-re-attached.patch 2025-02-18 19:39:00.548244061 +0800 @@ -1 +1 @@ -From fca6cf68bbcf9b84e4388239031fb168a6624375 Mon Sep 17 00:00:00 2001 +From 5bdead115568a2e275aa60e36752d22ad25dad61 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit fca6cf68bbcf9b84e4388239031fb168a6624375 ] @@ -23 +25,0 @@ -Cc: stable@dpdk.org @@ -34 +36 @@ -index b18247feb2..144d4377bd 100644 +index 988895a065..35d9e0b53b 100644 @@ -37 +39 @@ -@@ -6993,6 +6993,8 @@ static int bnxt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, +@@ -6440,6 +6440,8 @@ static int bnxt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, @@ -46 +48 @@ -@@ -7002,14 +7004,20 @@ static int bnxt_pci_remove(struct rte_pci_device *pci_dev) +@@ -6449,14 +6451,20 @@ static int bnxt_pci_remove(struct rte_pci_device *pci_dev) @@ -50 +52 @@ -- PMD_DRV_LOG_LINE(DEBUG, "BNXT Port:%d pci remove", eth_dev->data->port_id); +- PMD_DRV_LOG(DEBUG, "BNXT Port:%d pci remove\n", eth_dev->data->port_id); @@ -52 +54 @@ -- if (rte_eth_dev_is_repr(eth_dev)) +- if (eth_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) @@ -59 +61 @@ -+ PMD_DRV_LOG_LINE(DEBUG, "BNXT Port:%d pci remove", port_id); ++ PMD_DRV_LOG(DEBUG, "BNXT Port:%d pci remove", port_id);