Skip to contentSkip to conversation

Batch of mlx5_ib fixes

PATCH Applied Leon Romanovsky 1 participant 5 messages Sep 20, 2023 – Sep 26, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Batch of mlx5_ib fixes

From: Leon Romanovsky <[email protected]>

Hi,

This patchset is combination of various mlx5_ib fixes.

Thanks

Hamdan Igbaria (1):
RDMA/mlx5: Fix mutex unlocking on error flow for steering anchor
creation

Michael Guralnik (1):
RDMA/mlx5: Fix assigning access flags to cache mkeys

Shay Drory (1):
RDMA/mlx5: Fix NULL string error

 drivers/infiniband/hw/mlx5/fs.c   | 2 +-
 drivers/infiniband/hw/mlx5/main.c | 2 +-
 drivers/infiniband/hw/mlx5/mr.c   | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/3 RDMA/mlx5: Fix assigning access flags to cache mkeys

From: Michael Guralnik <[email protected]>

After the change to use dynamic cache structure, new cache entries can be added and the mkey allocation can no longer assume that all mkeys created for the cache have access_flags equal to zero.

Example of a flow that exposes the issue:
A user registers MR with RO on a HCA that cannot UMR RO and the mkey is created outside of the cache. When the user deregisters the MR, a new cache entry is created to store mkeys with RO.

Later, the user registers 2 MRs with RO. The first MR is reused from the new cache entry. When we try to get the second mkey from the cache we see the entry is empty so we go to the MR cache mkey allocation flow which would have allocated a mkey with no access flags, resulting the user getting a MR without RO.

Fixes dd1b913fb0d0 ("RDMA/mlx5: Cache all user cacheable mkeys on dereg MR flow")
---
 drivers/infiniband/hw/mlx5/mr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/mr.c +2 -1
index 5d3cc225be29..4a1e78e394e5 100644
@@ -239,7 +239,8 @@ static int get_mkc_octo_size(unsigned int access_mode, unsigned int ndescs)
 
 static void set_cache_mkc(struct mlx5_cache_ent *ent, void *mkc)
 {
-	set_mkc_access_pd_addr_fields(mkc, 0, 0, ent->dev->umrc.pd);
+	set_mkc_access_pd_addr_fields(mkc, ent->rb_key.access_flags, 0,
+				      ent->dev->umrc.pd);
 	MLX5_SET(mkc, mkc, free, 1);
 	MLX5_SET(mkc, mkc, umr_en, 1);
 	MLX5_SET(mkc, mkc, access_mode_1_0, ent->rb_key.access_mode & 0x3);
Signature · 1 line
2.41.0
#2 lore raw

PATCH 2/3 RDMA/mlx5: Fix mutex unlocking on error flow for steering anchor creation

In reply to Leon Romanovsky

From: Hamdan Igbaria <[email protected]>

The mutex was not unlocked on some of the error flows. Moved the unlock location to include all the error flow scenarios.

Fixes e1f4a52ac171 ("RDMA/mlx5: Create an indirect flow table for steering anchor")
---
 drivers/infiniband/hw/mlx5/fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/fs.c +1 -1
index 1e419e080b53..520034acf73a 100644
@@ -2470,8 +2470,8 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_STEERING_ANCHOR_CREATE)(
 	mlx5_steering_anchor_destroy_res(ft_prio);
 put_flow_table:
 	put_flow_table(dev, ft_prio, true);
-	mutex_unlock(&dev->flow_db->lock);
 free_obj:
+	mutex_unlock(&dev->flow_db->lock);
 	kfree(obj);
 
 	return err;
Signature · 1 line
2.41.0
#3 lore raw

PATCH 3/3 RDMA/mlx5: Fix NULL string error

In reply to Leon Romanovsky

From: Shay Drory <[email protected]>

checkpath is complaining about NULL string, change it to 'Unknown'.

Fixes 37aa5c36aa70 ("IB/mlx5: Add UARs write-combining and non-cached mapping")
---
 drivers/infiniband/hw/mlx5/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/main.c +1 -1
index aed5cdea50e6..555629b798b9 100644
@@ -2084,7 +2084,7 @@ static inline char *mmap_cmd2str(enum mlx5_ib_mmap_cmd cmd)
 	case MLX5_IB_MMAP_DEVICE_MEM:
 		return "Device Memory";
 	default:
-		return NULL;
+		return "Unknown";
 	}
 }
 
Signature · 1 line
2.41.0
author Applied
#4 lore raw
In reply to Leon Romanovsky
Quoted 9 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

Hi,

This patchset is combination of various mlx5_ib fixes.

Thanks

[...]

Applied, thanks!

[1/3] RDMA/mlx5: Fix assigning access flags to cache mkeys

      https://git.kernel.org/rdma/rdma/c/4f14c6c0213e1d
[2/3] RDMA/mlx5: Fix mutex unlocking on error flow for steering anchor creation
      https://git.kernel.org/rdma/rdma/c/2fad8f06a582cd
[3/3] RDMA/mlx5: Fix NULL string error
      https://git.kernel.org/rdma/rdma/c/dab994bcc609a1

Best regards,

Signature · 1 line
Leon Romanovsky <[email protected]>