From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0062.outbound.protection.outlook.com [104.47.2.62]) by dpdk.org (Postfix) with ESMTP id 4CA3B28F3 for ; Thu, 24 May 2018 20:30:01 +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=iNnBEvcfGSo+RysdVJuLp/S7dhyQRR50AX1zLJvt7Rc=; b=qmfTm2kgRfhzAo7OYHvAuck3eAgMouIJlT371TcstM9ZfLsI0JlczANI2w8lqtPpGXq7q7Yzmk2oOjmNI/YcFdVCwwrPWoLvYYez1ylisLiJ7YvZsQub3LHypFUbxGjInhjK2o+cSaN9lZcavQafnhxaOyhCW2NQwfFfr0Ottfo= 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:29:59 +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:29:59 +0000 From: Yongseok Koh To: "Xueming(Steven) Li" CC: Shahaf Shuler , "dev@dpdk.org" , Adrien Mazarguil Thread-Topic: [PATCH] net/mlx5: fix port dead lock when port shutdown Thread-Index: AQHT83PxGalPkow6yEqLlaCKAFxauKQ/M4gA Date: Thu, 24 May 2018 18:29:59 +0000 Message-ID: References: <20180524152005.1833-1-xuemingl@mellanox.com> In-Reply-To: <20180524152005.1833-1-xuemingl@mellanox.com> 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:DgANDZ5FBnaK53y8JH7jyCTm3nw7vIGwB5qRFvOxesJEwJ1sS7ff3voN0S6X/0Uc7ZrVeAjBQhXmuGG7NwZsr6PxC8+hH2uiZ6uWw0jkfxFrgYz5QMVplE0B6J4alWp56TLC3wE3iNPDBZlNn9hVm8u69SBraCZPzngUap06AE5KhvH6KLvCiJGQ7IK0cbSAwLd8Q6EfWnO5u0M647TjKu1NEba4Lzfah5jAkRBBKqMqiY43D+661HX2nWAi+676 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:; 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)(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)(8676002)(3660700001)(97736004)(6246003)(7736002)(25786009)(53376002)(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: cCnBd/qcoGA3ypx0FnWDBvpkCa0duGEFr8YhVigsWMImknUA1DWg7ONXjc6BQTA0tE+MMiAlEJimfCi3ocdinu8tOyPfHpk8KWDGMNeq9Z+EsZ7q5PXwCNJeGR2E7wXxcazoei29NvRuJob+PaksIg9IqXTX5kzU14mwgchL9GF0yxTz70hWzSSIt/Jfa4+4 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <88418A52C69801409D401D3790FB332E@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 08089a2d-afe7-4045-b346-08d5c1a45b3c X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08089a2d-afe7-4045-b346-08d5c1a45b3c X-MS-Exchange-CrossTenant-originalarrivaltime: 24 May 2018 18:29:59.1826 (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:30:01 -0000 > 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. A typo. > 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_ethde= v.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 list > * linearly, which is slow. > */ > + if (priv->mr.cache.table) > + return 0; Thanks, nice catch! Adrien submitted a fix [1] for the similar issue. Adding device to the memo= ry event callback list is moved to mlx5_pci_probe() as it should be done once. So, h= ow about moving the rest (mlx5_mr_btree_init()) to mlx5_pci_probe() as well? I mean,= instead of adding this check, you can move the btree_init() above the line where Ad= rien moved LIST_INSERT_HEAD() to. You'll need to rebase on Adrien's patch and add a co= mment to Shahaf there's dependency. [1] net/mlx5: fix crash when configure is not called http://dpdk.org/dev/patchwork/patch/40404/ 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, i= nt 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 >=20