From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DA29DA0526; Wed, 22 Jul 2020 17:31:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1A3261C044; Wed, 22 Jul 2020 17:31:00 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2079.outbound.protection.outlook.com [40.107.20.79]) by dpdk.org (Postfix) with ESMTP id 89A581BFD4 for ; Wed, 22 Jul 2020 17:30:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jl4jb68C6MQ++cT3c3QDLI0RF0sr37UOqnANG/NgBtlpLdCcgFLHKxaM9+Cg/2MQBAK/JYxHbbYtUgL+Soo+qK5Z5nhoER1m5w7LKtKm35IPPumElMKIL5uFi4lcxSh6Amm9oijxJyijiJjJi8KBo+1960mlOrfoN3iGwbOzz+IlvGbkLE/XzJZ9TEt0pjQYaLkZn40kN1eySTTOQ5C6ZofW8BKKUxu8OZxMR+G2HzcwekNl+7tDh7TgFclULJK7RBX1MujUpKPWU0vCa7NSQyBf2Q83vhy3zNb1FHDPCA7uLfkMfl58sj7AtFhwh/cH7qMJpre4ZVk+v7VgSvOY0Q== 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-SenderADCheck; bh=yaZjrHBKLUZhmulhM3ldsQlK8q98aEL7pgfeN9NIveg=; b=M/Mgm4m/pugdRq/rzyohXSE3fPdyYraDBBPxErkz0jRGBWqEf1+Chytj+QFNxB3RYIPj7B+PTL0f5L7RDuBQBGUwh37fHIFSvK0KjLH3CLq2Tw8ncdg1b4w1UOmcDOnIEQSKc8Yi+ENKFmWMH9NxhH+mF7vaBCoKMNtCnwdpjr6qwJx3HsT2ec1L29rImnibG9QH8jr7BSbxzKhjtAUP6pbRco2AEvlezg/n0AGQBejRb4twpEmsp6iBNejwCbwSg+yurL+MV5la7iGbAiQOkbscKNIKVIHwSEjVXUv+Y5u/bmt4WadXIFTULk/0bzFzAJ4xze7q54w429XxbzeX5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yaZjrHBKLUZhmulhM3ldsQlK8q98aEL7pgfeN9NIveg=; b=SeXsokoVHtLP7vR/KjmVeAZDvMci1xYOCLOxWaAFU/ThlxmbEO0Ik7EdXTOIS/H6+evto4hu2PYlsmsdjOGiriMeI7uFH4lgWqC8xkaBbpmU4mEjuR1P3bABfMmwK/4XbFDF95gvqqdYuV9eMlSjNf4K7BN5kS+pLKQbdOQGolI= Received: from AM0PR05MB6707.eurprd05.prod.outlook.com (2603:10a6:20b:15b::17) by AM0PR05MB4401.eurprd05.prod.outlook.com (2603:10a6:208:62::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.23; Wed, 22 Jul 2020 15:30:50 +0000 Received: from AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::ecd3:6008:3784:4012]) by AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::ecd3:6008:3784:4012%5]) with mapi id 15.20.3195.028; Wed, 22 Jul 2020 15:30:50 +0000 From: Raslan Darawsheh To: Michael Baum , "dev@dpdk.org" CC: Matan Azrad , Slava Ovsiienko Thread-Topic: [dpdk-dev] [PATCH] net/mlx5: optimize critical section in device free Thread-Index: AQHWX1b/200T1FSRdEGrp93FMyBhoKkTuweg Date: Wed, 22 Jul 2020 15:30:50 +0000 Message-ID: References: <1595333018-7119-1-git-send-email-michaelba@mellanox.com> In-Reply-To: <1595333018-7119-1-git-send-email-michaelba@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=none action=none header.from=mellanox.com; x-originating-ip: [84.242.49.134] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 3839f0d8-16e4-487d-a34c-08d82e543717 x-ms-traffictypediagnostic: AM0PR05MB4401: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: yntE/t80aGz1jY02FPwFlnDfdoJSbCHk2eAbyzJvuWawdkkWmOAvBTX41krWKGl0fZ7U3TikpaVQXbn0Iy/4/Xr8GbbKsiFh4oRhrTE2YeAt3fkedGU4/QfrnWzLTSuoS5MrFG+HG3DPKgwxK52Lq38gQ3aHrD0An/IZcbXObnOmmHQHIUh9J3+SGJsXQtRg0EnBeOIoredYPXVcOD8GL772oyXRW2DBdkUF5akoD9QEiZYWAmNLitRHId/VgcF2we/75bljG4QVRk681LM4G0jeBG118paBRA/SusjXLfyTf+1Z62yJcKM5bOuXYZfHrMr5y9mUey0Q9rNhya9muw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB6707.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(376002)(39860400002)(136003)(366004)(346002)(316002)(8936002)(107886003)(6506007)(26005)(4326008)(7696005)(53546011)(478600001)(54906003)(110136005)(186003)(86362001)(2906002)(52536014)(5660300002)(55016002)(83380400001)(33656002)(76116006)(66946007)(66476007)(66556008)(64756008)(66446008)(9686003)(71200400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: N5t1EeFPF88muYd5rdmyxgkqFNORjYI1kfEfqdfFGZHxKMDPb/9NQ0+/O77x/wFZGUQO/WScF65aIxoxJvIONB+BuTYXktSfLbu9ox1+rfuYimaNYoO3fIQJrdPNc5Ris0a9DILfTgjgti+PEIUmiblBpuomZqqNJNF+x7w4A8snt9iTUdfb6kYSPipymg+atqlY3zgr60RR2j9FjVv0ZeOpfYgv/QPcjg/bonpFdp8n+MEj+4pt6Stb7/CW1QB90ptKGVoBXMCnO+mTU5tw/pAjgxaCttSvnb6STqntzbDsR69jfPn3qGAUiSfnPnAfqw9iVPXyDtUxCufRALUfXbfitK0KCFDJJJyvfuLkEIVT06+30BOuTdBWvlKpzgEJQZEfZQTwNoB1pay9InKH4vG2I6xyz9xGtJ+M1qNsK+lBIIbukWVW+MnQ4zo32o8eRpM35mz+T+hU29FSmesKyyeGx6f5jp2ecKH6Wn6j9EqvHYm/f5SnSNNgtdVnTHQZ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR05MB6707.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3839f0d8-16e4-487d-a34c-08d82e543717 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jul 2020 15:30:50.8425 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ynKz7EbT3lWct7W80MXaSZYYyzrSORgjAF0zdnl7jkR2tKbMaOAHWr5EO7RETu8WxpIBkAaDkjLAAcqbJqB7Aw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4401 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: optimize critical section in device free X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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, > -----Original Message----- > From: dev On Behalf Of Michael Baum > Sent: Tuesday, July 21, 2020 3:04 PM > To: dev@dpdk.org > Cc: Matan Azrad ; Slava Ovsiienko > > Subject: [dpdk-dev] [PATCH] net/mlx5: optimize critical section in device= free >=20 > When PMD releases shared IB device context, It locks the > mlx5_ibv_list_mutex lock throughout the function so that it does not > happen while removing a device from the list, another process will try > to insert another device into it. > On the other hand, having removed the device from the list even if it > has not yet released all of its resources, it should not care about > other processes and can release the lock. >=20 > However, the PMD does not release the lock even though it can, and > performs a number of operations, some of which include sleep and may be > long. > To improve this, shorten the lock time to the minimum necessary. >=20 > Signed-off-by: Michael Baum > Acked-by: Matan Azrad > --- > drivers/net/mlx5/mlx5.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index 846398d..70338e5 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -939,6 +939,7 @@ struct mlx5_dev_ctx_shared * > mlx5_mr_release_cache(&sh->share_cache); > /* Remove context from the global device list. */ > LIST_REMOVE(sh, next); > + pthread_mutex_unlock(&mlx5_dev_ctx_list_mutex); > /* > * Ensure there is no async event handler installed. > * Only primary process handles async device events. > @@ -968,6 +969,7 @@ struct mlx5_dev_ctx_shared * > mlx5_flow_id_pool_release(sh->flow_id_pool); > pthread_mutex_destroy(&sh->txpp.mutex); > mlx5_free(sh); > + return; > exit: > pthread_mutex_unlock(&mlx5_dev_ctx_list_mutex); > } > -- > 1.8.3.1 Patch applied to next-net-mlx, Kindest regards, Raslan Darawsheh