From 0d9ed0f09b92f730ae3a755415c4e68e62c4cf99 Mon Sep 17 00:00:00 2001
From: Yishai Hadas <yishaih@nvidia.com>
Date: Wed, 9 Dec 2020 09:15:39 +0200
Subject: [PATCH] mlx5: Consider single threaded mode for shared UAR
[ Upstream commit 9d6cbd2858d237d1d56bada430eca032074204c8 ]
In case application uses a single threaded mode even a UAR that is
shared between QPs doesn't need to take a lock.
Fixes: 7fdcd258bc5f ("mlx5: Move to fully dynamic UAR mode including QPs")
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
---
providers/mlx5/verbs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c
index 7907218295f6..cc93dc4c366e 100644
--- a/providers/mlx5/verbs.c
+++ b/providers/mlx5/verbs.c
@@ -326,7 +326,7 @@ static void mlx5_insert_dyn_uuars(struct mlx5_context *ctx,
if (!bf_uar->dyn_alloc_uar)
bf->bfreg_dyn_index = (ctx->curr_legacy_dyn_sys_uar_page - 1) * num_bfregs_per_page + j;
bf->dyn_alloc_uar = bf_uar->dyn_alloc_uar;
- bf->need_lock = bf_uar->qp_shared;
+ bf->need_lock = bf_uar->qp_shared && !mlx5_single_threaded;
mlx5_spinlock_init(&bf->lock, bf->need_lock);
if (j != 0) {
bf->uar = bf_uar->uar;
--
2.25.4