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 2300645E41 for ; Sat, 7 Dec 2024 09:09:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 13C4F40E4C; Sat, 7 Dec 2024 09:09:09 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2050.outbound.protection.outlook.com [40.107.223.50]) by mails.dpdk.org (Postfix) with ESMTP id 734CE40281 for ; Sat, 7 Dec 2024 09:09:07 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=h6sjnIY839zagFjlRRrHSHn5Gb8HGb+o1TGcVz+CmmxJz+1oruhsIXWsJhwwElMMXq64PcJtFsZKKS07tBrGMEPuLPSZLIbl/+iJh/yQ5r0hg9FggDq338x/ezVN0gylI1HkdzJln0Pu4EfEMhWdjY0NZBdCV2QBtXeIQS2y6Ktd9Ty+yffwj5gNZMnJTvEz6YlsNllYI6lVzcdgR6UfjNVgvBHg5NLEmFSfKugPAb1iiwvb//j8Mu0e5B9a0nXdV1Mr29P0dL/LYndMGvYenWPteedq1d9Kbjyi/PMtZE2Jf/DvlELb4q1MICVeEFhZxTTHpwbUnvktaq3mcXcQLA== 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=6yla/+pSCfa0rrRxQqCg9KfA1XNBLG6Za30j0dgUlPQ=; b=vp+ULe1MfJKbsTbp7VnqAzfgHP2XI28gtAd3/Y4aUTVrPQoGKY5iykGUEE7L6EV0PEKlQX3buTH29+cXxwfUobSq8/q3+BUQ6KWEkeUhfvQqms9rgFtvnKCMZEhbdIwyCrVvBXdCndtP0wikwhhB3METyfBbVM15iYdof17cz3Q1WY+Bs0Qal8FSQO/JB8h24eqFXqCsy1rtQqPbGsVkAV/ahawAsaCjoQFbzKwV+Kpi6WXZeRcYC38YVTkjeKy7hwbQMWkob/1zbHQDvhl6XBzsE0Af5+ES3b13qPJmdZDEidf7FRgOeKF5gfJBEEb6v3IRtNJQ0GnZY40lPtamvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org 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=6yla/+pSCfa0rrRxQqCg9KfA1XNBLG6Za30j0dgUlPQ=; b=fABOCJJ00v9qO/gnVg45nx6rZK9sb+TBuh+27CtmCi2M5S52dYrHRUkwR2jQlNm30NFv+rbe4x8HuaS1sTp1WPZWLeg+ZiOEF/j0P3nsxMY1URG/XdibHo99nzE8G0HDK281zmP0Kyv76zm8IfDt6qOD7ukDRpKGIgo/sDZQzveH+a+lWT+AxylDD2VVd3UZ9r4CLkW2fvbcz5anV4nWVN4Hv8+6qLrKn5IVce8mTwbt29cIWuzBnryTNL678ecKfRwwoTA1iKFaNg3gVAtI8QWMuMz+5NUQo8+hCTqfy0Mow1mjWPwdfIIGU0xrMAKBu6vy4TiNuu0Xu5Xl6dAZLQ== Received: from MN2PR08CA0026.namprd08.prod.outlook.com (2603:10b6:208:239::31) by CH2PR12MB4280.namprd12.prod.outlook.com (2603:10b6:610:ac::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.14; Sat, 7 Dec 2024 08:09:03 +0000 Received: from BL02EPF00021F6F.namprd02.prod.outlook.com (2603:10b6:208:239:cafe::b6) by MN2PR08CA0026.outlook.office365.com (2603:10b6:208:239::31) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.14 via Frontend Transport; Sat, 7 Dec 2024 08:09:03 +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 BL02EPF00021F6F.mail.protection.outlook.com (10.167.249.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Sat, 7 Dec 2024 08:09:03 +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; Sat, 7 Dec 2024 00:08:55 -0800 Received: from nvidia.com (10.126.231.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.4; Sat, 7 Dec 2024 00:08:53 -0800 From: Xueming Li To: Bing Zhao CC: Xueming Li , Dariusz Sosnowski , dpdk stable Subject: patch 'net/mlx5: fix shared Rx queue control release' has been queued to stable release 23.11.3 Date: Sat, 7 Dec 2024 16:00:42 +0800 Message-ID: <20241207080055.488538-85-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241207080055.488538-1-xuemingl@nvidia.com> References: <20241111062847.216344-122-xuemingl@nvidia.com> <20241207080055.488538-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.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: BL02EPF00021F6F:EE_|CH2PR12MB4280:EE_ X-MS-Office365-Filtering-Correlation-Id: eff01a18-21d2-4385-a231-08dd169669d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?K3GTIibp9NSZGkg/5vBnXscAPmPUls378mYXSfxrwhwJgj4UtN8plHTHFx9r?= =?us-ascii?Q?FwF87zbSGgEMJEDjwYhFYjPeftRB0L7w804gXTxGgfv5WYB1WOt6k4gATRG5?= =?us-ascii?Q?t1cO54ggb1lVArKPFNHuFpORM6/K2AoZO7Oz0s6Di5To8NgHRiQp8ekWU7Iy?= =?us-ascii?Q?P6Z+O5Yl81g7j7pKOJLGB/V2nI//49WBMM5vaMEA6yHMBJQQ+GX3vKvSqy60?= =?us-ascii?Q?/FIcsiVFXQabYTCkGBoiLkdXK4WrR/RMnk0O9SDO4MpG/CjIt63LxlsttWtg?= =?us-ascii?Q?wXWK92qWK4fP6YDaALWkeOg4I0Fi1Rpe89xqMTyFR+nWG+hK3u80V0g0z4jy?= =?us-ascii?Q?vazNDXuVO0WB0poqk97kwxRq11b+mUmM/3iFPQQeWSEqpuknRZQjHxnRdQ95?= =?us-ascii?Q?m1u0PAjyulOAtwH5T6HJzNsQTk9vA1P2Bcx6Ujei9Nsadr/qKwElhxujSkh7?= =?us-ascii?Q?EmsBmtTEdwonmdmSzlGO2AFgAVy2K7TU78MD0G5pUMtMpC8y7mFKM4+tQWqB?= =?us-ascii?Q?sAA+sOEu7tTZLY36yh6f0wZQ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-ascii?Q?62QwXsM+4Z4AhvvJ03Qf6cb7N2xZv70i?= 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)(82310400026)(1800799024)(36860700013)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2024 08:09:03.0986 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eff01a18-21d2-4385-a231-08dd169669d3 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: BL02EPF00021F6F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4280 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.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/10/24. 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://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=b4da83237f4577c1b8e97f97e5f9a9b017726270 Thanks. Xueming Li --- >From b4da83237f4577c1b8e97f97e5f9a9b017726270 Mon Sep 17 00:00:00 2001 From: Bing Zhao Date: Mon, 25 Nov 2024 19:23:18 +0200 Subject: [PATCH] net/mlx5: fix shared Rx queue control release Cc: Xueming Li [ upstream commit f8f294c66b5ff6ee89590cce56a3d733513ff9a0 ] Correct the reference counting and condition checking for shared Rx queue control structures. This fix ensures proper memory management during port stop and device close stages. The changes move the control structure reference count decrease outside the owners list empty condition, and adjust the reference count check to subtract first, then evaluate. This prevents potential crashes during port restart by ensuring shared Rx queues' control structures are properly freed. Fixes: 3c9a82fa6edc ("net/mlx5: fix Rx queue control management") Signed-off-by: Bing Zhao Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5_rx.h | 2 +- drivers/net/mlx5/mlx5_rxq.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h index f78fae26d3..db912adf2a 100644 --- a/drivers/net/mlx5/mlx5_rx.h +++ b/drivers/net/mlx5/mlx5_rx.h @@ -157,7 +157,7 @@ struct mlx5_rxq_ctrl { bool is_hairpin; /* Whether RxQ type is Hairpin. */ unsigned int socket; /* CPU socket ID for allocations. */ LIST_ENTRY(mlx5_rxq_ctrl) share_entry; /* Entry in shared RXQ list. */ - RTE_ATOMIC(uint32_t) ctrl_ref; /* Reference counter. */ + RTE_ATOMIC(int32_t) ctrl_ref; /* Reference counter. */ uint32_t share_group; /* Group ID of shared RXQ. */ uint16_t share_qid; /* Shared RxQ ID in group. */ unsigned int started:1; /* Whether (shared) RXQ has been started. */ diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 6d28bcb57c..dccfc4eb36 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2269,6 +2269,7 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx) struct mlx5_rxq_priv *rxq; struct mlx5_rxq_ctrl *rxq_ctrl; uint32_t refcnt; + int32_t ctrl_ref; if (priv->rxq_privs == NULL) return 0; @@ -2294,15 +2295,14 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx) } } else { /* Refcnt zero, closing device. */ LIST_REMOVE(rxq, owner_entry); - if (LIST_EMPTY(&rxq_ctrl->owners)) { + ctrl_ref = rte_atomic_fetch_sub_explicit(&rxq_ctrl->ctrl_ref, 1, + rte_memory_order_relaxed) - 1; + if (ctrl_ref == 1 && LIST_EMPTY(&rxq_ctrl->owners)) { if (!rxq_ctrl->is_hairpin) mlx5_mr_btree_free (&rxq_ctrl->rxq.mr_ctrl.cache_bh); - if (rte_atomic_fetch_sub_explicit(&rxq_ctrl->ctrl_ref, 1, - rte_memory_order_relaxed) == 1) { - LIST_REMOVE(rxq_ctrl, share_entry); - mlx5_free(rxq_ctrl); - } + LIST_REMOVE(rxq_ctrl, share_entry); + mlx5_free(rxq_ctrl); } dev->data->rx_queues[idx] = NULL; mlx5_free(rxq); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-12-06 23:26:46.895414505 +0800 +++ 0084-net-mlx5-fix-shared-Rx-queue-control-release.patch 2024-12-06 23:26:44.093044826 +0800 @@ -1 +1 @@ -From f8f294c66b5ff6ee89590cce56a3d733513ff9a0 Mon Sep 17 00:00:00 2001 +From b4da83237f4577c1b8e97f97e5f9a9b017726270 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit f8f294c66b5ff6ee89590cce56a3d733513ff9a0 ] @@ -18 +20,0 @@ -Cc: stable@dpdk.org @@ -28 +30 @@ -index da7c448948..1a6f174c40 100644 +index f78fae26d3..db912adf2a 100644 @@ -41 +43 @@ -index 0737f60272..126b1970e6 100644 +index 6d28bcb57c..dccfc4eb36 100644 @@ -44 +46 @@ -@@ -2268,6 +2268,7 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx) +@@ -2269,6 +2269,7 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx) @@ -52 +54 @@ -@@ -2293,15 +2294,14 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx) +@@ -2294,15 +2295,14 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx)