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 1DF8DA0C47; Mon, 20 Sep 2021 07:23:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9560040DF7; Mon, 20 Sep 2021 07:23:36 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2040.outbound.protection.outlook.com [40.107.244.40]) by mails.dpdk.org (Postfix) with ESMTP id 5BD1D40DF5; Mon, 20 Sep 2021 07:23:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IKSxj2MQgesCiuKWxXjwNtbhFn57uF0Woc0I9YuBG5vCJhkbgpxD3olqWDuLsD51BdU1K3qA+QjGhn23b80xxHyEEhEu2jW4QYJxHJKwbD9cmPd+LvNXjpiZDGr+OTnQ3LQvnn5dVKey19Eez/2iMVrlbb+v4+in5FuM+Or3FOHVlfElD0xcKljxOItI9cXfehnonA+2hCVYFeMMMJhMBBp5cBNItmv5tczF1Pb461LrUQkYmJXGld2I19eG/FoqmzA/JkvCAhtvef0VKwJGOZsCJQS/5hNNwMFIJn989Sct5etLHj6AQr5oMBi76gyhRjDswWx7wzsVlokzmskn7g== 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; bh=ECHLwJrF8lae2CZJr1vQblKF6oO4s+zYzONxfNMhb4A=; b=DqK5Q4oO1NP8x9o6tqeEt270a02q+9QsMy2PzSmcyCVxpUioqKFRi0BjLBm43zVXxZAmEBeZy3RCTYwL8FjWeYXf9gNVIhr0nvG88XXQ96Z86TPdRegLgLWztMt89ivL0ENoTVTPnoOSczScuW/oXTz0pue8HW4yDo8OAaIfYKL+00xmJZ1Ui9kCKIkEIPO7TbnLoqiEMG0MHap/+Shoaolk+dxWSvmBZEvbCXvDv/16hlhSp/qRQ4TpGXLGo6L6M2zWbt3ouobfNmzyP9mffnEy7tmWdTgnVy2UQ32U/AFm9AZv2Pkb+3gdR7GVJKUPsSiiYVPLZdnljs0Pp+L9qA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; 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=ECHLwJrF8lae2CZJr1vQblKF6oO4s+zYzONxfNMhb4A=; b=X4x/LasWl2gk6G/Z7PluPW9db3PlI1CkKNxvU/FxFODKCxdWIiGgEg0/a88uIh7DoJ9YqYAkhWWYfQLczzdG1nVRgJ7Nz5u4KPCPVf/a68yEuixg4JAydlMacUv4VzsLcRIPWRRTF8HM4uMDP63zAnKa0JIQucDXwyv89UUQMmYQlFliO5bIotLL0I/ByFvp2G89iXl4sbULJb0JirbhSKqwaEVvV/aVQ88JtuRhUg0gf7BzqQWgKCCW5EP69Hz2gnIJFwsQfW34+gu4al9oKbwVFTPzWvADl+xVVsz/Og0qcx+fOvNmCRig5f24sUsOZdUYPsPr9F4ibZbovtgIXA== Received: from DM6PR12MB3753.namprd12.prod.outlook.com (2603:10b6:5:1c7::18) by DM6PR12MB4580.namprd12.prod.outlook.com (2603:10b6:5:2a8::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Mon, 20 Sep 2021 05:23:33 +0000 Received: from DM6PR12MB3753.namprd12.prod.outlook.com ([fe80::e550:35a2:96e5:657f]) by DM6PR12MB3753.namprd12.prod.outlook.com ([fe80::e550:35a2:96e5:657f%4]) with mapi id 15.20.4523.018; Mon, 20 Sep 2021 05:23:33 +0000 From: Slava Ovsiienko To: Chengfeng Ye , "david.marchand@redhat.com" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v4] net/mlx5: fix mutex unlock in txpp cleanup Thread-Index: AQHXoJ/bA3ldLy1B+kus7APzEFroQqusfVmw Date: Mon, 20 Sep 2021 05:23:33 +0000 Message-ID: References: <20210903084349.25168-1-cyeaa@connect.ust.hk> In-Reply-To: <20210903084349.25168-1-cyeaa@connect.ust.hk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: connect.ust.hk; dkim=none (message not signed) header.d=none;connect.ust.hk; dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: cad29c0e-cacb-41eb-a5ec-08d97bf6ca6c x-ms-traffictypediagnostic: DM6PR12MB4580: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:298; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ZPHv8WazwKZLgyotWWC+C5EsLSlYL9qV4724ItwLHA2NP/+IUdI/MmpX6KTJdnyax7kOmU5HzIcI/t3SOeX34DALQKSuk5OkGfAy7hmqCSdMk26iTRfno3wSYXM6feJLhlNAFbiL5VKwlIWXDRnaDRHOaxxvi9NygwxSYSV5WI1+YninDMq1IwNNI/QKX7N17HkyDI/Si7doXkoQdeQBSCSNbqMpfdoFH5IIfbayoSmmIM+DTvt1Egs9LVlsXmhlhgpgoNR+8qAEVR67vLthRl/JNRaJ+8We7YP+4CT3EOR4nbA/p0OGuzRjHLZ79hL2Bpqv8+8SnGq6DtnXCL7IakbzGflHPAvmuiu7ITQFPHfvX2d9sKBGgByinW9uAZCPdcEBwfjvrASE4CT5AvDPF9oAv1Jzz8lT86tDuQ7gr8J/0fqIcQuaHNJuKdi/PWZbIRNEJadcv4z4plhdcuPF/vdZmJ8Z0bcvrZ0gKFVHue8EFPLDsg5FiFpF3S0Hk7CJMblcm0pYn9gs1iHhJZK/nGB6K9ZZv8lJ4ZAO3nrE5iRedodsPONExs+XzJeCwLlydpPPJXNe0PvLna03aCou0e2sUppExn5wqjnY6BcCwDMeoiMrzzaDvB5Ij1PGfb8CwrkUlRoBQLo3FrIF4n24+LCDyupGEdEMDE95XsKdB7/aI75vGbv55AR0PV0Snm36/RbSdd4SOjDXlr8D8S72jQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB3753.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(38070700005)(6506007)(64756008)(66446008)(122000001)(66556008)(66476007)(53546011)(186003)(9686003)(66946007)(76116006)(38100700002)(54906003)(26005)(5660300002)(316002)(33656002)(7696005)(8936002)(71200400001)(55016002)(110136005)(4326008)(2906002)(86362001)(83380400001)(52536014)(296002)(8676002)(508600001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?DPgdxdJm2i/TVhCIKKanGS8dGIp8LrGvIH/HkZj3aNb+mZyivboB0Jw2kwG9?= =?us-ascii?Q?iwmACt95MexGo72EyxIfh5NRNma7JjV2jwNwjBto28y2kCZrXC1i9cFW0Zf4?= =?us-ascii?Q?lbw92+79gck/zq8w5sCKOj7WSPzo9UvHeMk/oP8spn7KYiTU6xghALJvkH4D?= =?us-ascii?Q?1f3POL+cpzj5XA5w6HXlE05GidMj3CES7Xk395PIFpunYwFBWHdORDMPcMYG?= =?us-ascii?Q?Bq/sqEG47qqi1hwxtXfFAlztU8lURozolsDi/DePkFBjVp2b7Hd2KHSTStpw?= =?us-ascii?Q?fzSML1oDNbKgW5mukk3q3J1XFq/HTeExjai3/8qRgb5nuOzfe2xQ68x4GZ4E?= =?us-ascii?Q?NU0e4gYto1L1KJfo9x0HKmduwFNpN3Tpd7V1xogl5HbJUOCnPx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Y9bmItiXTXNz57ntgY2jwXLTkZA2in9Y5MqM9e2ppkdPeXKGsfXDC?= =?us-ascii?Q?C/o=3D?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3753.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cad29c0e-cacb-41eb-a5ec-08d97bf6ca6c X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Sep 2021 05:23:33.7175 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: tPgQFHwKXa8d0dldqXvLR7rRDZdX+zgX1bt/KjcKTy+KeV42pRLVnir9Ucy7lxEfOwxsNNDtRcG+3tolHwq6bg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4580 Subject: Re: [dpdk-dev] [PATCH v4] net/mlx5: fix mutex unlock in txpp cleanup 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 Sender: "dev" Hi, Chengfeng Good catch, thank you. Could we polish the commit message a bit? "The lock sh->txpp.mutex was not correctly released on all pathes of cleanup function return, potentially causing the deadlock." With best regards, Slava > in these two branches, which may led to deadlock if the function was > -----Original Message----- > From: dev On Behalf Of Chengfeng Ye > Sent: Friday, September 3, 2021 11:44 > To: david.marchand@redhat.com > Cc: dev@dpdk.org; Chengfeng Ye ; > stable@dpdk.org > Subject: [dpdk-dev] [PATCH v4] net/mlx5: fix mutex unlock in txpp cleanup >=20 > The lock sh->txpp.mutex was not correctly released if the function return= ed > in these two branches, which may led to deadlock if the function was > acquired again. >=20 > Fixes: d133f4cdb7 ("net/mlx5: create clock queue for packet pacing") > Cc: stable@dpdk.org >=20 > Signed-off-by: Chengfeng Ye > --- > drivers/net/mlx5/mlx5_txpp.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_txpp.c b/drivers/net/mlx5/mlx5_txpp.c > index 4f6da9f2d1..0ece788a84 100644 > --- a/drivers/net/mlx5/mlx5_txpp.c > +++ b/drivers/net/mlx5/mlx5_txpp.c > @@ -961,8 +961,12 @@ mlx5_txpp_stop(struct rte_eth_dev *dev) > MLX5_ASSERT(!ret); > RTE_SET_USED(ret); > MLX5_ASSERT(sh->txpp.refcnt); > - if (!sh->txpp.refcnt || --sh->txpp.refcnt) > + if (!sh->txpp.refcnt || --sh->txpp.refcnt) { > + ret =3D pthread_mutex_unlock(&sh->txpp.mutex); > + MLX5_ASSERT(!ret); > + RTE_SET_USED(ret); > return; > + } > /* No references any more, do actual destroy. */ > mlx5_txpp_destroy(sh); > ret =3D pthread_mutex_unlock(&sh->txpp.mutex); > -- > 2.17.1