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 BA118A0548 for ; Sun, 28 Nov 2021 16:01:21 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF6704274A; Sun, 28 Nov 2021 16:01:21 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2086.outbound.protection.outlook.com [40.107.96.86]) by mails.dpdk.org (Postfix) with ESMTP id 4A38240E5A for ; Sun, 28 Nov 2021 16:01:20 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TziWSrabnRRYxQ6bw0Hkx5IMJ7caVAaVbt+S6I+KheJ/RD7+jsH/koUjUHOzyLXwdwrPsKenFyD/YKdAxZQ+iuChS1plv22KsQr7KICMP1TNiB5wyTvYoy43xH43iiB8YgS0Y4cE8wL/+27Op70yi9/8zixlf817vTEbgSW1kCRDfqANqxbJK6wZ6PypysHTQ+A2rdUjoc+vnUcQ44xwT/YEf+pSGam9uKCOjGKHEBJdBFPzeXWgOVP+Rh/l7leELaZKZnDliLRRiGK0J+nqKuhSTSfucqEEAz6gGuTNJG6avaCItC2TsK4gkoDIlz+S0rBbhE2AWCTDJf7BxEQ4cQ== 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=BvNEDhueTfN4h8Ji907J3zF5GWxxIgB2trBJyS/xS1Y=; b=gG6fvkilfrbfC6FBmPQfDjIMBz7u0l1nyOiOfCefVWDkc9V4Q4V1qifaxgkBl1HwyHr1rCjNY1tCsjFTR9pOebFH6BVWvp+zNvAE0fjkNuln8AYDYaZPW+HdVcCoLCYz7/A+mTHf23yfQdMmnr9Ti1HtGbjFpY87aQyiayuPRqSYAYyR5i/50hXjiklDss0juGw9jwBb4lw2rrraj0ChXjMQtwzdwdgzgn5osCMcPcf9eDau+WNgIG8YT89SkKNIxIQU1cnSLa+Ez9/B/3kQXzvsf+uzlhmwB22wsOhgIAEQN4SBeMpvM/M3SAq2ioGzXHzkDwpeHCTE3ekvg9ivGg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none 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=BvNEDhueTfN4h8Ji907J3zF5GWxxIgB2trBJyS/xS1Y=; b=BbOVRrWaqBc6eNWDyPhtkb+nyRko9oM5G3Z9g2c2GmLHMHfDUFVofky1iZ2dPyJg3IaPCT6F3rDIqtYmBoCdc2aV/5YDQ8MlFk2Vspd9MQzIpi1rf9SIWRoe19nzpgBZbWZwPDs6vUbod2eQ8Y+CuX2sWboHf277unZUOr4YDUu998rAMq8dMDlUsSeDwmAQx1ebQPK++KEvdP9Q8dhsxf+uUm7qTp0Vkz/HPJCPum5arn1ZvCmDb9r3bXokGLncQS7X+Y1vIBoxgZ0elQ4UIqfcVA4/U+8h5DQ5T0Ec5Cj3tSwX36U4iKOL4MCYMfy9Z0P0p5JSRuaC1F2eQRKMEQ== Received: from BN6PR13CA0067.namprd13.prod.outlook.com (2603:10b6:404:11::29) by MWHPR12MB1312.namprd12.prod.outlook.com (2603:10b6:300:11::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Sun, 28 Nov 2021 15:01:16 +0000 Received: from BN8NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:404:11:cafe::c8) by BN6PR13CA0067.outlook.office365.com (2603:10b6:404:11::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.9 via Frontend Transport; Sun, 28 Nov 2021 15:01:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT064.mail.protection.outlook.com (10.13.176.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4734.22 via Frontend Transport; Sun, 28 Nov 2021 15:01:16 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 28 Nov 2021 15:00:28 +0000 From: Xueming Li To: Chengfeng Ye CC: Luca Boccassi , Viacheslav Ovsiienko , dpdk stable Subject: patch 'net/mlx5: fix mutex unlock in Tx packet pacing cleanup' has been queued to stable release 20.11.4 Date: Sun, 28 Nov 2021 22:53:54 +0800 Message-ID: <20211128145423.3974892-51-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211128145423.3974892-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> <20211128145423.3974892-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4ad2abfb-df96-4881-7e4b-08d9b27fed55 X-MS-TrafficTypeDiagnostic: MWHPR12MB1312: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V1i0f/tl1jLlBNDHGMF/+i+ccdW6monYYddKiSJPz+BX0acTtXR/I160fYpvQLfQaMtGlwE8y8iiGKM5lwg523I1whTGBJj+RV+wTgt0fAj04kj5r7Iu4P7nB/wf8xIkBb+uC+BrV5Jp9dqcuYhkRmoyLH18EIhjB+IzTd5fMf2+CCOSdOc/NY93HFk7mlRH9nCQHWyuZpAKjFFQAs6VdbAXBLcV7pQlDPPEseygQHKR7eUGKx02tLHXxX23cslJBp9mslNsuJ6dXWwwYdBXnw3mxzQP7IND8LNYHr99Lqh4T62407L6WS00X+hHWrfBY2XJBhL04KBwVJMajHig4cqohYwSYEZyJrVSw7s7DCjWK4WZD9XEDuJtlWhmJBEyZBdaCl4Hv7FAO8N4oDfW/FBAxVr6ub/htZIsAEu+aWUwFUOGdQ/SU36YgIOmO0ovu3X2MzpSuNEUdJByoP7BXsIkvxVLirVmw0sqEVt5gsTFw/eM1/DVjWVwaauCcSklL1U3xv0ME7GzwjigzKYhXeZ8mGbI3CWyZM4DKK1lSs8lbbqB96SQ5KGrNQ4Z9fVakZvrI79IZJGzKAb7gAX67MKbs1bzi0xws9cB6ULr+K0DmviGH/MfTh9et6GvM+RHSPhNuWTWb/PXAy6FQ4NAvt+qYVLyX6dE+F2yiY8E61R6TxSAO2I0mHrYXeuOtvaiQv4Jmig+B6GByoJxYOLTpdHRVwug23Q07Zmjd0P7X7zi3cTgdNLvwUnYWjG/fhwh7X/cN2wiMFkqEs5pj2SDeWpzSycsytfia+9JVoG5LbNCcSim/oyaMnyE4XsbNm6vCsCXBmDVZ5XZ78KxCqvfsw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(966005)(26005)(16526019)(86362001)(186003)(1076003)(55016003)(7636003)(82310400004)(47076005)(5660300002)(356005)(8676002)(508600001)(4326008)(336012)(83380400001)(53546011)(6916009)(36756003)(54906003)(70206006)(6666004)(7696005)(36860700001)(2906002)(316002)(6286002)(70586007)(2616005)(426003)(4001150100001)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2021 15:01:16.0360 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ad2abfb-df96-4881-7e4b-08d9b27fed55 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1312 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 20.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/30/21. 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/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/2b0a3cc701098a342c1bcd0af7abc79aab4c62b9 Thanks. Xueming Li --- >From 2b0a3cc701098a342c1bcd0af7abc79aab4c62b9 Mon Sep 17 00:00:00 2001 From: Chengfeng Ye Date: Tue, 16 Nov 2021 06:49:23 -0800 Subject: [PATCH] net/mlx5: fix mutex unlock in Tx packet pacing cleanup Cc: Xueming Li [ upstream commit 1e580ed4b0ff6afb23043f664ce30fe449e40d71 ] The lock sh->txpp.mutex was not correctly released on one path of cleanup function return, potentially causing the deadlock. Fixes: d133f4cdb706 ("net/mlx5: create clock queue for packet pacing") Signed-off-by: Chengfeng Ye Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_txpp.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/net/mlx5/mlx5_txpp.c b/drivers/net/mlx5/mlx5_txpp.c index cf11048160..1f4c1081f5 100644 --- a/drivers/net/mlx5/mlx5_txpp.c +++ b/drivers/net/mlx5/mlx5_txpp.c @@ -1049,7 +1049,6 @@ mlx5_txpp_start(struct rte_eth_dev *dev) struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_dev_ctx_shared *sh = priv->sh; int err = 0; - int ret; if (!priv->config.tx_pp) { /* Packet pacing is not requested for the device. */ @@ -1062,14 +1061,14 @@ mlx5_txpp_start(struct rte_eth_dev *dev) return 0; } if (priv->config.tx_pp > 0) { - ret = rte_mbuf_dynflag_lookup - (RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, NULL); - if (ret < 0) + err = rte_mbuf_dynflag_lookup + (RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, NULL); + /* No flag registered means no service needed. */ + if (err < 0) return 0; + err = 0; } - ret = pthread_mutex_lock(&sh->txpp.mutex); - MLX5_ASSERT(!ret); - RTE_SET_USED(ret); + claim_zero(pthread_mutex_lock(&sh->txpp.mutex)); if (sh->txpp.refcnt) { priv->txpp_en = 1; ++sh->txpp.refcnt; @@ -1083,9 +1082,7 @@ mlx5_txpp_start(struct rte_eth_dev *dev) rte_errno = -err; } } - ret = pthread_mutex_unlock(&sh->txpp.mutex); - MLX5_ASSERT(!ret); - RTE_SET_USED(ret); + claim_zero(pthread_mutex_unlock(&sh->txpp.mutex)); return err; } @@ -1103,24 +1100,21 @@ mlx5_txpp_stop(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_dev_ctx_shared *sh = priv->sh; - int ret; if (!priv->txpp_en) { /* Packet pacing is already disabled for the device. */ return; } priv->txpp_en = 0; - ret = pthread_mutex_lock(&sh->txpp.mutex); - MLX5_ASSERT(!ret); - RTE_SET_USED(ret); + claim_zero(pthread_mutex_lock(&sh->txpp.mutex)); MLX5_ASSERT(sh->txpp.refcnt); - if (!sh->txpp.refcnt || --sh->txpp.refcnt) + if (!sh->txpp.refcnt || --sh->txpp.refcnt) { + claim_zero(pthread_mutex_unlock(&sh->txpp.mutex)); return; + } /* No references any more, do actual destroy. */ mlx5_txpp_destroy(sh); - ret = pthread_mutex_unlock(&sh->txpp.mutex); - MLX5_ASSERT(!ret); - RTE_SET_USED(ret); + claim_zero(pthread_mutex_unlock(&sh->txpp.mutex)); } /* -- 2.34.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-28 22:41:05.911375618 +0800 +++ 0050-net-mlx5-fix-mutex-unlock-in-Tx-packet-pacing-cleanu.patch 2021-11-28 22:41:03.370206742 +0800 @@ -1 +1 @@ -From 1e580ed4b0ff6afb23043f664ce30fe449e40d71 Mon Sep 17 00:00:00 2001 +From 2b0a3cc701098a342c1bcd0af7abc79aab4c62b9 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 1e580ed4b0ff6afb23043f664ce30fe449e40d71 ] @@ -10 +12,0 @@ -Cc: stable@dpdk.org @@ -19 +21 @@ -index 927c327284..af77e91e4c 100644 +index cf11048160..1f4c1081f5 100644 @@ -22 +24 @@ -@@ -890,7 +890,6 @@ mlx5_txpp_start(struct rte_eth_dev *dev) +@@ -1049,7 +1049,6 @@ mlx5_txpp_start(struct rte_eth_dev *dev) @@ -30 +32 @@ -@@ -903,14 +902,14 @@ mlx5_txpp_start(struct rte_eth_dev *dev) +@@ -1062,14 +1061,14 @@ mlx5_txpp_start(struct rte_eth_dev *dev) @@ -51 +53 @@ -@@ -924,9 +923,7 @@ mlx5_txpp_start(struct rte_eth_dev *dev) +@@ -1083,9 +1082,7 @@ mlx5_txpp_start(struct rte_eth_dev *dev) @@ -62 +64 @@ -@@ -944,24 +941,21 @@ mlx5_txpp_stop(struct rte_eth_dev *dev) +@@ -1103,24 +1100,21 @@ mlx5_txpp_stop(struct rte_eth_dev *dev)