From patchwork Mon Apr 15 08:40:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 52791 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DBC401B11F; Mon, 15 Apr 2019 10:41:06 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 5738F1B113 for ; Mon, 15 Apr 2019 10:41:04 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from viacheslavo@mellanox.com) with ESMTPS (AES256-SHA encrypted); 15 Apr 2019 11:41:02 +0300 Received: from pegasus12.mtr.labs.mlnx. (pegasus12.mtr.labs.mlnx [10.210.17.40]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x3F8f2F6017217; Mon, 15 Apr 2019 11:41:02 +0300 From: Viacheslav Ovsiienko To: dev@dpdk.org Cc: shahafs@mellanox.com, stable@dpdk.org Date: Mon, 15 Apr 2019 08:40:58 +0000 Message-Id: <1555317658-28091-1-git-send-email-viacheslavo@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] net/mlx4: fix memory region cleanup routine 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" mlx4 driver has a global list of Memory Regions created by device, and there is a ml4_mr_release() routine which makes a memory cleanup at device closing. The head of device MR list was fetched outside the rwlock protected section. Also some noticed typos are fixed. Fixes: 9797bfcce1c9 ("net/mlx4: add new memory region support") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko Acked-by: Yongseok Koh --- drivers/net/mlx4/mlx4_mr.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx4/mlx4_mr.c b/drivers/net/mlx4/mlx4_mr.c index ad7d483..48d458a 100644 --- a/drivers/net/mlx4/mlx4_mr.c +++ b/drivers/net/mlx4/mlx4_mr.c @@ -477,7 +477,7 @@ struct mr_update_mp_data { } /** - * Releass resources of detached MR having no online entry. + * Release resources of detached MR having no online entry. * * @param dev * Pointer to Ethernet device. @@ -527,7 +527,7 @@ struct mr_update_mp_data { } /** - * Create a new global Memroy Region (MR) for a missing virtual address. + * Create a new global Memory Region (MR) for a missing virtual address. * This API should be called on a secondary process, then a request is sent to * the primary process in order to create a MR for the address. As the global MR * list is on the shared memory, following LKey lookup should succeed unless the @@ -573,7 +573,7 @@ struct mr_update_mp_data { } /** - * Create a new global Memroy Region (MR) for a missing virtual address. + * Create a new global Memory Region (MR) for a missing virtual address. * Register entire virtually contiguous memory chunk around the address. * This must be called from the primary process. * @@ -682,7 +682,7 @@ struct mr_update_mp_data { bmp_mem = RTE_PTR_ALIGN_CEIL(mr + 1, RTE_CACHE_LINE_SIZE); mr->ms_bmp = rte_bitmap_init(ms_n, bmp_mem, bmp_size); if (mr->ms_bmp == NULL) { - WARN("port %u unable to initialize bitamp for a new MR of" + WARN("port %u unable to initialize bitmap for a new MR of" " address (%p).", dev->data->port_id, (void *)addr); rte_errno = EINVAL; @@ -820,7 +820,7 @@ struct mr_update_mp_data { } /** - * Create a new global Memroy Region (MR) for a missing virtual address. + * Create a new global Memory Region (MR) for a missing virtual address. * This can be called from primary and secondary process. * * @param dev @@ -1434,7 +1434,7 @@ struct mr_update_mp_data { mlx4_mr_release(struct rte_eth_dev *dev) { struct mlx4_priv *priv = dev->data->dev_private; - struct mlx4_mr *mr_next = LIST_FIRST(&priv->mr.mr_list); + struct mlx4_mr *mr_next; /* Remove from memory callback device list. */ rte_rwlock_write_lock(&mlx4_shared_data->mem_event_rwlock); @@ -1445,6 +1445,7 @@ struct mr_update_mp_data { #endif rte_rwlock_write_lock(&priv->mr.rwlock); /* Detach from MR list and move to free list. */ + mr_next = LIST_FIRST(&priv->mr.mr_list); while (mr_next != NULL) { struct mlx4_mr *mr = mr_next;