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 37C7943284; Sat, 4 Nov 2023 05:07:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 24DF94029E; Sat, 4 Nov 2023 05:07:58 +0100 (CET) Received: from out203-205-221-231.mail.qq.com (out203-205-221-231.mail.qq.com [203.205.221.231]) by mails.dpdk.org (Postfix) with ESMTP id 9018B4028B; Sat, 4 Nov 2023 05:07:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1699070864; bh=+eaQM2fI0yIHIqcIg+nhYYD1+pdfn+PPXGMjwU5G1Mo=; h=From:To:Cc:Subject:Date; b=PYF13KmpAeURjOCuYNcYfFpqxk6vqYxB9G5meGjwCYsLX14wxm2+cDd+5vWQr7AZh L0bwfIm0nWSZqZme+3uYnxgEz6LYN0Ii6qtvQ8kGDVKq5C2E34/eg3AKEraMpvoG81 YipcQcumhy76oWqw9Z8MDtE/MTN/Ft04uOequTqU= Received: from liwg-V5320.. ([36.112.73.58]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id 1E21C44B; Sat, 04 Nov 2023 12:07:34 +0800 X-QQ-mid: xmsmtpt1699070854t1z8pknj6 Message-ID: X-QQ-XMAILINFO: MR/iVh5QLeiec3ZlYt2HxGHmndjj8jFJkYdI6iY5d/S/sh/aF78I75cuoFBJKY maE6Jd8VyIlUn06aw4iegL3GVC2gf/lJ2kU1SaHlqrQE5+mp8CEmU9SYWSFGEp5Aqdta6MqiX9yT A+qj8DuZQBSCCzOS28TaguKrFYwzygCNRdZVhpqDYDnRi/gX3vUkIgdEsAcO8hiv0U3x73M85Z2Z akOwRIjbJitUmtyBpzmecK0xKKfkLJT2gSoNFEeySkWTovHV68pJDACHLsAW/GidOzU/FuT98saR iVB+sNNal4SDZyqNxEY50+QbdcCgFNfR18qCRdYhTwxSQ+KRj5wWY8P3l+io4u3dbdVj2HozAfrV FjtADGNn2GLPtIg4YMUNNZnrVdAn8msl3LcE0EeuEkvy9IxGFmW8OMC2f7uXckjvC1kM0XrBXs1Q IkI7eSkqQm37G6qL1Kb/RBHVLuVqNmZ7Z2WmC4UJSXdmwd6gfd/6ZeAoH8ZfwJM9hnB+YwqyM6N0 eY6Z0IZI/BjmAD8sSIfszZS5/zlmydcqAnduqkC2xqwGpCCnAL3vyOlcLoPY/2zU/hI5aZZf3HUg IstVnr1sz0f07U9M5Gvc0wJRIUV+2j5nv5NyxYEc4tMteeNepHdS86OHLupmJ5a/LZovx1/L15gm VRZtIsP/V3nNWu3glM4Ti+BC4xS9LXSjuiZQy8tsTMwHxSlPFUMWJhsZuK6VzZoqbs2MRjPBq+53 2ptBmKMJhpAWyHa0X57jh7x6KFCZIHg/FZ0cx9MG++prJSP9bmP+x1vPwuqjKHaQYIvBUOTxooCm oNUBWhVxiPKu8aZfEO8EqWfauvgR0vqZYyTVQWKOuIxaw6aSgeM1VKKCzzX5EWOrjRWesnYyW5u6 NXlJdpp/HSKmxyilCx/CqT4UOWQydC5O5aGL5Q3TEPS/+axHBsMBK0+CKUjs85aXUtPbscSuU/Jl tAyFFPQllfISkim6CwC7en3Eq74EfNSwlUxOcTn+qNgO1RJAH5vePQYJB7Q0f1wByxAIrH93v2tH PJ2yNbdkEox7Qjs3ujf2wgSentdiQ= X-QQ-XMRINFO: M/715EihBoGSf6IYSX1iLFg= From: Weiguo Li To: akozyrev@nvidia.com Cc: viacheslavo@nvidia.com, dev@dpdk.org, stable@dpdk.org, Weiguo Li Subject: [PATCH] net/mlx5: fix the unlock mismatch issue Date: Sat, 4 Nov 2023 12:07:33 +0800 X-OQ-MSGID: <20231104040733.2051043-1-liwg06@foxmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The 'need_lock' parameter controls whether the function acquires and releases the spinlock, but the first unlock operation occurs regardless of the 'need_lock' parameter. To fix this issue, the spin unlock operation should be invoked within an 'if (need_lock)' block, ensuring that the function only unlocks the spinlock if it has previously been acquired. Fixes: 48fbb0e93d06 ("net/mlx5: support flow meter mark indirect action with HWS") Cc: stable@dpdk.org Signed-off-by: Weiguo Li --- drivers/net/mlx5/mlx5_flow_aso.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c index 3c08da0614..f311443472 100644 --- a/drivers/net/mlx5/mlx5_flow_aso.c +++ b/drivers/net/mlx5/mlx5_flow_aso.c @@ -932,7 +932,8 @@ mlx5_aso_mtr_completion_handle(struct mlx5_aso_sq *sq, bool need_lock) rte_spinlock_lock(&sq->sqsl); max = (uint16_t)(sq->head - sq->tail); if (unlikely(!max)) { - rte_spinlock_unlock(&sq->sqsl); + if (need_lock) + rte_spinlock_unlock(&sq->sqsl); return; } do { -- 2.34.1