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 CFD88454E9 for ; Tue, 25 Jun 2024 02:03:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CBE2A42799; Tue, 25 Jun 2024 02:03:09 +0200 (CEST) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mails.dpdk.org (Postfix) with ESMTP id 0759442799 for ; Tue, 25 Jun 2024 02:03:09 +0200 (CEST) Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-35f2c9e23d3so3666128f8f.0 for ; Mon, 24 Jun 2024 17:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719273788; x=1719878588; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WWd1euiD3UeBrLFUHgMoCzW4omBvO8UJlUpz75FkWWM=; b=dnqvDTYD7SiFw09MqvKdrNYQQ/XU+ayukM8kupa4Mi7X9YUFABnTzPt2A/BqSf0G08 B+mEovnQ+BQk9FNL75naPx88Lk7/oe+RLdenjnqDJ6uydAiBCB13VXPeVlBAcvnK9F0P L03jgcL1s8g1Ak9TmHrO7mZibGzmLNGJNHFcpwFc7q2A2TezmcAa1ZunAw6c6FZE7S0X 6WNT6e7A9xbYUXcmPtDnkog3KmWcjcyD8dztCBxYuFy4NOawsY8uCEY4AiddPKGH2hBU +LxtOpYP/oye2PJIFeqeycoofzQYz1/Fv/MWUmXVdwnIsndkGgXwyjn26Q0NZd5DSbfg obCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719273788; x=1719878588; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WWd1euiD3UeBrLFUHgMoCzW4omBvO8UJlUpz75FkWWM=; b=bvCONAAeEqyPgpd1Jv4iL8OgdgjzcuvZz7GWVPNlVXcms/aBZi2Ku+gtH968iITlhK 2tdXdOJKCsJDbSqz/kKiCRhLlPMGZ8sBVPU0lNYh7oCfJ4iqltqZbw41fNbnZSUe8PJy WHDCdKNXkQrofl88bIUB52SzAorJIuWpzx6sv9KjRYzJ4kNBIVF+7yApzzm11UBub5GK tbRcnipnWm4R/89RPjv1AnFB6MyQw7LUZiwQijfFPVkkcs/ntqYdDzR8UkUz5eFeaY9h 6qq9lSleak9jcObCKW/7nfCPOu0fPU1Qa1E2e13N/XKWpNS1JR0RSoeayrr1Guv9Adi9 w40g== X-Forwarded-Encrypted: i=1; AJvYcCUzL4Pm0b8m6qpr4qp1Y3c2kMhCwsU8tvPPssdAjXoabM1JpECtd/4m+zFfW6uLxJD7Kg80TxoKBtvF1QlzToY= X-Gm-Message-State: AOJu0Yww0OSmy2G/BFm3QI41tmCb1XoL236pRzr7lqBTQZMPmdrK/h45 uDtJnHBf/UAU8uV6uBYaZgGn8r51whXsvC0NbTTirndUzUsOcJoR X-Google-Smtp-Source: AGHT+IGGv8MNp9HTSDFTgAQmcmZp75ERdrb9LIhMOCgmTgkpvcgm+M1yDOPUNBXNSpusiIzYzAvevQ== X-Received: by 2002:adf:f68c:0:b0:362:23d5:3928 with SMTP id ffacd0b85a97d-366e3293282mr5622497f8f.17.1719273788574; Mon, 24 Jun 2024 17:03:08 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:7aef:1aaa:3dff:d546]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4247d2122e7sm194074035e9.40.2024.06.24.17.03.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 17:03:07 -0700 (PDT) From: luca.boccassi@gmail.com To: Alexander Kozyrev Cc: Dariusz Sosnowski , dpdk stable Subject: patch 'net/mlx5: break flow resource release loop' has been queued to stable release 22.11.6 Date: Tue, 25 Jun 2024 00:59:00 +0100 Message-Id: <20240624235907.885628-74-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240624235907.885628-1-luca.boccassi@gmail.com> References: <20240624235907.885628-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 22.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/27/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://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/68b68c76e1f2f9112d5016c732a00e97a0e5460f Thanks. Luca Boccassi --- >From 68b68c76e1f2f9112d5016c732a00e97a0e5460f Mon Sep 17 00:00:00 2001 From: Alexander Kozyrev Date: Thu, 30 May 2024 00:46:32 +0300 Subject: [PATCH] net/mlx5: break flow resource release loop [ upstream commit 4fcb7a05e38172aed60f87a6287bb2ee3d9828fd ] 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: d1559d66ed2d ("net/mlx5: add table management") Signed-off-by: Alexander Kozyrev Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5_flow_hw.c | 44 +++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 5333495a59..c902b35f0b 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -3407,7 +3407,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 using"); + "table is in use"); } LIST_REMOVE(table, next); for (i = 0; i < table->nb_item_templates; i++) @@ -4660,7 +4660,7 @@ flow_hw_actions_template_destroy(struct rte_eth_dev *dev __rte_unused, return rte_flow_error_set(error, EBUSY, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, - "action template in using"); + "action template is in use"); } LIST_REMOVE(template, next); if (template->tmpl) @@ -5013,7 +5013,7 @@ flow_hw_pattern_template_destroy(struct rte_eth_dev *dev __rte_unused, return rte_flow_error_set(error, EBUSY, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, - "item template in using"); + "item template is in use"); } LIST_REMOVE(template, next); claim_zero(mlx5dr_match_template_destroy(template->mt)); @@ -7458,9 +7458,9 @@ 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 rte_flow_template_table *tbl, *temp_tbl; + struct rte_flow_pattern_template *it, *temp_it; + struct rte_flow_actions_template *at, *temp_at; uint32_t i; if (!priv->dr_ctx) @@ -7470,21 +7470,29 @@ flow_hw_resource_release(struct rte_eth_dev *dev) flow_hw_cleanup_ctrl_fdb_tables(dev); flow_hw_cleanup_tx_repr_tagging(dev); flow_hw_cleanup_ctrl_rx_tables(dev); - while (!LIST_EMPTY(&priv->flow_hw_tbl_ongo)) { - tbl = LIST_FIRST(&priv->flow_hw_tbl_ongo); - flow_hw_table_destroy(dev, tbl, NULL); + 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; } - while (!LIST_EMPTY(&priv->flow_hw_tbl)) { - tbl = LIST_FIRST(&priv->flow_hw_tbl); - flow_hw_table_destroy(dev, tbl, NULL); + 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; } - while (!LIST_EMPTY(&priv->flow_hw_itt)) { - it = LIST_FIRST(&priv->flow_hw_itt); - flow_hw_pattern_template_destroy(dev, it, NULL); + 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; } - while (!LIST_EMPTY(&priv->flow_hw_at)) { - at = LIST_FIRST(&priv->flow_hw_at); - flow_hw_actions_template_destroy(dev, at, NULL); + 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.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-06-25 00:22:17.360608425 +0100 +++ 0074-net-mlx5-break-flow-resource-release-loop.patch 2024-06-25 00:22:13.273187443 +0100 @@ -1 +1 @@ -From 4fcb7a05e38172aed60f87a6287bb2ee3d9828fd Mon Sep 17 00:00:00 2001 +From 68b68c76e1f2f9112d5016c732a00e97a0e5460f Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 4fcb7a05e38172aed60f87a6287bb2ee3d9828fd ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -19,2 +20,2 @@ - drivers/net/mlx5/mlx5_flow_hw.c | 54 +++++++++++++++++++-------------- - 1 file changed, 32 insertions(+), 22 deletions(-) + drivers/net/mlx5/mlx5_flow_hw.c | 44 +++++++++++++++++++-------------- + 1 file changed, 26 insertions(+), 18 deletions(-) @@ -23 +24 @@ -index e8c06387f8..53c6cc5961 100644 +index 5333495a59..c902b35f0b 100644 @@ -26 +27 @@ -@@ -5062,7 +5062,7 @@ flow_hw_table_destroy(struct rte_eth_dev *dev, +@@ -3407,7 +3407,7 @@ flow_hw_table_destroy(struct rte_eth_dev *dev, @@ -30 +31 @@ -- "table in use"); +- "table in using"); @@ -35 +36 @@ -@@ -7362,7 +7362,7 @@ flow_hw_actions_template_destroy(struct rte_eth_dev *dev, +@@ -4660,7 +4660,7 @@ flow_hw_actions_template_destroy(struct rte_eth_dev *dev __rte_unused, @@ -42,3 +43,3 @@ - if (template->action_flags & flag) - mlx5_free_srh_flex_parser(dev); -@@ -7986,7 +7986,7 @@ flow_hw_pattern_template_destroy(struct rte_eth_dev *dev, + LIST_REMOVE(template, next); + if (template->tmpl) +@@ -5013,7 +5013,7 @@ flow_hw_pattern_template_destroy(struct rte_eth_dev *dev __rte_unused, @@ -51,3 +52,3 @@ - if (template->item_flags & (MLX5_FLOW_ITEM_OUTER_IPV6_ROUTING_EXT | - MLX5_FLOW_ITEM_INNER_IPV6_ROUTING_EXT)) -@@ -10787,10 +10787,10 @@ void + LIST_REMOVE(template, next); + claim_zero(mlx5dr_match_template_destroy(template->mt)); +@@ -7458,9 +7458,9 @@ void @@ -60 +60,0 @@ -- struct mlx5_flow_group *grp; @@ -64 +63,0 @@ -+ struct mlx5_flow_group *grp, *temp_grp; @@ -68 +67,2 @@ -@@ -10802,25 +10802,35 @@ flow_hw_resource_release(struct rte_eth_dev *dev) +@@ -7470,21 +7470,29 @@ flow_hw_resource_release(struct rte_eth_dev *dev) + flow_hw_cleanup_ctrl_fdb_tables(dev); @@ -71,10 +70,0 @@ - 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); -+ 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; - }