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 E433F468E4 for ; Thu, 12 Jun 2025 23:08:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE17D42DD9; Thu, 12 Jun 2025 23:08:51 +0200 (CEST) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mails.dpdk.org (Postfix) with ESMTP id 0E7A142DD9 for ; Thu, 12 Jun 2025 23:08:51 +0200 (CEST) Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-450cb2ddd46so8117845e9.2 for ; Thu, 12 Jun 2025 14:08:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749762530; x=1750367330; 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=Ej2jXqqQQki+1Q59/s8DmVB+XH2d60sdkotTXqACw/w=; b=ahEVpbiNs5Yjx0wt7h/VKgaef5hxfSYnZJ27RaSWPRo6MCxim8cCityt9CtcFq3VdR gyIR0gHQryWvrY1p/ywNd2W52YzU3vUVuGSPkvtFdkkWFa4QmdW9jjL72BNcnCG8P2d8 MwCh2CkRK3uUvJeD7rMX6fWeefOPm+ApFf9jfh49DV7fOiT0c9zNia2C4nTHWvRvKHdr 9G891IilCdolc7uO3CAd+cNYXGUFQbQLwvhXxkaNA/i+dN/K6JKvLipjYuwPMwAd0e90 LaMZMzopgdIcrHtVp9+WH39MXWp62SbnBX1mW5gHxNmo3BR2TWySWK558tHDaF3vWx5U EFKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749762530; x=1750367330; 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=Ej2jXqqQQki+1Q59/s8DmVB+XH2d60sdkotTXqACw/w=; b=tJNNUdx089Pps0G9QwC5+WGat/voVgnOO750uclECifpE149GR3BijAvwMwJEQbJbc 3cnW7r//f+uJOKhAu0ilsEMzYL/FBPdJoOuKDNcKLiKBSf7Ky0CNfiF4qEJ+X1vfdPq4 It/xZ3nVvffiebsrfeSRSvZEws1kMb0I4utg1hlV0FI+LJnmoXF3fhEitlGEmhZx+UGc jbZyHeY5whc5cMoF7AXOsUmlW206kGHuhILRvo2IFTLcu5+fLnMGscKgzMc+5E5arl/t UEgMnN004oylyBBgkb4QBCPIv3TEPWPuboPTSFPNo41t0S6gxf4rZemMYerXQZnLirhw zuVQ== X-Forwarded-Encrypted: i=1; AJvYcCVrf0re5BcidW9uMFp/3e4Hf0Ikxbc8WIdK+XdgBqTxCeGO6g/0qZ0SnK/u9nGqdL7Ej3sWkhA=@dpdk.org X-Gm-Message-State: AOJu0Yw1uEW6KvEUxn0vHD3ffwV+FAb80xWfvLP0rnvUXrXAs89qYNjH mKDW3pVUSHt4NXuI8l1nOe1nYoMuneTWV/THudbCKrSkcpFnZnX10Pr5 X-Gm-Gg: ASbGncuk1Jwj8rTOG2LzNyVezZn0Pra2yjCwSoVDAB9QLLElr+PyRGv7pKjY0XPZPsc O+3ebIsuwixvOU56dsJUMeusQA7KDNmmOkTLeHeRDicDuzkJ1dcRFhmwAR1VB2N9Ti1s3/WEN6I Td7nIkFplWjLx8EcX8QoDPEzeZnKkf/wxuWWR6WnZ+HgdG7NwQOnUxSBwmnXbLb+Dlfl1R6h6Hr Q8e03DFVDNv1mF7eqLbxcQ4S+ls9N2FXW41dTGeS2nJzRDYnEFMEeyAE3J3dgMaheb+cC9Cjscy 6o3umyNS+BFRmtxvWlQJS3OjlSV+hqVwlibCDIPb8CY9OnJIXilgtvb7aX55Q0Z5KdTpqAU0skX lp6U= X-Google-Smtp-Source: AGHT+IFnIAXHCgehgm7WT/DaA1yvdht6bGhn/7lRTZh3EW4EvUmZ518L5LTmGVAamz2tBK66fJlS+g== X-Received: by 2002:a05:600c:621b:b0:43c:fceb:91a with SMTP id 5b1f17b1804b1-45334b06360mr4499185e9.11.1749762530227; Thu, 12 Jun 2025 14:08:50 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:f2df:571a:ae4c:bef2]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-4532e13c187sm32058525e9.23.2025.06.12.14.08.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jun 2025 14:08:49 -0700 (PDT) From: luca.boccassi@gmail.com To: Dariusz Sosnowski Cc: Bing Zhao , dpdk stable Subject: patch 'net/mlx5: fix counter service cleanup on init failure' has been queued to stable release 22.11.9 Date: Thu, 12 Jun 2025 22:06:38 +0100 Message-ID: <20250612210733.2506558-21-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250612210733.2506558-1-luca.boccassi@gmail.com> References: <20250612210733.2506558-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.9 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/14/25. 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/588d9e7904d701cda20cdc2d3d75b41d05da5228 Thanks. Luca Boccassi --- >From 588d9e7904d701cda20cdc2d3d75b41d05da5228 Mon Sep 17 00:00:00 2001 From: Dariusz Sosnowski Date: Fri, 25 Apr 2025 21:41:05 +0200 Subject: [PATCH] net/mlx5: fix counter service cleanup on init failure [ upstream commit 4d78ac5f3ef7c1ae3ae194423428c0f96e9994bc ] When initializing the counter pool in mlx5_hws_cnt_pool_create(), the background service thread was started before pool creation completed. If pool creation failed after the thread was started, the error handling path did not clean up the running thread, as it assumed no resources needed cleanup if the pool was not created. This patch moves the creation of the background service thread to the end of the counter pool initialization, ensuring resources are released in the correct order during rollback. It also adds a missing "goto error" in case the service thread initialization fails. Fixes: 4d368e1da3a4 ("net/mlx5: support flow counter action for HWS") Signed-off-by: Dariusz Sosnowski Acked-by: Bing Zhao --- drivers/net/mlx5/mlx5_hws_cnt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx5/mlx5_hws_cnt.c b/drivers/net/mlx5/mlx5_hws_cnt.c index cec0710efe..6e4b093bd8 100644 --- a/drivers/net/mlx5/mlx5_hws_cnt.c +++ b/drivers/net/mlx5/mlx5_hws_cnt.c @@ -662,12 +662,6 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev, int ret = 0; size_t sz; - /* init cnt service if not. */ - if (priv->sh->cnt_svc == NULL) { - ret = mlx5_hws_cnt_svc_init(priv->sh); - if (ret != 0) - goto error; - } cparam.fetch_sz = HWS_CNT_CACHE_FETCH_DEFAULT; cparam.preload_sz = HWS_CNT_CACHE_PRELOAD_DEFAULT; cparam.q_num = nb_queue; @@ -703,6 +697,12 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev, ret = mlx5_hws_cnt_pool_action_create(priv, cpool); if (ret != 0) goto error; + /* init cnt service if not. */ + if (priv->sh->cnt_svc == NULL) { + ret = mlx5_hws_cnt_svc_init(priv->sh); + if (ret != 0) + goto error; + } priv->sh->cnt_svc->refcnt++; cpool->priv = priv; rte_spinlock_lock(&priv->sh->cpool_lock); -- 2.47.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-06-12 22:06:24.680718098 +0100 +++ 0021-net-mlx5-fix-counter-service-cleanup-on-init-failure.patch 2025-06-12 22:06:23.822043624 +0100 @@ -1 +1 @@ -From 4d78ac5f3ef7c1ae3ae194423428c0f96e9994bc Mon Sep 17 00:00:00 2001 +From 588d9e7904d701cda20cdc2d3d75b41d05da5228 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 4d78ac5f3ef7c1ae3ae194423428c0f96e9994bc ] + @@ -18 +19,0 @@ -Cc: stable@dpdk.org @@ -27 +28 @@ -index fd12bcd7ec..5c7c0041aa 100644 +index cec0710efe..6e4b093bd8 100644 @@ -30,4 +31,4 @@ -@@ -729,12 +729,6 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev, - } - goto success; - } +@@ -662,12 +662,6 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev, + int ret = 0; + size_t sz; + @@ -36,2 +37,2 @@ -- ret = mlx5_hws_cnt_svc_init(priv->sh, error); -- if (ret) +- ret = mlx5_hws_cnt_svc_init(priv->sh); +- if (ret != 0) @@ -43,2 +44,3 @@ -@@ -769,6 +763,12 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev, - NULL, "failed to allocate counter actions"); +@@ -703,6 +697,12 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev, + ret = mlx5_hws_cnt_pool_action_create(priv, cpool); + if (ret != 0) @@ -46 +47,0 @@ - } @@ -49,2 +50,2 @@ -+ ret = mlx5_hws_cnt_svc_init(priv->sh, error); -+ if (ret) ++ ret = mlx5_hws_cnt_svc_init(priv->sh); ++ if (ret != 0)