mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
Optimize DMABUF mkey page size in mlx5
From Edward: This patch series enables the mlx5 driver to dynamically choose the optimal page size for a DMABUF-based memory key (mkey), rather than always registering with a fixed page size. Previously, DMABUF memory registration used a fixed 4K page size for mkeys which could lead to suboptimal performance when the underlying memory layout may offer better page sizes. This approach did not take advantage of larger page size capabilities advertised by the HCA, and the driver was not setting the proper page size mask in the mkey mask when performing page size changes, potentially leading to invalid registrations when updating to a very large pages. This series improves DMABUF performance by dynamically selecting the best page size for a given memory region (MR) both at creation time and on page fault occurrences, based on the underlying layout and fixing related gaps and bugs. By doing so, we reduce the number of page table entries (and thus MTT/ KSM descriptors) that the HCA must traverse, which in turn reduces cache-line fetches. Thanks * mlx5-next: RDMA/mlx5: Fix UMR modifying of mkey page size net/mlx5: Expose HCA capability bits for mkey max page size Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
commit
9879bddf5a
|
|
@ -32,13 +32,15 @@ static __be64 get_umr_disable_mr_mask(void)
|
|||
return cpu_to_be64(result);
|
||||
}
|
||||
|
||||
static __be64 get_umr_update_translation_mask(void)
|
||||
static __be64 get_umr_update_translation_mask(struct mlx5_ib_dev *dev)
|
||||
{
|
||||
u64 result;
|
||||
|
||||
result = MLX5_MKEY_MASK_LEN |
|
||||
MLX5_MKEY_MASK_PAGE_SIZE |
|
||||
MLX5_MKEY_MASK_START_ADDR;
|
||||
if (MLX5_CAP_GEN_2(dev->mdev, umr_log_entity_size_5))
|
||||
result |= MLX5_MKEY_MASK_PAGE_SIZE_5;
|
||||
|
||||
return cpu_to_be64(result);
|
||||
}
|
||||
|
|
@ -654,7 +656,7 @@ static void mlx5r_umr_final_update_xlt(struct mlx5_ib_dev *dev,
|
|||
flags & MLX5_IB_UPD_XLT_ENABLE || flags & MLX5_IB_UPD_XLT_ADDR;
|
||||
|
||||
if (update_translation) {
|
||||
wqe->ctrl_seg.mkey_mask |= get_umr_update_translation_mask();
|
||||
wqe->ctrl_seg.mkey_mask |= get_umr_update_translation_mask(dev);
|
||||
if (!mr->ibmr.length)
|
||||
MLX5_SET(mkc, &wqe->mkey_seg, length64, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -280,6 +280,7 @@ enum {
|
|||
MLX5_MKEY_MASK_SMALL_FENCE = 1ull << 23,
|
||||
MLX5_MKEY_MASK_RELAXED_ORDERING_WRITE = 1ull << 25,
|
||||
MLX5_MKEY_MASK_FREE = 1ull << 29,
|
||||
MLX5_MKEY_MASK_PAGE_SIZE_5 = 1ull << 42,
|
||||
MLX5_MKEY_MASK_RELAXED_ORDERING_READ = 1ull << 47,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2171,7 +2171,9 @@ struct mlx5_ifc_cmd_hca_cap_2_bits {
|
|||
u8 min_mkey_log_entity_size_fixed_buffer[0x5];
|
||||
u8 ec_vf_vport_base[0x10];
|
||||
|
||||
u8 reserved_at_3a0[0xa];
|
||||
u8 reserved_at_3a0[0x2];
|
||||
u8 max_mkey_log_entity_size_fixed_buffer[0x6];
|
||||
u8 reserved_at_3a8[0x2];
|
||||
u8 max_mkey_log_entity_size_mtt[0x6];
|
||||
u8 max_rqt_vhca_id[0x10];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user