Dump and fill MKEY
Subsystems (5)
cover Dump and fill MKEY
From: Leon Romanovsky <[email protected]>
MLX5 IB HCA offers the memory key, dump_fill_mkey to increase performance, when used in a send or receive operations.
It is used to force local HCA operations to skip the PCI bus access, while keeping track of the processed length in the ibv_sge handling.
In this three patch series, we expose various bits in our HW spec file (mlx5_ifc.h), move unneeded for mlx5_core FW command and export such memory key to user space thought our mlx5-abi header file.
Thanks
Leon Romanovsky (1):
net/mlx5: Add hardware definitions for dump_fill_mkey
Yonatan Cohen (2):
net/mlx5: Limit scope of dump_fill_mkey function IB/mlx5: Expose dump and fill memory key
drivers/infiniband/hw/mlx5/cmd.c | 15 +++++++++++++++ drivers/infiniband/hw/mlx5/cmd.h | 1 + drivers/infiniband/hw/mlx5/main.c | 16 +++++++++++++++- drivers/net/ethernet/mellanox/mlx5/core/mr.c | 17 ----------------- include/linux/mlx5/driver.h | 2 -- include/linux/mlx5/mlx5_ifc.h | 4 +++- include/uapi/rdma/mlx5-abi.h | 3 ++- 7 files changed, 36 insertions(+), 22 deletions(-)
PATCH 1/3 net/mlx5: Limit scope of dump_fill_mkey function
From: Yonatan Cohen <[email protected]>
mlx5_core_dump_fill_mkey() is going to be used in next patch in IB and doesn't need to be visible to whole mlx5_core. Move that command to mlx5_ib.
--- drivers/infiniband/hw/mlx5/cmd.c | 15 +++++++++++++++ drivers/infiniband/hw/mlx5/cmd.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/mr.c | 17 ----------------- include/linux/mlx5/driver.h | 2 -- 4 files changed, 16 insertions(+), 19 deletions(-)
drivers/infiniband/hw/mlx5/cmd.c +15 -0
@@ -32,6 +32,21 @@#include "cmd.h" +int mlx5_cmd_dump_fill_mkey (struct mlx5_core_dev *dev,u32 *mkey) +{ +u32 out[MLX5_ST_SZ_DW (query_special_contexts_out)] = {0 }; +u32 in[MLX5_ST_SZ_DW (query_special_contexts_in)] = {0 }; +int err; + +MLX5_SET (query_special_contexts_in, in, opcode, +MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS ); + err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +if (!err) + *mkey =MLX5_GET (query_special_contexts_out, out, + dump_fill_mkey); +return err; +} +int mlx5_cmd_null_mkey (struct mlx5_core_dev *dev,u32 *null_mkey) {u32 out[MLX5_ST_SZ_DW (query_special_contexts_out)] = {};
drivers/infiniband/hw/mlx5/cmd.h +1 -0
@@ -37,6 +37,7 @@#include <linux/kernel.h> #include <linux/mlx5/driver.h> +int mlx5_cmd_dump_fill_mkey (struct mlx5_core_dev *dev,u32 *mkey);int mlx5_cmd_null_mkey (struct mlx5_core_dev *dev,u32 *null_mkey);int mlx5_cmd_query_cong_params (struct mlx5_core_dev *dev,int cong_point,void *out,int out_size);
drivers/net/ethernet/mellanox/mlx5/core/mr.c +0 -17
@@ -146,23 +146,6 @@ int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey, }EXPORT_SYMBOL (mlx5_core_query_mkey); -int mlx5_core_dump_fill_mkey (struct mlx5_core_dev *dev,struct mlx5_core_mkey *_mkey, -u32 *mkey) -{ -u32 out[MLX5_ST_SZ_DW (query_special_contexts_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (query_special_contexts_in)] = {0 }; -int err; - -MLX5_SET (query_special_contexts_in, in, opcode, -MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS ); - err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); -if (!err) - *mkey =MLX5_GET (query_special_contexts_out, out, - dump_fill_mkey); -return err; -} -EXPORT_SYMBOL (mlx5_core_dump_fill_mkey); -static inline u32 mlx5_get_psv (u32 *out,int psv_index) {switch (psv_index) {
include/linux/mlx5/driver.h +0 -2
@@ -1067,8 +1067,6 @@ int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey);int mlx5_core_query_mkey (struct mlx5_core_dev *dev,struct mlx5_core_mkey *mkey,u32 *out,int outlen); -int mlx5_core_dump_fill_mkey (struct mlx5_core_dev *dev,struct mlx5_core_mkey *_mkey, -u32 *mkey);int mlx5_core_alloc_pd (struct mlx5_core_dev *dev,u32 *pdn);int mlx5_core_dealloc_pd (struct mlx5_core_dev *dev,u32 pdn); int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, const void *inb, void *outb,
Signature · 1 line
2.14.4
PATCH 2/3 net/mlx5: Add hardware definitions for dump_fill_mkey
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
MLX5 IB HCA offers the memory key, dump_fill_mkey to boost performance by forcing local HCA operations to skip the PCI bus access,
This patch adds needed hardware definitions.
--- include/linux/mlx5/mlx5_ifc.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/linux/mlx5/mlx5_ifc.h +3 -1
@@ -889,7 +889,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {u8 log_max_eq_sz[0x8 ];u8 reserved_at_e8[0x2 ];u8 log_max_mkey[0x6 ]; -u8 reserved_at_f0[0xc ]; +u8 reserved_at_f0[0x8 ]; +u8 dump_fill_mkey[0x1 ]; +u8 reserved_at_fa[0x3 ];u8 log_max_eq[0x4 ];u8 max_indirection[0x8 ];
Signature · 1 line
2.14.4
PATCH 3/3 IB/mlx5: Expose dump and fill memory key
In reply to Leon RomanovskyFrom: Yonatan Cohen <[email protected]>
MLX5 IB HCA offers the memory key, dump_fill_mkey to boost performance, when used in a send or receive operations.
It is used to force local HCA operations to skip the PCI bus access, while keeping track of the processed length in the ibv_sge handling.
Meaning, instead of a PCI write access the HCA leaves the target memory untouched, and skips filling that packet section. Similar behavior is done upon send, the HCA skips data in memory relevant to this key and saves PCI bus access.
This functionality saves PCI read/write operations.
--- drivers/infiniband/hw/mlx5/main.c | 16 +++++++++++++++- include/uapi/rdma/mlx5-abi.h | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/main.c +15 -1
@@ -1634,6 +1634,7 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev,int err;size_t min_req_v2 = offsetof(struct mlx5_ib_alloc_ucontext_req_v2 , max_cqe_version); +u32 dump_fill_mkey;bool lib_uar_4k;if (!dev->ib_active)
@@ -1743,8 +1744,12 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, } err =mlx5_ib_devx_create (dev, context); + } + +if (MLX5_CAP_GEN (dev->mdev, dump_fill_mkey)) { + err =mlx5_cmd_dump_fill_mkey (dev->mdev, &dump_fill_mkey);if (err) - goto out_td; + goto out_mdev; }INIT_LIST_HEAD (&context->vma_private_list);
@@ -1805,6 +1810,15 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, resp.response_length +=sizeof (resp.num_dyn_bfregs); } +if (field_avail (typeof (resp), dump_fill_mkey, udata->outlen)) { +if (MLX5_CAP_GEN (dev->mdev, dump_fill_mkey)) { + resp.dump_fill_mkey = dump_fill_mkey; + resp.comp_mask |= +MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_DUMP_FILL_MKEY ; + } + resp.response_length +=sizeof (resp.dump_fill_mkey); + } + err =ib_copy_to_udata (udata, &resp, resp.response_length);if (err) goto out_mdev;
include/uapi/rdma/mlx5-abi.h +2 -1
@@ -93,6 +93,7 @@ struct mlx5_ib_alloc_ucontext_req_v2 {enum mlx5_ib_alloc_ucontext_resp_mask {MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_CORE_CLOCK_OFFSET =1UL <<0 , +MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_DUMP_FILL_MKEY =1UL <<1 , };enum mlx5_user_cmds_supp_uhw {
@@ -141,7 +142,7 @@ struct mlx5_ib_alloc_ucontext_resp {__u32 log_uar_size;__u32 num_uars_per_page;__u32 num_dyn_bfregs; -__u32 reserved3; +__u32 dump_fill_mkey; };struct mlx5_ib_alloc_pd_resp {
Signature · 1 line
2.14.4
Re: [PATCH rdma-next 3/3] IB/mlx5: Expose dump and fill memory key
Quoted 36 lines · Leon Romanovsky
From: Yonatan Cohen <[email protected]>
MLX5 IB HCA offers the memory key,
dump_fill_mkeyto boost performance, when used in a send or receive operations.It is used to force local HCA operations to skip the PCI bus access, while keeping track of the processed length in the
ibv_sgehandling.Meaning, instead of a PCI write access the HCA leaves the target memory untouched, and skips filling that packet section. Similar behavior is done upon send, the HCA skips data in memory relevant to this key and saves PCI bus access.
This functionality saves PCI read/write operations.
Signed-off-by Yonatan Cohen <[email protected]>Reviewed-by Yishai Hadas <[email protected]>Reviewed-by Guy Levi <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>drivers/infiniband/hw/mlx5/main.c | 16 +++++++++++++++- include/uapi/rdma/mlx5-abi.h | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-)drivers/infiniband/hw/mlx5/main.c +2
-0+++ b/drivers/infiniband/hw/mlx5/main.c@@ -1634,6 +1634,7 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev,int err;size_t min_req_v2 = offsetof(struct mlx5_ib_alloc_ucontext_req_v2 , max_cqe_version); +u32 dump_fill_mkey;bool lib_uar_4k;if (!dev->ib_active)@@ -1743,8 +1744,12 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, }
drivers/infiniband/hw/mlx5/main.c static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, · line 1753
Quoted 10 lines
drivers/infiniband/hw/mlx5/main.c +5
-1err =mlx5_ib_devx_create (dev, context); + } + +if (MLX5_CAP_GEN (dev->mdev, dump_fill_mkey)) { + err =mlx5_cmd_dump_fill_mkey (dev->mdev, &dump_fill_mkey);if (err) - goto out_td; + goto out_mdev; }
Dropping the if (err) after mlx5_ib_devx_create is a rebasing error, right?
Jason
Re: [PATCH rdma-next 3/3] IB/mlx5: Expose dump and fill memory key
Quoted 38 lines · Jason Gunthorpe
Quoted 37 lines · Leon Romanovsky
From: Yonatan Cohen <[email protected]>
MLX5 IB HCA offers the memory key,
dump_fill_mkeyto boost performance, when used in a send or receive operations.It is used to force local HCA operations to skip the PCI bus access, while keeping track of the processed length in the
ibv_sgehandling.Meaning, instead of a PCI write access the HCA leaves the target memory untouched, and skips filling that packet section. Similar behavior is done upon send, the HCA skips data in memory relevant to this key and saves PCI bus access.
This functionality saves PCI read/write operations.
Signed-off-by Yonatan Cohen <[email protected]>Reviewed-by Yishai Hadas <[email protected]>Reviewed-by Guy Levi <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>drivers/infiniband/hw/mlx5/main.c | 16 +++++++++++++++- include/uapi/rdma/mlx5-abi.h | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-)drivers/infiniband/hw/mlx5/main.c +2
-0+++ b/drivers/infiniband/hw/mlx5/main.c@@ -1634,6 +1634,7 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev,int err;size_t min_req_v2 = offsetof(struct mlx5_ib_alloc_ucontext_req_v2 , max_cqe_version); +u32 dump_fill_mkey;bool lib_uar_4k;if (!dev->ib_active)@@ -1743,8 +1744,12 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, }
Quoted 12 lines
drivers/infiniband/hw/mlx5/main.c static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, · line 1753
Quoted 9 lines
drivers/infiniband/hw/mlx5/main.c +5
-1err =mlx5_ib_devx_create (dev, context); + } + +if (MLX5_CAP_GEN (dev->mdev, dump_fill_mkey)) { + err =mlx5_cmd_dump_fill_mkey (dev->mdev, &dump_fill_mkey);if (err) - goto out_td; + goto out_mdev; }Dropping the if (err) after
mlx5_ib_devx_createis a rebasing error, right?
Sorry, you are right, the fixup is pretty straightforward.
(quoted diff) +0 -0
b/drivers/infiniband/hw/mlx5/main.c
index 2bbafee6976c..71f3e9677622 100644
drivers/infiniband/hw/mlx5/main.c +0 -0
@@ -1739,6 +1739,8 @@ static struct ib_ucontext
*mlx5_ib_alloc_ucontext(struct ib_device *ibdev,
}
err = mlx5_ib_devx_create(dev, context);
if (err)
+ goto out_td;
}
if (MLX5_CAP_GEN(dev->mdev, dump_fill_mkey)) {Quoted 2 lines
Jason
Quoted 11 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
MLX5 IB HCA offers the memory key,
dump_fill_mkeyto increase performance, when used in a send or receive operations.It is used to force local HCA operations to skip the PCI bus access, while keeping track of the processed length in the
ibv_sgehandling.In this three patch series, we expose various bits in our HW spec file (
mlx5_ifc.h), move unneeded formlx5_coreFW command and export such memory key to user space thought our mlx5-abi header file.
Where is the user space for this?
Jason
Quoted 6 lines · Jason Gunthorpe
Quoted 5 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
MLX5 IB HCA offers the memory key,
dump_fill_mkeyto increase performance, when used in a send or receive operations.
Quoted 8 lines
Quoted 6 lines
It is used to force local HCA operations to skip the PCI bus access, while keeping track of the processed length in the
ibv_sgehandling.In this three patch series, we expose various bits in our HW spec file (
mlx5_ifc.h), move unneeded formlx5_coreFW command and export such memory key to user space thought our mlx5-abi header file.Where is the user space for this?
It will be published in the near future.
Thanks
Quoted 2 lines
Jason
Quoted 5 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
MLX5 IB HCA offers the memory key,
dump_fill_mkeyto increase performance, when used in a send or receive operations.
Quoted 8 lines
It is used to force local HCA operations to skip the PCI bus access, while keeping track of the processed length in the
ibv_sgehandling.In this three patch series, we expose various bits in our HW spec file (
mlx5_ifc.h), move unneeded formlx5_coreFW command and export such memory key to user space thought our mlx5-abi header file.Thanks
This looks fine, can you send a pull request off the mlx5 branch please?
Thanks,
Jason
Quoted 9 lines · Jason Gunthorpe
Quoted 8 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
MLX5 IB HCA offers the memory key,
dump_fill_mkeyto increase performance, when used in a send or receive operations.It is used to force local HCA operations to skip the PCI bus access, while keeping track of the processed length in the
ibv_sgehandling.
Quoted 8 lines
Quoted 5 lines
In this three patch series, we expose various bits in our HW spec file (
mlx5_ifc.h), move unneeded formlx5_coreFW command and export such memory key to user space thought our mlx5-abi header file.Thanks
This looks fine, can you send a pull request off the mlx5 branch please?
Updated mlx5-next with first two commits,b183ee27f5fb net/mlx5: Add hardware definitions for dump_fill_mkey 4d4fb5dc988a net/mlx5: Limit scope of dump_fill_mkey function
Thanks
Quoted 3 lines
Thanks,
Jason
Quoted 14 lines · Leon Romanovsky
Quoted 13 lines · Jason Gunthorpe
Quoted 12 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
MLX5 IB HCA offers the memory key,
dump_fill_mkeyto increase performance, when used in a send or receive operations.It is used to force local HCA operations to skip the PCI bus access, while keeping track of the processed length in the
ibv_sgehandling.In this three patch series, we expose various bits in our HW spec file (
mlx5_ifc.h), move unneeded formlx5_coreFW command and export such memory key to user space thought our mlx5-abi header file.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Thanks
This looks fine, can you send a pull request off the mlx5 branch please?
Updated mlx5-next with first two commits,
b183ee27f5fbnet/mlx5: Add hardware definitions fordump_fill_mkey4d4fb5dc988anet/mlx5: Limit scope ofdump_fill_mkeyfunction
Okay, applied to for-next, with the missing 'if (err)' fixed.
Thanks,
Jason