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 5821BA034F for ; Wed, 10 Nov 2021 17:58:06 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 484D44068B; Wed, 10 Nov 2021 17:58:06 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 1DB114068B; Wed, 10 Nov 2021 17:58:03 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10164"; a="219607214" X-IronPort-AV: E=Sophos;i="5.87,224,1631602800"; d="scan'208";a="219607214" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2021 08:57:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,224,1631602800"; d="scan'208";a="546184697" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga008.fm.intel.com with ESMTP; 10 Nov 2021 08:57:36 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 10 Nov 2021 08:57:35 -0800 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 10 Nov 2021 08:57:34 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 10 Nov 2021 08:57:34 -0800 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.42) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Wed, 10 Nov 2021 08:57:34 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CJhzPbf0fK+V8k9sGh8OnugIsAyK1J9ZajTcsBmYYrHZI0CzbaucdC/n9/5ksS/keB4stelea7yYZ/aforDA6nOLzlXO/nf6yF4T411o6m8RkEn6iYmHQRxk/b0zOjy3Va7LEUMf07wC6/J+buI2Sz0csM1Np/DXFZf2rFMM4vwbPhILXhmEz0eGhEIAShONreCJU2wsKW50n85Dnl/nbXflTlZ6WUGxQ6/4g39n3MJ5a3vCZxKqfexcmpfvf2hYCKJpyjzG0rQiG8nUOymM9VrifzUNljnfcZ29u8nvFoEhy0uqrp5Y3Mqy6FihtdIy5UbEm9sJLQLrJ2JLPYhKFg== 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=y2oppFIY72gXb0uQCdjLI3PE+IhJhq8YHKdn5Cui9fc=; b=PLvhwgxpGBcinZWUN3/Ihrxyb9aclwzLsP1ZeLNNMk2wluxHDYZi2iOze1+Knjkf2zYwHa2NqKWVbgX/XJI6ObLB0DUCXGDolBAiWjbPofcYqSshZhFUj64G9ZcquGs61Q7mWi06/ToZGs2HpxLPe8g8fDu+DZi4UjWD6NldwDnRolIA/Ed/9TuJrIyNPxfk0husp0OBJXVM8z2Y6QwINrp7wWDGjAkdehwYHAYNFxtlGy3RB1ASfa7D/ybWSu3imPsJ0tTmDuTsTAY8GOeXHxSUwXy3PP5qFpqsEPyjbPfRLK85Js/ytgTNmE8mMrOSTsLpf2SLwi1y8tcnYfFg5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y2oppFIY72gXb0uQCdjLI3PE+IhJhq8YHKdn5Cui9fc=; b=I8HFqw43uRF5z8MOx5hAkOChph9EUKv8Z+znIHzAS4YyyHRH6HGkmyuXV5ulsf/NJ14rqUMkMw9TAix8GGEvmpbkEtPsfQPyUQ54coQVsS9OCrvBowT75UwJwo3kXoQf8g8CE2Mr8ETddqmdpZwYG5Hzu+1d3/EVGLi4FpEUQ6Y= Authentication-Results: connect.ust.hk; dkim=none (message not signed) header.d=none;connect.ust.hk; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by PH0PR11MB4838.namprd11.prod.outlook.com (2603:10b6:510:40::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Wed, 10 Nov 2021 16:57:34 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bd7d:29be:3342:632c]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bd7d:29be:3342:632c%6]) with mapi id 15.20.4669.017; Wed, 10 Nov 2021 16:57:34 +0000 Message-ID: <9543c101-2328-8698-0ea7-a2e754d3146d@intel.com> Date: Wed, 10 Nov 2021 16:57:27 +0000 Subject: Re: [dpdk-dev] [PATCH v5] net/mlx5: fix mutex unlock in txpp cleanup Content-Language: en-US To: Chengfeng Ye , , , , CC: , References: <20211012100204.5569-1-cyeaa@connect.ust.hk> From: Ferruh Yigit X-User: ferruhy In-Reply-To: <20211012100204.5569-1-cyeaa@connect.ust.hk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0382.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18f::9) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 Received: from [192.168.0.206] (37.228.236.146) by LO4P123CA0382.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Wed, 10 Nov 2021 16:57:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1eceaae8-33a8-45bd-604b-08d9a46b30cd X-MS-TrafficTypeDiagnostic: PH0PR11MB4838: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:517; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: leJ8Cq3ap4+/DHdN9EA9gSvikz55sflCx0bamgCcREzYSATMQZBqm9CsO/qjwrD33/jAFgo4l5bHoNy3Cxjwp5XVCyUqteaMwVUar+M0AEUI8s3Rtb863VpigsQn7O8Iw+MQi4lawG9QkqUmf9mjGi8MiyXvv6ZkscAlFg21h8er9VxOHs7PsZUn344yZWplUSqgIG6Tbp6jc+p2YXV7LZL0cQNF245a/mLltW5MssEqBu+jjBHEXKO43ggom+jGhQ9AVaCfgjeKTzBeI4Btups1HFXOrv1sJODZkDbBd0n5hYJhFdQQ9GRkRemoZWO+9ru4G8PA66XNNpclFHrDU5YUKwiD02JCX5Sc/oC5U67YPOmhqqNCK5N5dFsEZ15baF4zOlHR46N+x+nOs09r1ea6xqenMWWbCVArY7B4Yeb9fXqIFiq4hjLp6XGeN1uL3x3N3QUhK7nKAvcYaxZBdBtZcWxeguRg8hKxbQkMni23I8/wppiuu9EtP5htwMC5sOkpa2fFbTFpJRvxa3xX5/XvbTQ32E0vsnBFbQ1gwpLtMHcJpH+on7QlZTQmTprF8kgELEOo56hWYllXQpRGzxnrt2L5R3v8G+uDQuv+SDpJ7puuJG5BL8uET8w3rofOikjDeZWN+pQzPhfgBOmSgybhdvqUayFecoOuydLurbfYvJyob3a9Fb0Ip0EAFV7E2/hVoAyVuX7mLbxUB4K2cw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(8676002)(8936002)(186003)(508600001)(83380400001)(86362001)(4326008)(26005)(53546011)(31696002)(66946007)(296002)(316002)(2906002)(16576012)(5660300002)(82960400001)(2616005)(956004)(6666004)(31686004)(66476007)(66556008)(36756003)(38100700002)(44832011)(6486002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dlBoVWMzNUFiYjBqZndSOXlUZXBYNzNxWWEwZ1dxaVpsS2YxNHhMS2dFRlV6?= =?utf-8?B?RTIwd2IxcjFrdjhMWFdpc3NjRnQzZGpOUlU4MzIyamRvcnZ4YjhkdzRUZkhB?= =?utf-8?B?cXRaK0dRamh2bEdOR0lFS0V1MWkvNlIvVVFLZzZTK0dKY005NDF2azg0WjBZ?= =?utf-8?B?SXBnUXI2Qjllb1B0TkRlQW9vSTBHUzRITjZJNUxmOFN6TUhLQVl0aUNIMGVI?= =?utf-8?B?OThwbGpqV015MGVMNUhCdjlVUUV2Skc4bmUvcjFPWCtvZS8zUjF3YTBqeko1?= =?utf-8?B?L2UyQklWYzdsWGQ3Vmw5OWx6cm4xdEVyMW9hNkdYMEhmOEtyNnpnUVdsbHFU?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4dWIxKzN3VmlyMHdlRm9xRWVLTmd2Uk5FUVFUZHZiWVgwMlpLUnh1?= =?utf-8?Q?6kJMsLcyXbVO063xj6mqGz4=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 1eceaae8-33a8-45bd-604b-08d9a46b30cd X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 16:57:33.9446 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sicm7xv25c6pI5i4IEMTiCr0T50Jgacf7co0bxVI9v226oZ1Bw7kyCvRsYl9gwSjqAc2/cBpMjcYHDyOPQ+dOg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4838 X-OriginatorOrg: intel.com 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 On 10/12/2021 11:02 AM, Chengfeng Ye wrote: > The lock sh->txpp.mutex was not correctly released on one path > of cleanup function return, potentially causing the deadlock. > > Fixes: d133f4cdb7 ("net/mlx5: create clock queue for packet pacing") > Cc: stable@dpdk.org > > Signed-off-by: Chengfeng Ye > --- > drivers/net/mlx5/mlx5_txpp.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > 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 = pthread_mutex_unlock(&sh->txpp.mutex); > + MLX5_ASSERT(!ret); > + RTE_SET_USED(ret); Is this 'RTE_SET_USED()' need to be used multiple times for same variable? This usage looks ugly, I can see why it is used but I wonder if this can be solved differently, what about something like following: #ifdef RTE_LIBRTE_MLX5_DEBUG #define MLX5_ASSERT(exp) RTE_VERIFY(exp) #else #ifdef RTE_ENABLE_ASSERT #define MLX5_ASSERT(exp) RTE_ASSERT(exp) #else #define MLX5_ASSERT(exp) RTE_SET_USED(exp) #endif #endif > return; > + } > /* No references any more, do actual destroy. */ > mlx5_txpp_destroy(sh); > ret = pthread_mutex_unlock(&sh->txpp.mutex); >