From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 7E02F1DA4 for ; Thu, 24 May 2018 17:28:58 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@mellanox.com) with ESMTPS (AES256-SHA encrypted); 24 May 2018 18:22:19 +0300 Received: from dev-r630-06.mtbc.labs.mlnx (dev-r630-06.mtbc.labs.mlnx [10.12.205.180]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w4OFKJQo003657; Thu, 24 May 2018 18:20:19 +0300 Received: from dev-r630-06.mtbc.labs.mlnx (localhost [127.0.0.1]) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7) with ESMTP id w4OFKHq0001881; Thu, 24 May 2018 23:20:17 +0800 Received: (from xuemingl@localhost) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7/Submit) id w4OFKH2v001879; Thu, 24 May 2018 23:20:17 +0800 From: Xueming Li To: Shahaf Shuler , Yongseok Koh Cc: Xueming Li , dev@dpdk.org Date: Thu, 24 May 2018 23:20:05 +0800 Message-Id: <20180524152005.1833-1-xuemingl@mellanox.com> X-Mailer: git-send-email 2.13.3 Subject: [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 15:28:58 -0000 This patch add check to avoid init device MR data twcie which caused priv data linked to itself in list. Fixes: 974f1e7ef146 ("net/mlx5: add new memory region support") Cc: yskoh@mellanox.com Signed-off-by: Xueming Li --- drivers/net/mlx5/mlx5_ethdev.c | 2 ++ drivers/net/mlx5/mlx5_mr.c | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.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; 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 = EINVAL; return -rte_errno; } + assert(!bt->table && !bt->size); memset(bt, 0, sizeof(*bt)); bt->table = rte_calloc_socket("B-tree table", n, sizeof(struct mlx5_mr_cache), -- 2.13.3