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 59C0A44107 for ; Wed, 29 May 2024 23:47:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4F1ED40687; Wed, 29 May 2024 23:47:12 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2065.outbound.protection.outlook.com [40.107.220.65]) by mails.dpdk.org (Postfix) with ESMTP id 83B6740273; Wed, 29 May 2024 23:47:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dT0Y99D5qfvotCNOveNmhSYp1ojvkuCQtsn9rFEBkF78+RdakTxyCssZ74TjlrrLBDu01wekNhF/QIB1suSsXigvhNOpzHPre0iVANjbMgtpddgyNm7Huh14y3o6NMXkDQgwbbZrFyFy1yoJmJKvDGBFPUpz/Rope6DiPgkKV2a3sAhZm2lOzGSgmLwtMpcCzA0Hf1m7Uh7WxXmQEAnGtJRrFVN1wv6bxtG4e1sBBgJTTcwdq3TZ6TLBsVT4Jv2HNXD6ZOlE1pZX5/HmdlZ5UtaJGlJ4SE8yVwP8AH1OCOfbrTu4KiHkR5b2XEZHCBQE/JeqYQMUKCayhchP5YvIUA== 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=k82ioHsbTUDkuiR6hyVvXoSIRenD4laJ/P/vRCLqdJk=; b=H8JUs6KtTR37PSMft04gxYmDgwYiM8pbrgxHj0Q+wj+nWt2IVjAxUVYwV04660HmZKUT5F8E7DnhuNWaBgYOQY29P21pZKzRaT5Ha+qdzUl79yT1IQZVyRvun/JWICAjOdaQiwE/KEVxbjlHrqT2d02+7IpiaAruYCICZg4iC9IGEOP/cHYAGZToTYhgdjYICLMH455kjvGGRQwSxv3c+/GeAYtBVU4JEz21nZ7+o3jOyBXKkIHWDrip+QiKAP2bKQ8SHIQsfDePwcb0vN+aZI1JSwi8bfwbxecqncwm6MXB767rs24zWAzk7rHzbnAXSWTcQwZj+rJBPtcoBKAyqg== 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=k82ioHsbTUDkuiR6hyVvXoSIRenD4laJ/P/vRCLqdJk=; b=h9kQ/B5tBeGnhcONNcP9QjADf6ZEwmdP/BnnUqjD6aIkwuNvsvVMoYXTfKzocGOFDeRKVnDwqIGvVY3+WPGSCb4vcKc9Br8bXXtjqhsqIgB4sQPfp3W0S9wZ4DLkTsweKCOkX/3z8x/hVenbpMPTyXox/QGRe91qF6OAYdThEAfLQuP5yY28+AkSZ5lg4nxJT6QKLioglB+3Key+kk6z4mO+JRtOoG/SbzqluPoLWyDgheXqJ05s4oxe/pDbs1yV39rIcfD+5Bi+yTCzWqSLXDOpUAq3o4/oHjr9PH5z3l7sEbl8x0IQOSMhSuseY2ZnS4XdmLcRQp1IDVyPmVOh6g== Received: from CH5PR04CA0001.namprd04.prod.outlook.com (2603:10b6:610:1f4::6) by DS7PR12MB6237.namprd12.prod.outlook.com (2603:10b6:8:97::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21; Wed, 29 May 2024 21:47:06 +0000 Received: from DS2PEPF00003440.namprd02.prod.outlook.com (2603:10b6:610:1f4:cafe::64) by CH5PR04CA0001.outlook.office365.com (2603:10b6:610:1f4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.19 via Frontend Transport; Wed, 29 May 2024 21:47:06 +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 DS2PEPF00003440.mail.protection.outlook.com (10.167.18.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.15 via Frontend Transport; Wed, 29 May 2024 21:47:05 +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; Wed, 29 May 2024 14:46:52 -0700 Received: from pegasus01.mtr.labs.mlnx (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; Wed, 29 May 2024 14:46:49 -0700 From: Alexander Kozyrev To: CC: , , , , , , , Subject: [PATCH] net/mlx5: break resource release forever loop Date: Thu, 30 May 2024 00:46:32 +0300 Message-ID: <20240529214632.1980988-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 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: DS2PEPF00003440:EE_|DS7PR12MB6237:EE_ X-MS-Office365-Filtering-Correlation-Id: dfbfcca8-dee9-44c9-41ed-08dc8028e20f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|82310400017|36860700004|376005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?5pTKLrorj93SGXzE9o34RInqvLe06LT3mT9Ok9Y+Xr4CukkR5CXrzRB8lugO?= =?us-ascii?Q?VXj2L88I4B8SdpktaunO7XkR5+lOU/wsvG58PpwvXNRBYMQuRjC0QJB7F7Z7?= =?us-ascii?Q?LrIxNY1uqZ6OWWNaVCEzKsWCdXJzFdPGnHBvgRAnZynfUn3hQo/bO5WqRVzV?= =?us-ascii?Q?/aVwjpNjqvl6zxNhoFRvIRPEC0zqrwAM+/3xtTr/IUBpphHcylW5PoW8r4Py?= =?us-ascii?Q?u2T2UTn3V4OlRw7ooobfVuglYDdiwHQTtNuJxlFXMrp5pf22AiJDZWRBTjyW?= =?us-ascii?Q?WA2iS2m4u2RT+jSmJ+QdM8SYnATCknXRugy10v2VmLUUwpx452R8d6u0ctFp?= =?us-ascii?Q?aEKx/Z6vOoG9V0UcTQhzowf/a2B3wNAFSW+mLjqmeuIkrwnivWqaKPvmT2VB?= =?us-ascii?Q?W6ios7L+xgeA/xDtmOShblD2kFPMbp/D/3UMi7PFOHd8awkBVSMEiUUbBqz2?= =?us-ascii?Q?pa2ZE0GZg0doFI/ncIS4jcliySm00N/vOjW2xi8Guz1T2WtI4oc2iFaQvxDa?= =?us-ascii?Q?bwAvqw9NBMRlbY2mdukJmHM4FY/UmroyjHGjaoetwk2RrthDsp/kprbVjLPF?= =?us-ascii?Q?7WAPwkdMBqicUjGJ+D6qMF/jRtBULFHwPI9xna+8AVxDuHiLRvaKNawILcLO?= =?us-ascii?Q?A2V2GNsODOaT0OFlPM6Y8jBgrMYbgEHP50NTPNXkJ9A+MSN6Bk6KupRkNl9+?= =?us-ascii?Q?9H95oPziMnieovHa+U12ZL7+FwGx2KPO7MP5nIiSUh8rQvMIs4+d8hVu62NN?= =?us-ascii?Q?8Pt4UCXmyyJtyhn1YrTjLCseiqiayB0F4pSr2cGe0dJsUKUuVow1FJ/OvvHJ?= =?us-ascii?Q?2AQSZZ9lGDNxvy9JFZU6M38IdlxqyLTHKJhG+LBK+3Wd4h7KRSm+gnxeVaYy?= =?us-ascii?Q?6CEvs+tJ/KrQhKQtzCiIzCeF7D94Q2YM5RtZ7Z+nih16PB+/ND8EVr7Apkrw?= =?us-ascii?Q?EtuQlRzMGJv9qS5on2HWY7AtKxxsN0dMW3AQ1kDNb9702rIrEB53qeSPAYPJ?= =?us-ascii?Q?F70ibaZHsbPaTPhpiL0ybqDRmvJeCeqHPxtdVGsPYm4YKLqEY8y/5gazDSsU?= =?us-ascii?Q?NMwqanYQsghnWkrdXYKu53p3SjhD1tYlMYhbxDsgecdEa6a1vzHGKKhYTrC8?= =?us-ascii?Q?OLDspDAZg5MFxeDRGnHEG8yY52J42OfBx3YCcxUTJ1OoxDSIiOXVQw5+3wZT?= =?us-ascii?Q?Etsw0QUHXwFSnb2y3ymzTBfGfaTlewHXlQACcZsFObiSOh6EwxihwxJ2ZCfq?= =?us-ascii?Q?z+/doDbkQ08lutDGJxS/axKtPkwQ6Vv0kMAYx4xWUxO4V1L//hvavo2iDCZL?= =?us-ascii?Q?gVmk835uwOPTy3rOOJ0QgWXH/4XbNedqAM0ZicwBrQ2rjfTFkTsPUwS2Lt8H?= =?us-ascii?Q?kkW292InJRfu9xn0y7iGCHj9mjnq?= 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:(13230031)(1800799015)(82310400017)(36860700004)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2024 21:47:05.7903 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dfbfcca8-dee9-44c9-41ed-08dc8028e20f 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: DS2PEPF00003440.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6237 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 There is a loop inside the flow_hw_resource_release() function that tries to free all the template patterns and tables until they are successfully released. But some of the tables may be still in use in case of the ungraceful application termination. Which causes the forever loop in the app on the exit. Don't wait for the tables release and try them to free only once and proceed with the exit. Fixes: d1559d66ed ("net/mlx5: add table management") Signed-off-by: Alexander Kozyrev Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5_flow_hw.c | 62 +++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 68c5a36bbb..c68cde14e1 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -5048,7 +5048,7 @@ flow_hw_table_destroy(struct rte_eth_dev *dev, return rte_flow_error_set(error, EBUSY, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, - "table in use"); + "table is in use"); } LIST_REMOVE(table, next); for (i = 0; i < table->nb_item_templates; i++) @@ -7342,7 +7342,7 @@ flow_hw_actions_template_destroy(struct rte_eth_dev *dev, return rte_flow_error_set(error, EBUSY, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, - "action template in using"); + "action template is in use"); } if (template->action_flags & flag) mlx5_free_srh_flex_parser(dev); @@ -7966,7 +7966,7 @@ flow_hw_pattern_template_destroy(struct rte_eth_dev *dev, return rte_flow_error_set(error, EBUSY, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, - "item template in using"); + "item template is in use"); } if (template->item_flags & (MLX5_FLOW_ITEM_OUTER_IPV6_ROUTING_EXT | MLX5_FLOW_ITEM_INNER_IPV6_ROUTING_EXT)) @@ -10767,10 +10767,10 @@ void flow_hw_resource_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; - struct rte_flow_template_table *tbl; - struct rte_flow_pattern_template *it; - struct rte_flow_actions_template *at; - struct mlx5_flow_group *grp; + struct rte_flow_template_table *tbl, *temp_tbl; + struct rte_flow_pattern_template *it, *temp_it; + struct rte_flow_actions_template *at, *temp_at; + struct mlx5_flow_group *grp, *temp_grp; uint32_t i; if (!priv->dr_ctx) @@ -10782,25 +10782,35 @@ flow_hw_resource_release(struct rte_eth_dev *dev) flow_hw_cleanup_tx_repr_tagging(dev); flow_hw_cleanup_ctrl_rx_tables(dev); flow_hw_action_template_drop_release(dev); - while (!LIST_EMPTY(&priv->flow_hw_grp)) { - grp = LIST_FIRST(&priv->flow_hw_grp); - flow_hw_group_unset_miss_group(dev, grp, NULL); - } - while (!LIST_EMPTY(&priv->flow_hw_tbl_ongo)) { - tbl = LIST_FIRST(&priv->flow_hw_tbl_ongo); - flow_hw_table_destroy(dev, tbl, NULL); - } - while (!LIST_EMPTY(&priv->flow_hw_tbl)) { - tbl = LIST_FIRST(&priv->flow_hw_tbl); - flow_hw_table_destroy(dev, tbl, NULL); - } - while (!LIST_EMPTY(&priv->flow_hw_itt)) { - it = LIST_FIRST(&priv->flow_hw_itt); - flow_hw_pattern_template_destroy(dev, it, NULL); - } - while (!LIST_EMPTY(&priv->flow_hw_at)) { - at = LIST_FIRST(&priv->flow_hw_at); - flow_hw_actions_template_destroy(dev, at, NULL); + grp = LIST_FIRST(&priv->flow_hw_grp); + while (grp) { + temp_grp = LIST_NEXT(grp, next); + claim_zero(flow_hw_group_unset_miss_group(dev, grp, NULL)); + grp = temp_grp; + } + tbl = LIST_FIRST(&priv->flow_hw_tbl_ongo); + while (tbl) { + temp_tbl = LIST_NEXT(tbl, next); + claim_zero(flow_hw_table_destroy(dev, tbl, NULL)); + tbl = temp_tbl; + } + tbl = LIST_FIRST(&priv->flow_hw_tbl); + while (tbl) { + temp_tbl = LIST_NEXT(tbl, next); + claim_zero(flow_hw_table_destroy(dev, tbl, NULL)); + tbl = temp_tbl; + } + it = LIST_FIRST(&priv->flow_hw_itt); + while (it) { + temp_it = LIST_NEXT(it, next); + claim_zero(flow_hw_pattern_template_destroy(dev, it, NULL)); + it = temp_it; + } + at = LIST_FIRST(&priv->flow_hw_at); + while (at) { + temp_at = LIST_NEXT(at, next); + claim_zero(flow_hw_actions_template_destroy(dev, at, NULL)); + at = temp_at; } for (i = 0; i < MLX5_HW_ACTION_FLAG_MAX; i++) { if (priv->hw_drop[i]) -- 2.18.2