From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0089.outbound.protection.outlook.com [104.47.2.89]) by dpdk.org (Postfix) with ESMTP id E31282BBD for ; Thu, 24 May 2018 20:33:51 +0200 (CEST) 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=1zl7SZFaZM2XcFr31uzbvlSFtdjDxXvqigkOFm3JZJo=; b=JGdwWQVDYon1M4CUcDrYHo+9E8IDBXTVnjuVNUem/jWFiA//WX6GKnd6Td4VWKPh912pgrJTWCasL5/gfqw7l9jcMA9cx4r3fFGRwU3TzyWUiwlemQkGXM+20fhz7QZoq2qgPaUtXLteg6sVsY6KRZGy8TkUk57ZVRjk+yEzyD8= Received: from VI1PR0501MB2045.eurprd05.prod.outlook.com (10.167.195.147) by VI1PR0501MB2688.eurprd05.prod.outlook.com (10.172.15.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Thu, 24 May 2018 18:33:50 +0000 Received: from VI1PR0501MB2045.eurprd05.prod.outlook.com ([fe80::11b2:1e2d:709c:695d]) by VI1PR0501MB2045.eurprd05.prod.outlook.com ([fe80::11b2:1e2d:709c:695d%13]) with mapi id 15.20.0797.011; Thu, 24 May 2018 18:33:50 +0000 From: Yongseok Koh To: "Xueming(Steven) Li" CC: Shahaf Shuler , "dev@dpdk.org" , Adrien Mazarguil Thread-Topic: [dpdk-dev] [PATCH] net/mlx5: fix port dead lock when port shutdown Thread-Index: AQHT843CySWmDNuHTkiY5RA4EP3IkQ== Date: Thu, 24 May 2018 18:33:50 +0000 Message-ID: <26B7DBAE-CFC5-4BF7-AB35-CADD49D49326@mellanox.com> References: <20180524152005.1833-1-xuemingl@mellanox.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0501MB2688; 7:382uVvia+5y+zsHBZ4xgthwi1djiJasLkcakTvexneeqmAX2SnniUOzGSTPofEHJu7nJkJegfTAwkzO/hyUTjHA7GOiyEgPFI9VNlzPuWiSr1UGIJ1zUoym8tWWOuXNZHa1jooDuyGfsTyzYP327Wp6jWIc+ezjLl8NQ8rp+JjG/Fxj+EFOBUTNpXbQwikEO9t9AFogy8F+O0tpHeoar9vO0+pLXhUFb7apPxrRT3Read6ZlP9QIvfTxVxp51NV1 x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2688; x-ms-traffictypediagnostic: VI1PR0501MB2688: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(189930954265078)(45079756050767); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:VI1PR0501MB2688; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2688; x-forefront-prvs: 0682FC00E8 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(396003)(366004)(39380400002)(346002)(189003)(199004)(4326008)(33656002)(5250100002)(66066001)(6512007)(53936002)(6306002)(83716003)(966005)(99286004)(37006003)(2616005)(486006)(575784001)(6436002)(316002)(6116002)(54906003)(2900100001)(86362001)(3846002)(446003)(11346002)(82746002)(476003)(6506007)(14454004)(26005)(81156014)(2906002)(478600001)(229853002)(76176011)(102836004)(6862004)(3280700002)(36756003)(105586002)(53546011)(6486002)(305945005)(68736007)(81166006)(6636002)(8936002)(3660700001)(97736004)(6246003)(7736002)(25786009)(45080400002)(106356001)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2688; H:VI1PR0501MB2045.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: W5vEueW+RTBRLgwGn9b147vuVh+Pl30/YdJ4lryiaftTrb8Xv35CI/ykjgtS1twsv3ieWC3Z2VHriLo7tW74p2k+WtCZmetJKC2c1uSFsrH+1ErvNtwM3oX0/A3sWXu1jJ6aIqPrLG2FgXZe5HTA/ZVnvtPw6kwQh6i+dEQn8rZn948zoenSJ2zSeXECbT0T spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <446CF2F2A2E55542B7380A35D03D8D49@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 12e27c01-6183-4310-db38-08d5c1a4e540 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12e27c01-6183-4310-db38-08d5c1a4e540 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 May 2018 18:33:50.7198 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2688 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix port dead lock when port shutdown 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: , X-List-Received-Date: Thu, 24 May 2018 18:33:52 -0000 > On May 24, 2018, at 11:29 AM, Yongseok Koh wrote: >=20 >>=20 >> On May 24, 2018, at 8:20 AM, Xueming Li wrote: >>=20 >> This patch add check to avoid init device MR data twcie which caused >> priv data linked to itself in list. >=20 > A typo. >=20 >> Fixes: 974f1e7ef146 ("net/mlx5: add new memory region support") >> Cc: yskoh@mellanox.com >>=20 >> Signed-off-by: Xueming Li >> --- >> drivers/net/mlx5/mlx5_ethdev.c | 2 ++ >> drivers/net/mlx5/mlx5_mr.c | 1 + >> 2 files changed, 3 insertions(+) >>=20 >> diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethd= ev.c >> index c52ec6fb7..7ffd17ff3 100644 >> --- a/drivers/net/mlx5/mlx5_ethdev.c >> +++ b/drivers/net/mlx5/mlx5_ethdev.c >> @@ -398,6 +398,8 @@ mlx5_dev_configure(struct rte_eth_dev *dev) >> * deadlock. If it overflows, lookup should be done by searching MR lis= t >> * linearly, which is slow. >> */ >> + if (priv->mr.cache.table) >> + return 0; >=20 > Thanks, nice catch! >=20 > Adrien submitted a fix [1] for the similar issue. Adding device to the me= mory event > callback list is moved to mlx5_pci_probe() as it should be done once. So,= how about > moving the rest (mlx5_mr_btree_init()) to mlx5_pci_probe() as well? I mea= n, instead > of adding this check, you can move the btree_init() above the line where = Adrien moved > LIST_INSERT_HEAD() to. You'll need to rebase on Adrien's patch and add a = comment to > Shahaf there's dependency. >=20 >=20 > [1] > net/mlx5: fix crash when configure is not called > https://emea01.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fdpdk.= org%2Fdev%2Fpatchwork%2Fpatch%2F40404%2F&data=3D02%7C01%7Cyskoh%40mellanox.= com%7Ca731aadfe6834a7a435f08d5c1a45fcf%7Ca652971c7d2e4d9ba6a4d149256f461b%7= C0%7C0%7C636627834121490391&sdata=3DD8HjhDMzMfRucGCTSWCieRkNmptGXLJHo8it0Py= %2F3gY%3D&reserved=3D0 And you might want to write the same patch for mlx4. Thanks, Yongseok >> if (mlx5_mr_btree_init(&priv->mr.cache, MLX5_MR_BTREE_CACHE_N * 2, >> dev->device->numa_node)) { >> /* rte_errno is already set. */ >> diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c >> index abb1f5179..08105a443 100644 >> --- a/drivers/net/mlx5/mlx5_mr.c >> +++ b/drivers/net/mlx5/mlx5_mr.c >> @@ -191,6 +191,7 @@ mlx5_mr_btree_init(struct mlx5_mr_btree *bt, int n, = int socket) >> rte_errno =3D EINVAL; >> return -rte_errno; >> } >> + assert(!bt->table && !bt->size); >> memset(bt, 0, sizeof(*bt)); >> bt->table =3D rte_calloc_socket("B-tree table", >> n, sizeof(struct mlx5_mr_cache), >> --=20 >> 2.13.3