RDMA/rxe: Implement memory windows
Subsystems (2)
v7 cover RDMA/rxe: Implement memory windows
This series of patches implement memory windows for the rdma_rxe driver. This is a shorter reimplementation of an earlier patch set. They apply to and depend on the current for-next linux rdma tree.
---
v7:
Fixed a duplicate INIT_RDMA_OBJ_SIZE(ib_mw, ...) in rxe_verbs.c.
v6:
Added rxe_ prefix to subroutine names in lines that changed from Zhu's review of v5.
v5:
Fixed a typo in 10th patch.
v4:
Added a 10th patch to check when MRs have bound MWs and disallow dereg and invalidate operations.
v3:
cleaned up void return and lower case enums from Zhu's review.
v2:
cleaned up an issue in rdma_user_rxe.h
cleaned up a collision in rxe_resp.c
Bob Pearson (9):
RDMA/rxe: Add bind MW fields to rxe_send_wr RDMA/rxe: Return errors for add index and key RDMA/rxe: Enable MW object pool
RDMA/rxe: Add ib_alloc_mw and ib_dealloc_mw verbs RDMA/rxe: Replace WR_REG_MASK by WR_LOCAL_OP_MASK RDMA/rxe: Move local ops to subroutine RDMA/rxe: Add support for bind MW work requests RDMA/rxe: Implement invalidate MW operations RDMA/rxe: Implement memory access through MWs
drivers/infiniband/sw/rxe/Makefile | 1 + drivers/infiniband/sw/rxe/rxe.c | 1 + drivers/infiniband/sw/rxe/rxe_comp.c | 1 + drivers/infiniband/sw/rxe/rxe_loc.h | 29 +- drivers/infiniband/sw/rxe/rxe_mr.c | 79 ++++-- drivers/infiniband/sw/rxe/rxe_mw.c | 356 +++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_opcode.c | 11 +- drivers/infiniband/sw/rxe/rxe_opcode.h | 3 +- drivers/infiniband/sw/rxe/rxe_param.h | 19 +- drivers/infiniband/sw/rxe/rxe_pool.c | 45 ++-- drivers/infiniband/sw/rxe/rxe_pool.h | 8 +- drivers/infiniband/sw/rxe/rxe_req.c | 102 ++++--- drivers/infiniband/sw/rxe/rxe_resp.c | 110 +++++--- drivers/infiniband/sw/rxe/rxe_verbs.c | 5 +- drivers/infiniband/sw/rxe/rxe_verbs.h | 38 ++- include/uapi/rdma/rdma_user_rxe.h | 34 ++- 16 files changed, 691 insertions(+), 151 deletions(-) create mode 100644 drivers/infiniband/sw/rxe/rxe_mw.c
Signature · 1 line
2.27.0
PATCH v7 1/10 RDMA/rxe: Add bind MW fields to rxe_send_wr
Add fields to struct rxe_send_wr in rdma_user_rxe.h to support bind MW work requests
--- include/uapi/rdma/rdma_user_rxe.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
include/uapi/rdma/rdma_user_rxe.h +11 -0
@@ -99,7 +99,17 @@ struct rxe_send_wr {__u32 remote_qkey;__u16 pkey_index; } ud; +struct { +__aligned_u64 addr; +__aligned_u64 length; +__u32 mr_lkey; +__u32 mw_rkey; +__u32 rkey; +__u32 access; +__u32 flags; + } mw;/* reg is only used by the kernel and is not part of the uapi */ +#ifdef __KERNEL__ struct { union { struct ib_mr *mr;
@@ -108,6 +118,7 @@ struct rxe_send_wr {__u32 key; __u32 access; } reg; +#endif } wr; };
Signature · 1 line
2.30.2
PATCH v7 2/10 RDMA/rxe: Return errors for add index and key
In reply to Bob PearsonModify rxe_add_index() and rxe_add_key() to return an error if the index or key is aleady present in the pool. Currently they print a warning and silently fail with bad consequences to the caller.
--- drivers/infiniband/sw/rxe/rxe_pool.c | 44 ++++++++++++++++++---------- drivers/infiniband/sw/rxe/rxe_pool.h | 8 ++--- 2 files changed, 32 insertions(+), 20 deletions(-)
drivers/infiniband/sw/rxe/rxe_pool.c +28 -16
@@ -183,7 +183,7 @@ static u32 alloc_index(struct rxe_pool *pool)return index + pool->index.min_index; } -static void insert_index (struct rxe_pool *pool,struct rxe_pool_entry *new) +static int rxe_insert_index (struct rxe_pool *pool,struct rxe_pool_entry *new) {struct rb_node **link = &pool->index.tree.rb_node;struct rb_node *parent =NULL ;
@@ -195,7 +195,7 @@ static void insert_index(struct rxe_pool *pool, struct rxe_pool_entry *new)if (elem->index == new->index) {pr_warn ("element already exists!\n" ); - goto out; +return -EINVAL ; }if (elem->index > new->index)
@@ -206,11 +206,11 @@ static void insert_index(struct rxe_pool *pool, struct rxe_pool_entry *new)rb_link_node (&new->index_node, parent, link);rb_insert_color (&new->index_node, &pool->index.tree); -out: -return ; + +return 0 ; } -static void insert_key (struct rxe_pool *pool,struct rxe_pool_entry *new) +static int rxe_insert_key (struct rxe_pool *pool,struct rxe_pool_entry *new) {struct rb_node **link = &pool->key.tree.rb_node;struct rb_node *parent =NULL ;
@@ -226,7 +226,7 @@ static void insert_key(struct rxe_pool *pool, struct rxe_pool_entry *new)if (cmp ==0 ) {pr_warn ("key already exists!\n" ); - goto out; +return -EINVAL ; }if (cmp >0 )
@@ -237,26 +237,32 @@ static void insert_key(struct rxe_pool *pool, struct rxe_pool_entry *new)rb_link_node (&new->key_node, parent, link);rb_insert_color (&new->key_node, &pool->key.tree); -out: -return ; + +return 0 ; } -void __rxe_add_key_locked (struct rxe_pool_entry *elem,void *key) +int __rxe_add_key_locked (struct rxe_pool_entry *elem,void *key) {struct rxe_pool *pool = elem->pool; +int err;memcpy ((u8 *)elem + pool->key.key_offset, key, pool->key.key_size); -insert_key (pool, elem); + err =rxe_insert_key (pool, elem); + +return err; } -void __rxe_add_key (struct rxe_pool_entry *elem,void *key) +int __rxe_add_key (struct rxe_pool_entry *elem,void *key) {struct rxe_pool *pool = elem->pool;unsigned long flags; +int err;write_lock_irqsave (&pool->pool_lock, flags); -__rxe_add_key_locked (elem, key); + err =__rxe_add_key_locked (elem, key);write_unlock_irqrestore (&pool->pool_lock, flags); + +return err; }void __rxe_drop_key_locked (struct rxe_pool_entry *elem)
@@ -276,22 +282,28 @@ void __rxe_drop_key(struct rxe_pool_entry *elem)write_unlock_irqrestore (&pool->pool_lock, flags); } -void __rxe_add_index_locked (struct rxe_pool_entry *elem) +int __rxe_add_index_locked (struct rxe_pool_entry *elem) {struct rxe_pool *pool = elem->pool; +int err; elem->index =alloc_index (pool); -insert_index (pool, elem); + err =rxe_insert_index (pool, elem); + +return err; } -void __rxe_add_index (struct rxe_pool_entry *elem) +int __rxe_add_index (struct rxe_pool_entry *elem) {struct rxe_pool *pool = elem->pool;unsigned long flags; +int err;write_lock_irqsave (&pool->pool_lock, flags); -__rxe_add_index_locked (elem); + err =__rxe_add_index_locked (elem);write_unlock_irqrestore (&pool->pool_lock, flags); + +return err; }void __rxe_drop_index_locked (struct rxe_pool_entry *elem)
drivers/infiniband/sw/rxe/rxe_pool.h +4 -4
@@ -111,11 +111,11 @@ int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_entry *elem);/* assign an index to an indexed object and insert object into * pool's rb tree holding and not holding the pool_lock */ -void __rxe_add_index_locked (struct rxe_pool_entry *elem); +int __rxe_add_index_locked (struct rxe_pool_entry *elem);#define rxe_add_index_locked (obj) __rxe_add_index_locked(&(obj)->pelem) -void __rxe_add_index (struct rxe_pool_entry *elem); +int __rxe_add_index (struct rxe_pool_entry *elem);#define rxe_add_index (obj) __rxe_add_index(&(obj)->pelem)
@@ -133,11 +133,11 @@ void __rxe_drop_index(struct rxe_pool_entry *elem);/* assign a key to a keyed object and insert object into * pool's rb tree holding and not holding pool_lock */ -void __rxe_add_key_locked (struct rxe_pool_entry *elem,void *key); +int __rxe_add_key_locked (struct rxe_pool_entry *elem,void *key);#define rxe_add_key_locked (obj, key) __rxe_add_key_locked(&(obj)->pelem, key) -void __rxe_add_key (struct rxe_pool_entry *elem,void *key); +int __rxe_add_key (struct rxe_pool_entry *elem,void *key);#define rxe_add_key (obj, key) __rxe_add_key(&(obj)->pelem, key)
Signature · 1 line
2.30.2
PATCH v7 3/10 RDMA/rxe: Enable MW object pool
In reply to Bob PearsonCurrently the rxe driver has a rxe_mw struct object but nothing about memory windows is enabled. This patch turns on memory windows and some minor cleanup.
Set device attribute in rxe.c so max_mw = MAX_MW. Change parameters in rxe_param.h so that MAX_MW is the same as MAX_MR. Reduce the number of MRs and MWs to 4K from 256K. Add device capability bits for 2a and 2b memory windows. Removed RXE_MR_TYPE_MW from the rxe_mr_type enum.
--- drivers/infiniband/sw/rxe/rxe.c | 1 + drivers/infiniband/sw/rxe/rxe_param.h | 19 ++++++++++++------- drivers/infiniband/sw/rxe/rxe_verbs.h | 1 - 3 files changed, 13 insertions(+), 8 deletions(-)
drivers/infiniband/sw/rxe/rxe.c +1 -0
@@ -54,6 +54,7 @@ static void rxe_init_device_param(struct rxe_dev *rxe) rxe->attr.max_cq =RXE_MAX_CQ ; rxe->attr.max_cqe = (1 <<RXE_MAX_LOG_CQE ) -1 ; rxe->attr.max_mr =RXE_MAX_MR ; + rxe->attr.max_mw =RXE_MAX_MW ; rxe->attr.max_pd =RXE_MAX_PD ; rxe->attr.max_qp_rd_atom =RXE_MAX_QP_RD_ATOM ; rxe->attr.max_res_rd_atom =RXE_MAX_RES_RD_ATOM ;
drivers/infiniband/sw/rxe/rxe_param.h +12 -7
@@ -37,7 +37,6 @@ static inline enum ib_mtu eth_mtu_int_to_enum(int mtu)enum rxe_device_param {RXE_MAX_MR_SIZE =-1ull ,RXE_PAGE_SIZE_CAP =0xfffff000 , -RXE_MAX_QP =0x10000 ,RXE_MAX_QP_WR =0x4000 ,RXE_DEVICE_CAP_FLAGS =IB_DEVICE_BAD_PKEY_CNTR |IB_DEVICE_BAD_QKEY_CNTR
@@ -49,7 +48,10 @@ enum rxe_device_param { | IB_DEVICE_RC_RNR_NAK_GEN |IB_DEVICE_SRQ_RESIZE |IB_DEVICE_MEM_MGT_EXTENSIONS - |IB_DEVICE_ALLOW_USER_UNREG , + |IB_DEVICE_ALLOW_USER_UNREG + |IB_DEVICE_MEM_WINDOW + |IB_DEVICE_MEM_WINDOW_TYPE_2A + |IB_DEVICE_MEM_WINDOW_TYPE_2B ,RXE_MAX_SGE =32 ,RXE_MAX_WQE_SIZE =sizeof (struct rxe_send_wqe ) + sizeof(struct ib_sge) * RXE_MAX_SGE,
@@ -58,7 +60,6 @@ enum rxe_device_param {RXE_MAX_SGE_RD =32 ,RXE_MAX_CQ =16384 ,RXE_MAX_LOG_CQE =15 , -RXE_MAX_MR =256 *1024 ,RXE_MAX_PD =0x7ffc ,RXE_MAX_QP_RD_ATOM =128 , RXE_MAX_RES_RD_ATOM = 0x3f000,
@@ -67,7 +68,6 @@ enum rxe_device_param {RXE_MAX_MCAST_QP_ATTACH =56 ,RXE_MAX_TOT_MCAST_QP_ATTACH =0x70000 ,RXE_MAX_AH =100 , -RXE_MAX_SRQ =960 ,RXE_MAX_SRQ_WR =0x4000 ,RXE_MIN_SRQ_WR =1 , RXE_MAX_SRQ_SGE = 27,
@@ -80,16 +80,21 @@ enum rxe_device_param {RXE_NUM_PORT =1 , +RXE_MAX_QP =0x10000 ,RXE_MIN_QP_INDEX =16 ,RXE_MAX_QP_INDEX =0x00020000 , +RXE_MAX_SRQ =0x00001000 ,RXE_MIN_SRQ_INDEX =0x00020001 ,RXE_MAX_SRQ_INDEX =0x00040000 , +RXE_MAX_MR =0x00001000 , +RXE_MAX_MW =0x00001000 ,RXE_MIN_MR_INDEX =0x00000001 , -RXE_MAX_MR_INDEX =0x00040000 , -RXE_MIN_MW_INDEX =0x00040001 , -RXE_MAX_MW_INDEX =0x00060000 , +RXE_MAX_MR_INDEX =0x00010000 , +RXE_MIN_MW_INDEX =0x00010001 , +RXE_MAX_MW_INDEX =0x00020000 , +RXE_MAX_PKT_PER_ACK =64 , RXE_MAX_UNACKED_PSNS = 128,
drivers/infiniband/sw/rxe/rxe_verbs.h +0 -1
@@ -273,7 +273,6 @@ enum rxe_mr_type {RXE_MR_TYPE_NONE ,RXE_MR_TYPE_DMA , RXE_MR_TYPE_MR, - RXE_MR_TYPE_MW, };#define RXE_BUF_PER_MAP (PAGE_SIZE / sizeof(struct rxe_phys_buf))
Signature · 1 line
2.30.2
PATCH v7 4/10 RDMA/rxe: Add ib_alloc_mw and ib_dealloc_mw verbs
In reply to Bob PearsonAdd ib_alloc_mw and ib_dealloc_mw verbs APIs.
Added new file rxe_mw.c focused on MWs. Changed the 8 bit random key generator. Added a cleanup routine for MWs. Added verbs routines to ib_device_ops.
---
v7:
Removed duplicate INIT_RDMA_OBJ_SIZE(ib_mw, ...) in rxe_verbs.c. This was already added in patch 03/10.
--- drivers/infiniband/sw/rxe/Makefile | 1 + drivers/infiniband/sw/rxe/rxe_loc.h | 6 +++ drivers/infiniband/sw/rxe/rxe_mr.c | 20 +++++----- drivers/infiniband/sw/rxe/rxe_mw.c | 53 +++++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_pool.c | 1 + drivers/infiniband/sw/rxe/rxe_verbs.c | 2 + drivers/infiniband/sw/rxe/rxe_verbs.h | 2 + 7 files changed, 74 insertions(+), 11 deletions(-) create mode 100644 drivers/infiniband/sw/rxe/rxe_mw.c
drivers/infiniband/sw/rxe/Makefile +1 -0
@@ -15,6 +15,7 @@ rdma_rxe-y := \ rxe_qp.o \ rxe_cq.o \ rxe_mr.o \ + rxe_mw.o \ rxe_opcode.o \ rxe_mmap.o \ rxe_icrc.o \
drivers/infiniband/sw/rxe/rxe_loc.h +6 -0
@@ -76,6 +76,7 @@ enum copy_direction { from_mr_obj, }; +u8 rxe_get_next_key (u32 last_key);void rxe_mr_init_dma (struct rxe_pd *pd,int access,struct rxe_mr *mr); int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
@@ -106,6 +107,11 @@ void rxe_mr_cleanup(struct rxe_pool_entry *arg);int advance_dma_data (struct rxe_dma_info *dma,unsigned int length); +/* rxe_mw.c */ +int rxe_alloc_mw (struct ib_mw *ibmw,struct ib_udata *udata); +int rxe_dealloc_mw (struct ib_mw *ibmw); +void rxe_mw_cleanup (struct rxe_pool_entry *arg); +/* rxe_net.c */ void rxe_loopback (struct sk_buff *skb);int rxe_send (struct rxe_pkt_info *pkt,struct sk_buff *skb);
drivers/infiniband/sw/rxe/rxe_mr.c +9 -11
@@ -7,19 +7,17 @@#include "rxe.h" #include "rxe_loc.h" -/* -* lfsr (linear feedback shift register) with period 255 +/* Return a random 8 bit key value that is +* different than the last_key. Set last_key to -1 +* if this is the first key for an MR or MW */ -static u8 rxe_get_key (void ) +u8 rxe_get_next_key (u32 last_key) { -static u32 key =1 ; - - key = key <<1 ; - - key |= (0 != (key &0x100 )) ^ (0 != (key &0x10 )) - ^ (0 != (key &0x80 )) ^ (0 != (key &0x40 )); +u8 key; - key &=0xff ; +do { +get_random_bytes (&key,1 ); + }while (key == last_key);return key; }
@@ -47,7 +45,7 @@ int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length)static void rxe_mr_init (int access,struct rxe_mr *mr) { -u32 lkey = mr->pelem.index <<8 |rxe_get_key (); +u32 lkey = mr->pelem.index <<8 |rxe_get_next_key (-1 );u32 rkey = (access &IB_ACCESS_REMOTE ) ? lkey :0 ; mr->ibmr.lkey = lkey;
drivers/infiniband/sw/rxe/rxe_mw.c new file +53 -0
53 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_pool.c +1 -0
@@ -65,6 +65,7 @@ struct rxe_type_info rxe_type_info[RXE_NUM_TYPES] = { .name = "rxe-mw", .size = sizeof(struct rxe_mw), .elem_offset = offsetof(struct rxe_mw, pelem), + .cleanup = rxe_mw_cleanup, .flags = RXE_POOL_INDEX | RXE_POOL_NO_ALLOC, .max_index = RXE_MAX_MW_INDEX, .min_index = RXE_MIN_MW_INDEX,
drivers/infiniband/sw/rxe/rxe_verbs.c +2 -0
@@ -1060,6 +1060,7 @@ static const struct ib_device_ops rxe_dev_ops = { .alloc_hw_stats = rxe_ib_alloc_hw_stats, .alloc_mr = rxe_alloc_mr, + .alloc_mw = rxe_alloc_mw, .alloc_pd = rxe_alloc_pd, .alloc_ucontext = rxe_alloc_ucontext, .attach_mcast = rxe_attach_mcast,
@@ -1069,6 +1070,7 @@ static const struct ib_device_ops rxe_dev_ops = { .create_srq = rxe_create_srq, .create_user_ah = rxe_create_ah, .dealloc_driver = rxe_dealloc, + .dealloc_mw = rxe_dealloc_mw, .dealloc_pd = rxe_dealloc_pd, .dealloc_ucontext = rxe_dealloc_ucontext, .dereg_mr = rxe_dereg_mr,
drivers/infiniband/sw/rxe/rxe_verbs.h +2 -0
@@ -323,6 +323,8 @@ enum rxe_mw_state {struct rxe_mw {struct ib_mw ibmw;struct rxe_pool_entry pelem; +spinlock_t lock; +enum rxe_mw_state state; };struct rxe_mc_grp {
Signature · 1 line
2.30.2
PATCH v7 5/10 RDMA/rxe: Replace WR_REG_MASK by WR_LOCAL_OP_MASK
In reply to Bob PearsonRxe has two mask bits WR_LOCAL_MASK and WR_REG_MASK with WR_REG_MASK used to indicate any local operation and WR_LOCAL_MASK unused. This patch replaces both of these with one mask bit WR_LOCAL_OP_MASK which is clearer.
--- drivers/infiniband/sw/rxe/rxe_opcode.c | 4 ++-- drivers/infiniband/sw/rxe/rxe_opcode.h | 3 +-- drivers/infiniband/sw/rxe/rxe_req.c | 2 +- drivers/infiniband/sw/rxe/rxe_verbs.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-)
drivers/infiniband/sw/rxe/rxe_opcode.c +2 -2
@@ -87,13 +87,13 @@ struct rxe_wr_opcode_info rxe_wr_opcode_info[] = { [IB_WR_LOCAL_INV ] = { .name ="IB_WR_LOCAL_INV" , .mask = { - [IB_QPT_RC ] =WR_REG_MASK , + [IB_QPT_RC ] =WR_LOCAL_OP_MASK , }, }, [IB_WR_REG_MR ] = { .name ="IB_WR_REG_MR" , .mask = { - [IB_QPT_RC ] =WR_REG_MASK , + [IB_QPT_RC ] =WR_LOCAL_OP_MASK , }, }, };
drivers/infiniband/sw/rxe/rxe_opcode.h +1 -2
@@ -19,8 +19,7 @@ enum rxe_wr_mask {WR_SEND_MASK =BIT (2 ),WR_READ_MASK =BIT (3 ),WR_WRITE_MASK =BIT (4 ), -WR_LOCAL_MASK =BIT (5 ), -WR_REG_MASK =BIT (6 ), +WR_LOCAL_OP_MASK =BIT (5 ),WR_READ_OR_WRITE_MASK =WR_READ_MASK |WR_WRITE_MASK , WR_READ_WRITE_OR_SEND_MASK = WR_READ_OR_WRITE_MASK | WR_SEND_MASK,
drivers/infiniband/sw/rxe/rxe_req.c +1 -1
@@ -593,7 +593,7 @@ int rxe_requester(void *arg)if (unlikely (!wqe)) goto exit; -if (wqe->mask &WR_REG_MASK ) { +if (wqe->mask &WR_LOCAL_OP_MASK ) {if (wqe->wr.opcode ==IB_WR_LOCAL_INV ) {struct rxe_dev *rxe =to_rdev (qp->ibqp.device);struct rxe_mr *rmr;
drivers/infiniband/sw/rxe/rxe_verbs.c +1 -1
@@ -577,7 +577,7 @@ static void init_send_wqe(struct rxe_qp *qp, const struct ib_send_wr *ibwr,init_send_wr (qp, &wqe->wr, ibwr);/* local operation */ -if (unlikely (mask &WR_REG_MASK )) { +if (unlikely (mask &WR_LOCAL_OP_MASK )) { wqe->mask = mask; wqe->state = wqe_state_posted;return ;
Signature · 1 line
2.30.2
PATCH v7 6/10 RDMA/rxe: Move local ops to subroutine
In reply to Bob PearsonSimplify rxe_requester() by moving the local operations to a subroutine. Add an error return for illegal send WR opcode. Moved next_index ahead of rxe_run_task which fixed a small bug where work completions were delayed until after the next wqe which was not the intended behavior.
--- drivers/infiniband/sw/rxe/rxe_req.c | 89 +++++++++++++++++------------ 1 file changed, 54 insertions(+), 35 deletions(-)
drivers/infiniband/sw/rxe/rxe_req.c +54 -35
@@ -555,6 +555,56 @@ static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe, jiffies + qp->qp_timeout_jiffies); } +static int rxe_do_local_ops (struct rxe_qp *qp,struct rxe_send_wqe *wqe) +{ +u8 opcode = wqe->wr.opcode; +struct rxe_dev *rxe; +struct rxe_mr *mr; +u32 rkey; + +switch (opcode) { +case IB_WR_LOCAL_INV : + rxe =to_rdev (qp->ibqp.device); + rkey = wqe->wr.ex.invalidate_rkey; + mr =rxe_pool_get_index (&rxe->mr_pool, rkey >>8 ); +if (!mr) { +pr_err ("No MR for rkey %#x\n" , rkey); + wqe->state = wqe_state_error; + wqe->status =IB_WC_LOC_QP_OP_ERR ; +return -EINVAL ; + } + mr->state =RXE_MR_STATE_FREE ; +rxe_drop_ref (mr); +break ; +case IB_WR_REG_MR : + mr =to_rmr (wqe->wr.wr.reg.mr); + +rxe_add_ref (mr); + mr->state =RXE_MR_STATE_VALID ; + mr->access = wqe->wr.wr.reg.access; + mr->ibmr.lkey = wqe->wr.wr.reg.key; + mr->ibmr.rkey = wqe->wr.wr.reg.key; + mr->iova = wqe->wr.wr.reg.mr->iova; +rxe_drop_ref (mr); +break ; +default : +pr_err ("Unexpected send wqe opcode %d\n" , opcode); + wqe->state = wqe_state_error; + wqe->status =IB_WC_LOC_QP_OP_ERR ; +return -EINVAL ; + } + + wqe->state = wqe_state_done; + wqe->status =IB_WC_SUCCESS ; + qp->req.wqe_index =next_index (qp->sq.queue, qp->req.wqe_index); + +if ((wqe->wr.send_flags &IB_SEND_SIGNALED ) || + qp->sq_sig_type ==IB_SIGNAL_ALL_WR ) +rxe_run_task (&qp->comp.task,1 ); + +return 0 ; +} +int rxe_requester (void *arg) {struct rxe_qp *qp = (struct rxe_qp *)arg;
@@ -594,42 +644,11 @@ int rxe_requester(void *arg) goto exit;if (wqe->mask &WR_LOCAL_OP_MASK ) { -if (wqe->wr.opcode ==IB_WR_LOCAL_INV ) { -struct rxe_dev *rxe =to_rdev (qp->ibqp.device); -struct rxe_mr *rmr; - - rmr =rxe_pool_get_index (&rxe->mr_pool, - wqe->wr.ex.invalidate_rkey >>8 ); -if (!rmr) { -pr_err ("No mr for key %#x\n" , - wqe->wr.ex.invalidate_rkey); - wqe->state = wqe_state_error; - wqe->status =IB_WC_MW_BIND_ERR ; - goto exit; - } - rmr->state =RXE_MR_STATE_FREE ; -rxe_drop_ref (rmr); - wqe->state = wqe_state_done; - wqe->status =IB_WC_SUCCESS ; - }else if (wqe->wr.opcode ==IB_WR_REG_MR ) { -struct rxe_mr *rmr =to_rmr (wqe->wr.wr.reg.mr); - - rmr->state =RXE_MR_STATE_VALID ; - rmr->access = wqe->wr.wr.reg.access; - rmr->ibmr.lkey = wqe->wr.wr.reg.key; - rmr->ibmr.rkey = wqe->wr.wr.reg.key; - rmr->iova = wqe->wr.wr.reg.mr->iova; - wqe->state = wqe_state_done; - wqe->status =IB_WC_SUCCESS ; - }else { + ret =rxe_do_local_ops (qp, wqe); +if (unlikely (ret)) goto exit; - } -if ((wqe->wr.send_flags &IB_SEND_SIGNALED ) || - qp->sq_sig_type ==IB_SIGNAL_ALL_WR ) -rxe_run_task (&qp->comp.task,1 ); - qp->req.wqe_index =next_index (qp->sq.queue, - qp->req.wqe_index); - goto next_wqe; +else + goto next_wqe; } if (unlikely(qp_type(qp) == IB_QPT_RC &&
Signature · 1 line
2.30.2
PATCH v7 7/10 RDMA/rxe: Add support for bind MW work requests
In reply to Bob PearsonAdd support for bind MW work requests from user space. Since rdma/core does not support bind mw in ib_send_wr there is no way to support bind mw in kernel space.
Added bind_mw local operation in rxe_req.c. Added bind_mw WR operation in rxe_opcode.c. Added bind_mw WC in rxe_comp.c. Added additional fields to rxe_mw in rxe_verbs.h. Added rxe_do_dealloc_mw() subroutine to cleanup an mw when rxe_dealloc_mw is called. Added code to implement bind_mw operation in rxe_mw.c
--- drivers/infiniband/sw/rxe/rxe_comp.c | 1 + drivers/infiniband/sw/rxe/rxe_loc.h | 1 + drivers/infiniband/sw/rxe/rxe_mw.c | 202 ++++++++++++++++++++++++- drivers/infiniband/sw/rxe/rxe_opcode.c | 7 + drivers/infiniband/sw/rxe/rxe_req.c | 9 ++ drivers/infiniband/sw/rxe/rxe_verbs.h | 15 +- 6 files changed, 230 insertions(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_comp.c +1 -0
@@ -103,6 +103,7 @@ static enum ib_wc_opcode wr_to_wc_opcode(enum ib_wr_opcode opcode)case IB_WR_RDMA_READ_WITH_INV :return IB_WC_RDMA_READ ;case IB_WR_LOCAL_INV :return IB_WC_LOCAL_INV ;case IB_WR_REG_MR :return IB_WC_REG_MR ; +case IB_WR_BIND_MW :return IB_WC_BIND_MW ;default :return 0xff ;
drivers/infiniband/sw/rxe/rxe_loc.h +1 -0
@@ -110,6 +110,7 @@ int advance_dma_data(struct rxe_dma_info *dma, unsigned int length);/* rxe_mw.c */ int rxe_alloc_mw (struct ib_mw *ibmw,struct ib_udata *udata);int rxe_dealloc_mw (struct ib_mw *ibmw); +int rxe_bind_mw (struct rxe_qp *qp,struct rxe_send_wqe *wqe);void rxe_mw_cleanup (struct rxe_pool_entry *arg);/* rxe_net.c */
drivers/infiniband/sw/rxe/rxe_mw.c +201 -1
220 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_opcode.c +7 -0
@@ -96,6 +96,13 @@ struct rxe_wr_opcode_info rxe_wr_opcode_info[] = { [IB_QPT_RC] = WR_LOCAL_OP_MASK, }, }, + [IB_WR_BIND_MW] = { + .name = "IB_WR_BIND_MW", + .mask = { + [IB_QPT_RC] = WR_LOCAL_OP_MASK, + [IB_QPT_UC] = WR_LOCAL_OP_MASK, + }, + }, };struct rxe_opcode_info rxe_opcode[RXE_NUM_OPCODE ] = {
drivers/infiniband/sw/rxe/rxe_req.c +9 -0
@@ -561,6 +561,7 @@ static int rxe_do_local_ops(struct rxe_qp *qp, struct rxe_send_wqe *wqe)struct rxe_dev *rxe;struct rxe_mr *mr;u32 rkey; +int ret;switch (opcode) {case IB_WR_LOCAL_INV :
@@ -587,6 +588,14 @@ static int rxe_do_local_ops(struct rxe_qp *qp, struct rxe_send_wqe *wqe) mr->iova = wqe->wr.wr.reg.mr->iova;rxe_drop_ref (mr);break ; +case IB_WR_BIND_MW : + ret =rxe_bind_mw (qp, wqe); +if (ret) { + wqe->state = wqe_state_error; + wqe->status =IB_WC_MW_BIND_ERR ; +return -EINVAL ; + } +break ;default :pr_err ("Unexpected send wqe opcode %d\n" , opcode); wqe->state = wqe_state_error;
drivers/infiniband/sw/rxe/rxe_verbs.h +11 -4
@@ -312,6 +312,8 @@ struct rxe_mr {u32 num_map;struct rxe_map **map; + +atomic_t num_mw; };enum rxe_mw_state {
@@ -321,10 +323,15 @@ enum rxe_mw_state { };struct rxe_mw { -struct ib_mw ibmw; -struct rxe_pool_entry pelem; -spinlock_t lock; -enum rxe_mw_state state; +struct ib_mw ibmw; +struct rxe_pool_entry pelem; +spinlock_t lock; +enum rxe_mw_state state; +struct rxe_qp *qp;/* Type 2 only */ +struct rxe_mr *mr; +int access; +u64 addr; +u64 length; };struct rxe_mc_grp {
Signature · 1 line
2.30.2
PATCH v7 8/10 RDMA/rxe: Implement invalidate MW operations
In reply to Bob PearsonImplement invalidate MW and cleaned up invalidate MR operations.
Added code to perform remote invalidate for send with invalidate. Added code to perform local invalidation. Deleted some blank lines in rxe_loc.h.
---
v6:
Added rxe_ to subroutine names in lines that changed.
v3:
Replaced enums in lower case with upper case and moved to rxe_verbs.h which is where enums live.
--- drivers/infiniband/sw/rxe/rxe_comp.c | 4 +- drivers/infiniband/sw/rxe/rxe_loc.h | 29 ++-------- drivers/infiniband/sw/rxe/rxe_mr.c | 81 ++++++++++++++++++--------- drivers/infiniband/sw/rxe/rxe_mw.c | 67 ++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_req.c | 24 ++++---- drivers/infiniband/sw/rxe/rxe_resp.c | 60 ++++++++++++-------- drivers/infiniband/sw/rxe/rxe_verbs.h | 33 ++++++++--- 7 files changed, 204 insertions(+), 94 deletions(-)
drivers/infiniband/sw/rxe/rxe_comp.c +2 -2
@@ -346,7 +346,7 @@ static inline enum comp_state do_read(struct rxe_qp *qp, ret =copy_data (qp->pd,IB_ACCESS_LOCAL_WRITE , &wqe->dma,payload_addr (pkt), -payload_size (pkt), to_mr_obj,NULL ); +payload_size (pkt),RXE_TO_MR_OBJ ,NULL );if (ret)return COMPST_ERROR ;
@@ -366,7 +366,7 @@ static inline enum comp_state do_atomic(struct rxe_qp *qp, ret =copy_data (qp->pd,IB_ACCESS_LOCAL_WRITE , &wqe->dma, &atomic_orig, -sizeof (u64), to_mr_obj,NULL ); +sizeof (u64),RXE_TO_MR_OBJ ,NULL );if (ret)return COMPST_ERROR ;else
drivers/infiniband/sw/rxe/rxe_loc.h +6 -23
@@ -71,46 +71,29 @@ struct rxe_mmap_info *rxe_create_mmap_info(struct rxe_dev *dev, u32 size,int rxe_mmap (struct ib_ucontext *context,struct vm_area_struct *vma);/* rxe_mr.c */ -enum copy_direction { - to_mr_obj, - from_mr_obj, -}; -u8 rxe_get_next_key (u32 last_key);void rxe_mr_init_dma (struct rxe_pd *pd,int access,struct rxe_mr *mr); -int rxe_mr_init_user (struct rxe_pd *pd,u64 start,u64 length,u64 iova,int access,struct rxe_mr *mr); -int rxe_mr_init_fast (struct rxe_pd *pd,int max_pages,struct rxe_mr *mr); -int rxe_mr_copy (struct rxe_mr *mr,u64 iova,void *addr,int length, -enum copy_direction dir,u32 *crcp); - +enum rxe_mr_copy_dir dir,u32 *crcp);int copy_data (struct rxe_pd *pd,int access,struct rxe_dma_info *dma,void *addr,int length, -enum copy_direction dir,u32 *crcp); - +enum rxe_mr_copy_dir dir,u32 *crcp);void *iova_to_vaddr (struct rxe_mr *mr,u64 iova,int length); - -enum lookup_type { - lookup_local, - lookup_remote, -}; -struct rxe_mr *lookup_mr (struct rxe_pd *pd,int access,u32 key, -enum lookup_type type); - +enum rxe_mr_lookup_type type);int mr_check_range (struct rxe_mr *mr,u64 iova,size_t length); - -void rxe_mr_cleanup (struct rxe_pool_entry *arg); -int advance_dma_data (struct rxe_dma_info *dma,unsigned int length); +int rxe_invalidate_mr (struct rxe_qp *qp,u32 rkey); +void rxe_mr_cleanup (struct rxe_pool_entry *arg);/* rxe_mw.c */ int rxe_alloc_mw (struct ib_mw *ibmw,struct ib_udata *udata);int rxe_dealloc_mw (struct ib_mw *ibmw);int rxe_bind_mw (struct rxe_qp *qp,struct rxe_send_wqe *wqe); +int rxe_invalidate_mw (struct rxe_qp *qp,u32 rkey);void rxe_mw_cleanup (struct rxe_pool_entry *arg);/* rxe_net.c */
drivers/infiniband/sw/rxe/rxe_mr.c +55 -26
139 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_mw.c +67 -0
73 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_req.c +13 -11
@@ -464,7 +464,7 @@ static int fill_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe, }else { err =copy_data (qp->pd,0 , &wqe->dma,payload_addr (pkt), paylen, - from_mr_obj, +RXE_FROM_MR_OBJ , &crc);if (err)return err;
@@ -558,25 +558,25 @@ static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe,static int rxe_do_local_ops (struct rxe_qp *qp,struct rxe_send_wqe *wqe) {u8 opcode = wqe->wr.opcode; -struct rxe_dev *rxe;struct rxe_mr *mr; -u32 rkey;int ret; +u32 rkey;switch (opcode) {case IB_WR_LOCAL_INV : - rxe =to_rdev (qp->ibqp.device); rkey = wqe->wr.ex.invalidate_rkey; - mr =rxe_pool_get_index (&rxe->mr_pool, rkey >>8 ); -if (!mr) { -pr_err ("No MR for rkey %#x\n" , rkey); +if (rkey_is_mw (rkey)) + ret =rxe_invalidate_mw (qp, rkey); +else + ret =rxe_invalidate_mr (qp, rkey); + +if (ret) { wqe->state = wqe_state_error; wqe->status =IB_WC_LOC_QP_OP_ERR ; -return -EINVAL ; +return ret; } - mr->state =RXE_MR_STATE_FREE ; -rxe_drop_ref (mr);break ; +case IB_WR_REG_MR : mr =to_rmr (wqe->wr.wr.reg.mr);
@@ -588,14 +588,16 @@ static int rxe_do_local_ops(struct rxe_qp *qp, struct rxe_send_wqe *wqe) mr->iova = wqe->wr.wr.reg.mr->iova;rxe_drop_ref (mr);break ; +case IB_WR_BIND_MW : ret =rxe_bind_mw (qp, wqe);if (ret) { wqe->state = wqe_state_error; wqe->status =IB_WC_MW_BIND_ERR ; -return -EINVAL ; +return ret; }break ; +default :pr_err ("Unexpected send wqe opcode %d\n" , opcode); wqe->state = wqe_state_error;
drivers/infiniband/sw/rxe/rxe_resp.c +36 -24
134 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_verbs.h +25 -8
@@ -275,6 +275,16 @@ enum rxe_mr_type { RXE_MR_TYPE_MR, }; +enum rxe_mr_copy_dir { +RXE_TO_MR_OBJ , +RXE_FROM_MR_OBJ , +}; + +enum rxe_mr_lookup_type { +RXE_LOOKUP_LOCAL , +RXE_LOOKUP_REMOTE , +}; +#define RXE_BUF_PER_MAP (PAGE_SIZE / sizeof(struct rxe_phys_buf))struct rxe_phys_buf {
@@ -286,6 +296,13 @@ struct rxe_map {struct rxe_phys_buf buf[RXE_BUF_PER_MAP ]; }; +static inline int rkey_is_mw (u32 rkey) +{ +u32 index = rkey >>8 ; + +return (index >=RXE_MIN_MW_INDEX ) && (index <=RXE_MAX_MW_INDEX ); +} +struct rxe_mr {struct rxe_pool_entry pelem;struct ib_mr ibmr;
@@ -311,23 +328,23 @@ struct rxe_mr {u32 max_buf;u32 num_map; -struct rxe_map **map; -atomic_t num_mw; + +struct rxe_map **map; };enum rxe_mw_state { -RXE_MW_STATE_INVALID =RXE_MR_STATE_INVALID , -RXE_MW_STATE_FREE =RXE_MR_STATE_FREE , -RXE_MW_STATE_VALID =RXE_MR_STATE_VALID , +RXE_MW_STATE_INVALID =RXE_MR_STATE_INVALID , +RXE_MW_STATE_FREE =RXE_MR_STATE_FREE , +RXE_MW_STATE_VALID =RXE_MR_STATE_VALID , };struct rxe_mw { -struct ib_mw ibmw; -struct rxe_pool_entry pelem; +struct ib_mw ibmw; +struct rxe_pool_entry pelem;spinlock_t lock;enum rxe_mw_state state; -struct rxe_qp *qp;/* Type 2 only */ +struct rxe_qp *qp;/* Type 2 only */ struct rxe_mr *mr;int access;u64 addr;
Signature · 1 line
2.30.2
PATCH v7 9/10 RDMA/rxe: Implement memory access through MWs
In reply to Bob PearsonAdd code to implement memory access through memory windows.
--- drivers/infiniband/sw/rxe/rxe_loc.h | 1 + drivers/infiniband/sw/rxe/rxe_mw.c | 23 +++++++++++ drivers/infiniband/sw/rxe/rxe_resp.c | 55 +++++++++++++++++++-------- drivers/infiniband/sw/rxe/rxe_verbs.h | 11 ++++++ 4 files changed, 75 insertions(+), 15 deletions(-)
drivers/infiniband/sw/rxe/rxe_loc.h +1 -0
@@ -94,6 +94,7 @@ int rxe_alloc_mw(struct ib_mw *ibmw, struct ib_udata *udata);int rxe_dealloc_mw (struct ib_mw *ibmw);int rxe_bind_mw (struct rxe_qp *qp,struct rxe_send_wqe *wqe);int rxe_invalidate_mw (struct rxe_qp *qp,u32 rkey); +struct rxe_mw *rxe_lookup_mw (struct rxe_qp *qp,int access,u32 rkey);void rxe_mw_cleanup (struct rxe_pool_entry *arg);/* rxe_net.c */
drivers/infiniband/sw/rxe/rxe_mw.c +23 -0
@@ -312,6 +312,29 @@ int rxe_invalidate_mw(struct rxe_qp *qp, u32 rkey)return ret; } +struct rxe_mw *rxe_lookup_mw (struct rxe_qp *qp,int access,u32 rkey) +{ +struct rxe_dev *rxe =to_rdev (qp->ibqp.device); +struct rxe_pd *pd =to_rpd (qp->ibqp.pd); +struct rxe_mw *mw; +int index = rkey >>8 ; + + mw =rxe_pool_get_index (&rxe->mw_pool, index); +if (!mw) +return NULL ; + +if (unlikely ((rxe_mw_rkey (mw) != rkey) ||rxe_mw_pd (mw) != pd || + (mw->ibmw.type ==IB_MW_TYPE_2 && mw->qp != qp) || + (mw->length ==0 ) || + (access && !(access & mw->access)) || + mw->state !=RXE_MW_STATE_VALID )) { +rxe_drop_ref (mw); +return NULL ; + } + +return mw; +} +void rxe_mw_cleanup (struct rxe_pool_entry *elem) {struct rxe_mw *mw =container_of (elem,typeof (*mw), pelem);
drivers/infiniband/sw/rxe/rxe_resp.c +40 -15
112 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_verbs.h +11 -0
@@ -183,6 +183,7 @@ struct rxe_resp_info {/* RDMA read / atomic only */ u64 va; +u64 offset;struct rxe_mr *mr;u32 resid;u32 rkey;
@@ -480,6 +481,16 @@ static inline u32 mr_rkey(struct rxe_mr *mr)return mr->ibmr.rkey; } +static inline struct rxe_pd *rxe_mw_pd (struct rxe_mw *mw) +{ +return to_rpd (mw->ibmw.pd); +} + +static inline u32 rxe_mw_rkey (struct rxe_mw *mw) +{ +return mw->ibmw.rkey; +} +int rxe_register_device (struct rxe_dev *rxe,const char *ibdev_name);void rxe_mc_cleanup (struct rxe_pool_entry *arg);
Signature · 1 line
2.30.2
PATCH v7 10/10 RDMA/rxe: Disallow MR dereg and invalidate when bound
In reply to Bob PearsonCheck that an MR has no bound MWs before allowing a dereg or invalidate operation.
--- drivers/infiniband/sw/rxe/rxe_loc.h | 1 + drivers/infiniband/sw/rxe/rxe_mr.c | 25 +++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_verbs.c | 11 ----------- 3 files changed, 26 insertions(+), 11 deletions(-)
drivers/infiniband/sw/rxe/rxe_loc.h +1 -0
@@ -87,6 +87,7 @@ struct rxe_mr *lookup_mr(struct rxe_pd *pd, int access, u32 key,int mr_check_range (struct rxe_mr *mr,u64 iova,size_t length);int advance_dma_data (struct rxe_dma_info *dma,unsigned int length);int rxe_invalidate_mr (struct rxe_qp *qp,u32 rkey); +int rxe_dereg_mr (struct ib_mr *ibmr,struct ib_udata *udata);void rxe_mr_cleanup (struct rxe_pool_entry *arg);/* rxe_mw.c */
drivers/infiniband/sw/rxe/rxe_mr.c +25 -0
@@ -546,6 +546,13 @@ int rxe_invalidate_mr(struct rxe_qp *qp, u32 rkey) goto err_drop_ref; } +if (atomic_read (&mr->num_mw) >0 ) { +pr_warn ("%s: Attempt to invalidate an MR while bound to MWs\n" , + __func__); + ret = -EINVAL ; + goto err_drop_ref; + } + mr->state =RXE_MR_STATE_FREE ; ret =0 ;
@@ -555,6 +562,24 @@ int rxe_invalidate_mr(struct rxe_qp *qp, u32 rkey)return ret; } +int rxe_dereg_mr (struct ib_mr *ibmr,struct ib_udata *udata) +{ +struct rxe_mr *mr =to_rmr (ibmr); + +if (atomic_read (&mr->num_mw) >0 ) { +pr_warn ("%s: Attempt to deregister an MR while bound to MWs\n" , + __func__); +return -EINVAL ; + } + + mr->state =RXE_MR_STATE_ZOMBIE ; +rxe_drop_ref (mr_pd (mr)); +rxe_drop_index (mr); +rxe_drop_ref (mr); + +return 0 ; +} +void rxe_mr_cleanup (struct rxe_pool_entry *arg) {struct rxe_mr *mr =container_of (arg,typeof (*mr), pelem);
drivers/infiniband/sw/rxe/rxe_verbs.c +0 -11
@@ -913,17 +913,6 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd,return ERR_PTR (err); } -static int rxe_dereg_mr (struct ib_mr *ibmr,struct ib_udata *udata) -{ -struct rxe_mr *mr =to_rmr (ibmr); - - mr->state =RXE_MR_STATE_ZOMBIE ; -rxe_drop_ref (mr_pd (mr)); -rxe_drop_index (mr); -rxe_drop_ref (mr); -return 0 ; -} -static struct ib_mr *rxe_alloc_mr (struct ib_pd *ibpd,enum ib_mr_type mr_type,u32 max_num_sg) {
Signature · 1 line
2.30.2
Zhu Yanjun
maintainerQuoted 9 lines · Bob Pearson
This series of patches implement memory windows for the
rdma_rxedriver. This is a shorter reimplementation of an earlier patch set. They apply to and depend on the current for-next linux rdma tree.Signed-off-by Bob Pearson <[email protected]>---
v7:
Fixed a duplicateINIT_RDMA_OBJ_SIZE(ib_mw, ...)inrxe_verbs.c.
With this patch series, there are about 17 errors and 1 failure in rdma-core. "
----------------------------------------------------------------------
Ran 183 tests in 2.130s
FAILED (failures=1, errors=17, skipped=124)
"
After these patches, not sure if rxe can communicate with the physical NICs correctly because of the
above errors and failure.
Zhu Yanjun
Quoted 47 lines
v6:
Addedrxe_prefix to subroutine names in lines that changed from Zhu's review of v5.
v5:
Fixed a typo in 10th patch.
v4:
Added a 10th patch to check when MRs have bound MWs and disallow dereg and invalidate operations.
v3:
cleaned up void return and lower case enums from Zhu's review.
v2:
cleaned up an issue inrdma_user_rxe.h
cleaned up a collision inrxe_resp.cBob Pearson (9):
RDMA/rxe: Add bind MW fields torxe_send_wrRDMA/rxe: Return errors for add index and key RDMA/rxe: Enable MW object pool
RDMA/rxe: Addib_alloc_mwandib_dealloc_mwverbs RDMA/rxe: ReplaceWR_REG_MASKbyWR_LOCAL_OP_MASKRDMA/rxe: Move local ops to subroutine RDMA/rxe: Add support for bind MW work requests RDMA/rxe: Implement invalidate MW operations RDMA/rxe: Implement memory access through MWsdrivers/infiniband/sw/rxe/Makefile | 1 + drivers/infiniband/sw/rxe/rxe.c | 1 + drivers/infiniband/sw/rxe/rxe_comp.c | 1 + drivers/infiniband/sw/rxe/rxe_loc.h | 29 +- drivers/infiniband/sw/rxe/rxe_mr.c | 79 ++++-- drivers/infiniband/sw/rxe/rxe_mw.c | 356 +++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_opcode.c | 11 +- drivers/infiniband/sw/rxe/rxe_opcode.h | 3 +- drivers/infiniband/sw/rxe/rxe_param.h | 19 +- drivers/infiniband/sw/rxe/rxe_pool.c | 45 ++-- drivers/infiniband/sw/rxe/rxe_pool.h | 8 +- drivers/infiniband/sw/rxe/rxe_req.c | 102 ++++--- drivers/infiniband/sw/rxe/rxe_resp.c | 110 +++++--- drivers/infiniband/sw/rxe/rxe_verbs.c | 5 +- drivers/infiniband/sw/rxe/rxe_verbs.h | 38 ++- include/uapi/rdma/rdma_user_rxe.h | 34 ++- 16 files changed, 691 insertions(+), 151 deletions(-) create mode 100644 drivers/infiniband/sw/rxe/rxe_mw.c--
2.27.0
Quoted 10 lines · Zhu Yanjun
Quoted 8 lines · Bob Pearson
This series of patches implement memory windows for the
rdma_rxedriver. This is a shorter reimplementation of an earlier patch set. They apply to and depend on the current for-next linux rdma tree.Signed-off-by Bob Pearson <[email protected]>---
v7:
Fixed a duplicateINIT_RDMA_OBJ_SIZE(ib_mw, ...)inrxe_verbs.c.With this patch series, there are about 17 errors and 1 failure in rdma-core.
Zhu,
You have to sync the kernel-header file with the kernel.
Bob
Quoted 60 lines
"
----------------------------------------------------------------------
Ran 183 tests in 2.130sFAILED (failures=1, errors=17, skipped=124)
"After these patches, not sure if rxe can communicate with the physical NICs correctly because of the
above errors and failure.Zhu Yanjun
Quoted 47 lines
v6:
Addedrxe_prefix to subroutine names in lines that changed from Zhu's review of v5.
v5:
Fixed a typo in 10th patch.
v4:
Added a 10th patch to check when MRs have bound MWs and disallow dereg and invalidate operations.
v3:
cleaned up void return and lower case enums from Zhu's review.
v2:
cleaned up an issue inrdma_user_rxe.h
cleaned up a collision inrxe_resp.cBob Pearson (9):
RDMA/rxe: Add bind MW fields torxe_send_wrRDMA/rxe: Return errors for add index and key RDMA/rxe: Enable MW object pool
RDMA/rxe: Addib_alloc_mwandib_dealloc_mwverbs RDMA/rxe: ReplaceWR_REG_MASKbyWR_LOCAL_OP_MASKRDMA/rxe: Move local ops to subroutine RDMA/rxe: Add support for bind MW work requests RDMA/rxe: Implement invalidate MW operations RDMA/rxe: Implement memory access through MWsdrivers/infiniband/sw/rxe/Makefile | 1 + drivers/infiniband/sw/rxe/rxe.c | 1 + drivers/infiniband/sw/rxe/rxe_comp.c | 1 + drivers/infiniband/sw/rxe/rxe_loc.h | 29 +- drivers/infiniband/sw/rxe/rxe_mr.c | 79 ++++-- drivers/infiniband/sw/rxe/rxe_mw.c | 356 +++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_opcode.c | 11 +- drivers/infiniband/sw/rxe/rxe_opcode.h | 3 +- drivers/infiniband/sw/rxe/rxe_param.h | 19 +- drivers/infiniband/sw/rxe/rxe_pool.c | 45 ++-- drivers/infiniband/sw/rxe/rxe_pool.h | 8 +- drivers/infiniband/sw/rxe/rxe_req.c | 102 ++++--- drivers/infiniband/sw/rxe/rxe_resp.c | 110 +++++--- drivers/infiniband/sw/rxe/rxe_verbs.c | 5 +- drivers/infiniband/sw/rxe/rxe_verbs.h | 38 ++- include/uapi/rdma/rdma_user_rxe.h | 34 ++- 16 files changed, 691 insertions(+), 151 deletions(-)create mode 100644
drivers/infiniband/sw/rxe/rxe_mw.c
--
2.27.0
Zhu Yanjun
maintainerQuoted 11 lines · Robert B
Quoted 9 lines · Zhu Yanjun
Quoted 8 lines · Bob Pearson
This series of patches implement memory windows for the
rdma_rxedriver. This is a shorter reimplementation of an earlier patch set. They apply to and depend on the current for-next linux rdma tree.Signed-off-by Bob Pearson <[email protected]>---
v7:
Fixed a duplicateINIT_RDMA_OBJ_SIZE(ib_mw, ...)inrxe_verbs.c.
Quoted 5 lines
Quoted 1 line
With this patch series, there are about 17 errors and 1 failure in rdma-core.
Zhu,
You have to sync the kernel-header file with the kernel.
From the link https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/kbuild/headers_install.rst?h=v5.13-rc3
you mean "make headers_install"?
In fact, after "make headers_install", these patches still cause errors and failures in rdma-core.
I will delve into these errors of rdma-core. Too many errors.
Zhu Yanjun
Quoted 63 lines
Bob
Quoted 60 lines
"
----------------------------------------------------------------------
Ran 183 tests in 2.130sFAILED (failures=1, errors=17, skipped=124)
"After these patches, not sure if rxe can communicate with the physical NICs correctly because of the
above errors and failure.Zhu Yanjun
Quoted 47 lines
v6:
Addedrxe_prefix to subroutine names in lines that changed from Zhu's review of v5.
v5:
Fixed a typo in 10th patch.
v4:
Added a 10th patch to check when MRs have bound MWs and disallow dereg and invalidate operations.
v3:
cleaned up void return and lower case enums from Zhu's review.
v2:
cleaned up an issue inrdma_user_rxe.h
cleaned up a collision inrxe_resp.cBob Pearson (9):
RDMA/rxe: Add bind MW fields torxe_send_wrRDMA/rxe: Return errors for add index and key RDMA/rxe: Enable MW object pool
RDMA/rxe: Addib_alloc_mwandib_dealloc_mwverbs RDMA/rxe: ReplaceWR_REG_MASKbyWR_LOCAL_OP_MASKRDMA/rxe: Move local ops to subroutine RDMA/rxe: Add support for bind MW work requests RDMA/rxe: Implement invalidate MW operations RDMA/rxe: Implement memory access through MWsdrivers/infiniband/sw/rxe/Makefile | 1 + drivers/infiniband/sw/rxe/rxe.c | 1 + drivers/infiniband/sw/rxe/rxe_comp.c | 1 + drivers/infiniband/sw/rxe/rxe_loc.h | 29 +- drivers/infiniband/sw/rxe/rxe_mr.c | 79 ++++-- drivers/infiniband/sw/rxe/rxe_mw.c | 356 +++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_opcode.c | 11 +- drivers/infiniband/sw/rxe/rxe_opcode.h | 3 +- drivers/infiniband/sw/rxe/rxe_param.h | 19 +- drivers/infiniband/sw/rxe/rxe_pool.c | 45 ++-- drivers/infiniband/sw/rxe/rxe_pool.h | 8 +- drivers/infiniband/sw/rxe/rxe_req.c | 102 ++++--- drivers/infiniband/sw/rxe/rxe_resp.c | 110 +++++--- drivers/infiniband/sw/rxe/rxe_verbs.c | 5 +- drivers/infiniband/sw/rxe/rxe_verbs.h | 38 ++- include/uapi/rdma/rdma_user_rxe.h | 34 ++- 16 files changed, 691 insertions(+), 151 deletions(-)create mode 100644
drivers/infiniband/sw/rxe/rxe_mw.c
--
2.27.0
Zhu,
I'm not sure about the script. Starting from where you were I copied <LINUX>/include/uapi/rdma/rdma_user_rxe.h to <RDMA_CORE>/kernel-headers/rdma/rdma_user_rxe.h. After running the script you should be able to just diff these two files to make sure they are the same. If they aren't copy the header file over. After the shift to 5.13 rc1+ I re-pulled both trees and applied the kernel patches and then built everything. The python test cases look like
.............sssssssss.............sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss.ssssssssssssssssssssssssss....ssss.............s.....s.......ssssssssss..ss
----------------------------------------------------------------------
Ran 182 tests in 0.380s
OK (skipped=124)
There are a lot of skips but no errors. The skips are from features that rxe does not support.
Adding the MW rdma_core patch picks up a small number of additional test cases involving memory windows.
Regards,
Bob
-----Original Message-----
From: Zhu Yanjun <[email protected]>
Sent: Monday, May 24, 2021 9:09 PM
To: Pearson, Robert B <[email protected]>
Cc: Jason Gunthorpe <[email protected]>; RDMA mailing list <[email protected]>
Subject: Re: [PATCH for-next v7 00/10] RDMA/rxe: Implement memory windows
Quoted 11 lines · Robert B
Quoted 9 lines · Zhu Yanjun
Quoted 8 lines · Bob Pearson
This series of patches implement memory windows for the
rdma_rxedriver. This is a shorter reimplementation of an earlier patch set. They apply to and depend on the current for-next linux rdma tree.Signed-off-by Bob Pearson <[email protected]>---
v7:
Fixed a duplicateINIT_RDMA_OBJ_SIZE(ib_mw, ...)inrxe_verbs.c.
Quoted 5 lines
Quoted 1 line
With this patch series, there are about 17 errors and 1 failure in rdma-core.
Zhu,
You have to sync the kernel-header file with the kernel.
From the link https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/kbuild/headers_install.rst?h=v5.13-rc3
you mean "make headers_install"?
In fact, after "make headers_install", these patches still cause errors and failures in rdma-core.
I will delve into these errors of rdma-core. Too many errors.
Zhu Yanjun
Quoted 62 lines
Bob
Quoted 59 lines
"
--------------------------------------------------------------------
--
Ran 183 tests in 2.130sFAILED (failures=1, errors=17, skipped=124) "
After these patches, not sure if rxe can communicate with the physical NICs correctly because of the above errors and failure.
Zhu Yanjun
Quoted 47 lines
v6:
Addedrxe_prefix to subroutine names in lines that changed from Zhu's review of v5.
v5:
Fixed a typo in 10th patch.
v4:
Added a 10th patch to check when MRs have bound MWs and disallow dereg and invalidate operations.
v3:
cleaned up void return and lower case enums from Zhu's review.
v2:
cleaned up an issue inrdma_user_rxe.h
cleaned up a collision inrxe_resp.cBob Pearson (9):
RDMA/rxe: Add bind MW fields torxe_send_wrRDMA/rxe: Return errors for add index and key RDMA/rxe: Enable MW object pool
RDMA/rxe: Addib_alloc_mwandib_dealloc_mwverbs RDMA/rxe: ReplaceWR_REG_MASKbyWR_LOCAL_OP_MASKRDMA/rxe: Move local ops to subroutine RDMA/rxe: Add support for bind MW work requests RDMA/rxe: Implement invalidate MW operations RDMA/rxe: Implement memory access through MWsdrivers/infiniband/sw/rxe/Makefile | 1 + drivers/infiniband/sw/rxe/rxe.c | 1 + drivers/infiniband/sw/rxe/rxe_comp.c | 1 + drivers/infiniband/sw/rxe/rxe_loc.h | 29 +- drivers/infiniband/sw/rxe/rxe_mr.c | 79 ++++-- drivers/infiniband/sw/rxe/rxe_mw.c | 356 +++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_opcode.c | 11 +- drivers/infiniband/sw/rxe/rxe_opcode.h | 3 +- drivers/infiniband/sw/rxe/rxe_param.h | 19 +- drivers/infiniband/sw/rxe/rxe_pool.c | 45 ++-- drivers/infiniband/sw/rxe/rxe_pool.h | 8 +- drivers/infiniband/sw/rxe/rxe_req.c | 102 ++++--- drivers/infiniband/sw/rxe/rxe_resp.c | 110 +++++--- drivers/infiniband/sw/rxe/rxe_verbs.c | 5 +- drivers/infiniband/sw/rxe/rxe_verbs.h | 38 ++- include/uapi/rdma/rdma_user_rxe.h | 34 ++- 16 files changed, 691 insertions(+), 151 deletions(-)create mode 100644
drivers/infiniband/sw/rxe/rxe_mw.c
--
2.27.0
Zhu Yanjun
maintainerQuoted 9 lines · Robert B
Zhu,
I'm not sure about the script. Starting from where you were I copied <LINUX>/include/uapi/rdma/rdma_user_rxe.h to <RDMA_CORE>/kernel-headers/rdma/rdma_user_rxe.h. After running the script you should be able to just diff these two files to make sure they are the same. If they aren't copy the header file over. After the shift to 5.13 rc1+ I re-pulled both trees and applied the kernel patches and then built everything. The python test cases look like
.............sssssssss.............sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss.ssssssssssssssssssssssssss....ssss.............s.....s.......ssssssssss..ss
----------------------------------------------------------------------
Ran 182 tests in 0.380s
Thanks. Please submit a new patch for this problem.
Quoted 6 lines
OK (skipped=124)
There are a lot of skips but no errors. The skips are from features that rxe does not support.
Adding the MW
rdma_corepatch picks up a small number of additional test cases involving memory windows.
Thanks a lot. Look forward to these additional test cases involving memory windows.
Zhu Yanjun
Quoted 101 lines
Regards,
Bob
-----Original Message-----
From: Zhu Yanjun <[email protected]>
Sent: Monday, May 24, 2021 9:09 PM
To: Pearson, Robert B <[email protected]>
Cc: Jason Gunthorpe <[email protected]>; RDMA mailing list <[email protected]>
Subject: Re: [PATCH for-next v7 00/10] RDMA/rxe: Implement memory windowsQuoted 11 lines · Robert B
Quoted 9 lines · Zhu Yanjun
Quoted 8 lines · Bob Pearson
This series of patches implement memory windows for the
rdma_rxedriver. This is a shorter reimplementation of an earlier patch set. They apply to and depend on the current for-next linux rdma tree.Signed-off-by Bob Pearson <[email protected]>---
v7:
Fixed a duplicateINIT_RDMA_OBJ_SIZE(ib_mw, ...)inrxe_verbs.c.Quoted 5 lines
Quoted 1 line
With this patch series, there are about 17 errors and 1 failure in rdma-core.
Zhu,
You have to sync the kernel-header file with the kernel.
From the link https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/kbuild/headers_install.rst?h=v5.13-rc3
you mean "makeheaders_install"?In fact, after "make
headers_install", these patches still cause errors and failures in rdma-core.I will delve into these errors of rdma-core. Too many errors.
Zhu Yanjun
Quoted 62 lines
Bob
Quoted 59 lines
"
--------------------------------------------------------------------
--
Ran 183 tests in 2.130sFAILED (failures=1, errors=17, skipped=124) "
After these patches, not sure if rxe can communicate with the physical NICs correctly because of the above errors and failure.
Zhu Yanjun
Quoted 47 lines
v6:
Addedrxe_prefix to subroutine names in lines that changed from Zhu's review of v5.
v5:
Fixed a typo in 10th patch.
v4:
Added a 10th patch to check when MRs have bound MWs and disallow dereg and invalidate operations.
v3:
cleaned up void return and lower case enums from Zhu's review.
v2:
cleaned up an issue inrdma_user_rxe.h
cleaned up a collision inrxe_resp.cBob Pearson (9):
RDMA/rxe: Add bind MW fields torxe_send_wrRDMA/rxe: Return errors for add index and key RDMA/rxe: Enable MW object pool
RDMA/rxe: Addib_alloc_mwandib_dealloc_mwverbs RDMA/rxe: ReplaceWR_REG_MASKbyWR_LOCAL_OP_MASKRDMA/rxe: Move local ops to subroutine RDMA/rxe: Add support for bind MW work requests RDMA/rxe: Implement invalidate MW operations RDMA/rxe: Implement memory access through MWsdrivers/infiniband/sw/rxe/Makefile | 1 + drivers/infiniband/sw/rxe/rxe.c | 1 + drivers/infiniband/sw/rxe/rxe_comp.c | 1 + drivers/infiniband/sw/rxe/rxe_loc.h | 29 +- drivers/infiniband/sw/rxe/rxe_mr.c | 79 ++++-- drivers/infiniband/sw/rxe/rxe_mw.c | 356 +++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_opcode.c | 11 +- drivers/infiniband/sw/rxe/rxe_opcode.h | 3 +- drivers/infiniband/sw/rxe/rxe_param.h | 19 +- drivers/infiniband/sw/rxe/rxe_pool.c | 45 ++-- drivers/infiniband/sw/rxe/rxe_pool.h | 8 +- drivers/infiniband/sw/rxe/rxe_req.c | 102 ++++--- drivers/infiniband/sw/rxe/rxe_resp.c | 110 +++++--- drivers/infiniband/sw/rxe/rxe_verbs.c | 5 +- drivers/infiniband/sw/rxe/rxe_verbs.h | 38 ++- include/uapi/rdma/rdma_user_rxe.h | 34 ++- 16 files changed, 691 insertions(+), 151 deletions(-)create mode 100644
drivers/infiniband/sw/rxe/rxe_mw.c
--
2.27.0
There's nothing to change. There is no problem. Just get the headers sync'ed.
If that doesn't fix your issues your tree has gotten corrupted somehow. But, I don't think that is the issue. I saw the same type of errors you reported when rdma_core is built with the old header file. That definitely will cause problems. The size of the send queue WQEs changed because new fields were added. Then user space and the kernel immediately get off from each other.
Good luck,
Bob
-----Original Message-----
From: Zhu Yanjun <[email protected]>
Sent: Tuesday, May 25, 2021 12:18 AM
To: Pearson, Robert B <[email protected]>
Cc: Pearson, Robert B <[email protected]>; Jason Gunthorpe <[email protected]>; RDMA mailing list <[email protected]>
Subject: Re: [PATCH for-next v7 00/10] RDMA/rxe: Implement memory windows
Quoted 12 lines · Robert B
Zhu,
I'm not sure about the script. Starting from where you were I copied <LINUX>/include/uapi/rdma/rdma_user_rxe.h to <RDMA_CORE>/kernel-headers/rdma/rdma_user_rxe.h. After running the script you should be able to just diff these two files to make sure they are the same. If they aren't copy the header file over. After the shift to 5.13
rc1+ I re-pulled both trees and applied the kernel patches and then rc1+ built everything. The python test cases look like
Quoted 5 lines
.............sssssssss.............sssssssssssssssssssssssssssssssssss ssssssssssssssssssssssssssssssssssss.ssssssssssssssssssssssssss....sss s.............s.....s.......ssssssssss..ss
----------------------------------------------------------------------
Ran 182 tests in 0.380s
Thanks. Please submit a new patch for this problem.
Quoted 6 lines
OK (skipped=124)
There are a lot of skips but no errors. The skips are from features that rxe does not support.
Adding the MW
rdma_corepatch picks up a small number of additional test cases involving memory windows.
Thanks a lot. Look forward to these additional test cases involving memory windows.
Zhu Yanjun
Quoted 106 lines
Regards,
Bob
-----Original Message-----
From: Zhu Yanjun <[email protected]>
Sent: Monday, May 24, 2021 9:09 PM
To: Pearson, Robert B <[email protected]>
Cc: Jason Gunthorpe <[email protected]>; RDMA mailing list <[email protected]>
Subject: Re: [PATCH for-next v7 00/10] RDMA/rxe: Implement memory windowsQuoted 11 lines · Robert B
Quoted 9 lines · Zhu Yanjun
Quoted 8 lines · Bob Pearson
This series of patches implement memory windows for the
rdma_rxedriver. This is a shorter reimplementation of an earlier patch set. They apply to and depend on the current for-next linux rdma tree.Signed-off-by Bob Pearson <[email protected]>---
v7:
Fixed a duplicateINIT_RDMA_OBJ_SIZE(ib_mw, ...)inrxe_verbs.c.Quoted 5 lines
Quoted 1 line
With this patch series, there are about 17 errors and 1 failure in rdma-core.
Zhu,
You have to sync the kernel-header file with the kernel.
From the link
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tre
e/Documentation/kbuild/headers_install.rst?h=v5.13-rc3 you mean "makeheaders_install"?In fact, after "make
headers_install", these patches still cause errors and failures in rdma-core.I will delve into these errors of rdma-core. Too many errors.
Zhu Yanjun
Quoted 63 lines
Bob
Quoted 60 lines
"
------------------------------------------------------------------
--
--
Ran 183 tests in 2.130sFAILED (failures=1, errors=17, skipped=124) "
After these patches, not sure if rxe can communicate with the physical NICs correctly because of the above errors and failure.
Zhu Yanjun
Quoted 47 lines
v6:
Addedrxe_prefix to subroutine names in lines that changed from Zhu's review of v5.
v5:
Fixed a typo in 10th patch.
v4:
Added a 10th patch to check when MRs have bound MWs and disallow dereg and invalidate operations.
v3:
cleaned up void return and lower case enums from Zhu's review.
v2:
cleaned up an issue inrdma_user_rxe.h
cleaned up a collision inrxe_resp.cBob Pearson (9):
RDMA/rxe: Add bind MW fields torxe_send_wrRDMA/rxe: Return errors for add index and key RDMA/rxe: Enable MW object pool
RDMA/rxe: Addib_alloc_mwandib_dealloc_mwverbs RDMA/rxe: ReplaceWR_REG_MASKbyWR_LOCAL_OP_MASKRDMA/rxe: Move local ops to subroutine RDMA/rxe: Add support for bind MW work requests RDMA/rxe: Implement invalidate MW operations RDMA/rxe: Implement memory access through MWsdrivers/infiniband/sw/rxe/Makefile | 1 + drivers/infiniband/sw/rxe/rxe.c | 1 + drivers/infiniband/sw/rxe/rxe_comp.c | 1 + drivers/infiniband/sw/rxe/rxe_loc.h | 29 +- drivers/infiniband/sw/rxe/rxe_mr.c | 79 ++++-- drivers/infiniband/sw/rxe/rxe_mw.c | 356 +++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_opcode.c | 11 +- drivers/infiniband/sw/rxe/rxe_opcode.h | 3 +- drivers/infiniband/sw/rxe/rxe_param.h | 19 +- drivers/infiniband/sw/rxe/rxe_pool.c | 45 ++-- drivers/infiniband/sw/rxe/rxe_pool.h | 8 +- drivers/infiniband/sw/rxe/rxe_req.c | 102 ++++--- drivers/infiniband/sw/rxe/rxe_resp.c | 110 +++++--- drivers/infiniband/sw/rxe/rxe_verbs.c | 5 +- drivers/infiniband/sw/rxe/rxe_verbs.h | 38 ++- include/uapi/rdma/rdma_user_rxe.h | 34 ++- 16 files changed, 691 insertions(+), 151 deletions(-)create mode 100644
drivers/infiniband/sw/rxe/rxe_mw.c
--
2.27.0
Zhu Yanjun
maintainerQuoted 2 lines · Robert B
There's nothing to change. There is no problem. Just get the headers sync'ed.
I delved into the errors. I found that the following would fix these errors in rdma-core.
(quoted diff) +0 -0
b/kernel-headers/rdma/rdma_user_rxe.h
index 068433e2..90ea477f 100644
kernel-headers/rdma/rdma_user_rxe.h +11 -0
@@ -99,7 +99,17 @@ struct rxe_send_wr {__u32 remote_qkey;__u16 pkey_index; } ud; +struct { +__aligned_u64 addr; +__aligned_u64 length; +__u32 mr_lkey; +__u32 mw_rkey; +__u32 rkey; +__u32 access; +__u32 flags; + } mw;/* reg is only used by the kernel and is not part of the uapi */ +#ifdef __KERNEL__ struct { union { struct ib_mr *mr;
@@ -108,6 +118,7 @@ struct rxe_send_wr {__u32 key; __u32 access; } reg; +#endif } wr; };
Zhu Yanjun
Quoted 151 lines
If that doesn't fix your issues your tree has gotten corrupted somehow. But, I don't think that is the issue. I saw the same type of errors you reported when
rdma_coreis built with the old header file. That definitely will cause problems. The size of the send queue WQEs changed because new fields were added. Then user space and the kernel immediately get off from each other.Good luck,
Bob
-----Original Message-----
From: Zhu Yanjun <[email protected]>
Sent: Tuesday, May 25, 2021 12:18 AM
To: Pearson, Robert B <[email protected]>
Cc: Pearson, Robert B <[email protected]>; Jason Gunthorpe <[email protected]>; RDMA mailing list <[email protected]>
Subject: Re: [PATCH for-next v7 00/10] RDMA/rxe: Implement memory windowsQuoted 12 lines · Robert B
Zhu,
I'm not sure about the script. Starting from where you were I copied <LINUX>/include/uapi/rdma/rdma_user_rxe.h to <RDMA_CORE>/kernel-headers/rdma/rdma_user_rxe.h. After running the script you should be able to just diff these two files to make sure they are the same. If they aren't copy the header file over. After the shift to 5.13
rc1+ I re-pulled both trees and applied the kernel patches and then rc1+ built everything. The python test cases look likeQuoted 5 lines
.............sssssssss.............sssssssssssssssssssssssssssssssssss ssssssssssssssssssssssssssssssssssss.ssssssssssssssssssssssssss....sss s.............s.....s.......ssssssssss..ss
----------------------------------------------------------------------
Ran 182 tests in 0.380sThanks. Please submit a new patch for this problem.
Quoted 6 lines
OK (skipped=124)
There are a lot of skips but no errors. The skips are from features that rxe does not support.
Adding the MW
rdma_corepatch picks up a small number of additional test cases involving memory windows.Thanks a lot. Look forward to these additional test cases involving memory windows.
Zhu Yanjun
Quoted 106 lines
Regards,
Bob
-----Original Message-----
From: Zhu Yanjun <[email protected]>
Sent: Monday, May 24, 2021 9:09 PM
To: Pearson, Robert B <[email protected]>
Cc: Jason Gunthorpe <[email protected]>; RDMA mailing list <[email protected]>
Subject: Re: [PATCH for-next v7 00/10] RDMA/rxe: Implement memory windowsQuoted 11 lines · Robert B
Quoted 9 lines · Zhu Yanjun
Quoted 8 lines · Bob Pearson
This series of patches implement memory windows for the
rdma_rxedriver. This is a shorter reimplementation of an earlier patch set. They apply to and depend on the current for-next linux rdma tree.Signed-off-by Bob Pearson <[email protected]>---
v7:
Fixed a duplicateINIT_RDMA_OBJ_SIZE(ib_mw, ...)inrxe_verbs.c.Quoted 5 lines
Quoted 1 line
With this patch series, there are about 17 errors and 1 failure in rdma-core.
Zhu,
You have to sync the kernel-header file with the kernel.
From the link
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tre
e/Documentation/kbuild/headers_install.rst?h=v5.13-rc3 you mean "makeheaders_install"?In fact, after "make
headers_install", these patches still cause errors and failures in rdma-core.I will delve into these errors of rdma-core. Too many errors.
Zhu Yanjun
Quoted 63 lines
Bob
Quoted 60 lines
"
------------------------------------------------------------------
--
--
Ran 183 tests in 2.130sFAILED (failures=1, errors=17, skipped=124) "
After these patches, not sure if rxe can communicate with the physical NICs correctly because of the above errors and failure.
Zhu Yanjun
Quoted 47 lines
v6:
Addedrxe_prefix to subroutine names in lines that changed from Zhu's review of v5.
v5:
Fixed a typo in 10th patch.
v4:
Added a 10th patch to check when MRs have bound MWs and disallow dereg and invalidate operations.
v3:
cleaned up void return and lower case enums from Zhu's review.
v2:
cleaned up an issue inrdma_user_rxe.h
cleaned up a collision inrxe_resp.cBob Pearson (9):
RDMA/rxe: Add bind MW fields torxe_send_wrRDMA/rxe: Return errors for add index and key RDMA/rxe: Enable MW object pool
RDMA/rxe: Addib_alloc_mwandib_dealloc_mwverbs RDMA/rxe: ReplaceWR_REG_MASKbyWR_LOCAL_OP_MASKRDMA/rxe: Move local ops to subroutine RDMA/rxe: Add support for bind MW work requests RDMA/rxe: Implement invalidate MW operations RDMA/rxe: Implement memory access through MWsdrivers/infiniband/sw/rxe/Makefile | 1 + drivers/infiniband/sw/rxe/rxe.c | 1 + drivers/infiniband/sw/rxe/rxe_comp.c | 1 + drivers/infiniband/sw/rxe/rxe_loc.h | 29 +- drivers/infiniband/sw/rxe/rxe_mr.c | 79 ++++-- drivers/infiniband/sw/rxe/rxe_mw.c | 356 +++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_opcode.c | 11 +- drivers/infiniband/sw/rxe/rxe_opcode.h | 3 +- drivers/infiniband/sw/rxe/rxe_param.h | 19 +- drivers/infiniband/sw/rxe/rxe_pool.c | 45 ++-- drivers/infiniband/sw/rxe/rxe_pool.h | 8 +- drivers/infiniband/sw/rxe/rxe_req.c | 102 ++++--- drivers/infiniband/sw/rxe/rxe_resp.c | 110 +++++--- drivers/infiniband/sw/rxe/rxe_verbs.c | 5 +- drivers/infiniband/sw/rxe/rxe_verbs.h | 38 ++- include/uapi/rdma/rdma_user_rxe.h | 34 ++- 16 files changed, 691 insertions(+), 151 deletions(-)create mode 100644
drivers/infiniband/sw/rxe/rxe_mw.c
--
2.27.0
Zhu Yanjun
maintainerQuoted 5 lines · Robert B
There's nothing to change. There is no problem. Just get the headers sync'ed.
If that doesn't fix your issues your tree has gotten corrupted somehow. But, I don't think that is the issue. I saw the same type of errors you reported whenrdma_coreis built with the old header file. That definitely will cause problems. The size of the send queue WQEs changed because new fields were added. Then user space and the kernel immediately get off from each other.Good luck,
About rdma-core, the root cause is clear. I am fine with this patch series. Thanks, Bob.
Zhu Yanjun
Quoted 148 lines
Bob
-----Original Message-----
From: Zhu Yanjun <[email protected]>
Sent: Tuesday, May 25, 2021 12:18 AM
To: Pearson, Robert B <[email protected]>
Cc: Pearson, Robert B <[email protected]>; Jason Gunthorpe <[email protected]>; RDMA mailing list <[email protected]>
Subject: Re: [PATCH for-next v7 00/10] RDMA/rxe: Implement memory windowsQuoted 12 lines · Robert B
Zhu,
I'm not sure about the script. Starting from where you were I copied <LINUX>/include/uapi/rdma/rdma_user_rxe.h to <RDMA_CORE>/kernel-headers/rdma/rdma_user_rxe.h. After running the script you should be able to just diff these two files to make sure they are the same. If they aren't copy the header file over. After the shift to 5.13
rc1+ I re-pulled both trees and applied the kernel patches and then rc1+ built everything. The python test cases look likeQuoted 5 lines
.............sssssssss.............sssssssssssssssssssssssssssssssssss ssssssssssssssssssssssssssssssssssss.ssssssssssssssssssssssssss....sss s.............s.....s.......ssssssssss..ss
----------------------------------------------------------------------
Ran 182 tests in 0.380sThanks. Please submit a new patch for this problem.
Quoted 6 lines
OK (skipped=124)
There are a lot of skips but no errors. The skips are from features that rxe does not support.
Adding the MW
rdma_corepatch picks up a small number of additional test cases involving memory windows.Thanks a lot. Look forward to these additional test cases involving memory windows.
Zhu Yanjun
Quoted 106 lines
Regards,
Bob
-----Original Message-----
From: Zhu Yanjun <[email protected]>
Sent: Monday, May 24, 2021 9:09 PM
To: Pearson, Robert B <[email protected]>
Cc: Jason Gunthorpe <[email protected]>; RDMA mailing list <[email protected]>
Subject: Re: [PATCH for-next v7 00/10] RDMA/rxe: Implement memory windowsQuoted 11 lines · Robert B
Quoted 9 lines · Zhu Yanjun
Quoted 8 lines · Bob Pearson
This series of patches implement memory windows for the
rdma_rxedriver. This is a shorter reimplementation of an earlier patch set. They apply to and depend on the current for-next linux rdma tree.Signed-off-by Bob Pearson <[email protected]>---
v7:
Fixed a duplicateINIT_RDMA_OBJ_SIZE(ib_mw, ...)inrxe_verbs.c.Quoted 5 lines
Quoted 1 line
With this patch series, there are about 17 errors and 1 failure in rdma-core.
Zhu,
You have to sync the kernel-header file with the kernel.
From the link
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tre
e/Documentation/kbuild/headers_install.rst?h=v5.13-rc3 you mean "makeheaders_install"?In fact, after "make
headers_install", these patches still cause errors and failures in rdma-core.I will delve into these errors of rdma-core. Too many errors.
Zhu Yanjun
Quoted 63 lines
Bob
Quoted 60 lines
"
------------------------------------------------------------------
--
--
Ran 183 tests in 2.130sFAILED (failures=1, errors=17, skipped=124) "
After these patches, not sure if rxe can communicate with the physical NICs correctly because of the above errors and failure.
Zhu Yanjun
Quoted 47 lines
v6:
Addedrxe_prefix to subroutine names in lines that changed from Zhu's review of v5.
v5:
Fixed a typo in 10th patch.
v4:
Added a 10th patch to check when MRs have bound MWs and disallow dereg and invalidate operations.
v3:
cleaned up void return and lower case enums from Zhu's review.
v2:
cleaned up an issue inrdma_user_rxe.h
cleaned up a collision inrxe_resp.cBob Pearson (9):
RDMA/rxe: Add bind MW fields torxe_send_wrRDMA/rxe: Return errors for add index and key RDMA/rxe: Enable MW object pool
RDMA/rxe: Addib_alloc_mwandib_dealloc_mwverbs RDMA/rxe: ReplaceWR_REG_MASKbyWR_LOCAL_OP_MASKRDMA/rxe: Move local ops to subroutine RDMA/rxe: Add support for bind MW work requests RDMA/rxe: Implement invalidate MW operations RDMA/rxe: Implement memory access through MWsdrivers/infiniband/sw/rxe/Makefile | 1 + drivers/infiniband/sw/rxe/rxe.c | 1 + drivers/infiniband/sw/rxe/rxe_comp.c | 1 + drivers/infiniband/sw/rxe/rxe_loc.h | 29 +- drivers/infiniband/sw/rxe/rxe_mr.c | 79 ++++-- drivers/infiniband/sw/rxe/rxe_mw.c | 356 +++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_opcode.c | 11 +- drivers/infiniband/sw/rxe/rxe_opcode.h | 3 +- drivers/infiniband/sw/rxe/rxe_param.h | 19 +- drivers/infiniband/sw/rxe/rxe_pool.c | 45 ++-- drivers/infiniband/sw/rxe/rxe_pool.h | 8 +- drivers/infiniband/sw/rxe/rxe_req.c | 102 ++++--- drivers/infiniband/sw/rxe/rxe_resp.c | 110 +++++--- drivers/infiniband/sw/rxe/rxe_verbs.c | 5 +- drivers/infiniband/sw/rxe/rxe_verbs.h | 38 ++- include/uapi/rdma/rdma_user_rxe.h | 34 ++- 16 files changed, 691 insertions(+), 151 deletions(-)create mode 100644
drivers/infiniband/sw/rxe/rxe_mw.c
--
2.27.0
On further reflection I realize I did not understand correctly the user/kernel API issue correctly. I was assuming that the user application should continue to run but that we could require re-compiling rdma-core. If we require that old rdma-core binaries run on newer kernels then the 40 bytes is an issue. I always recompiled rdma-core and didn't test running with old binaries. Fortunately there is an easy fix. The flags field in the earlier rxe mw version had one bit in it but the new version dropped that and I never went back and removed the field. Dropping the flags field doesn't break anything but lets the mw struct fit in the wr union without extending it.
I will fix, retest and resubmit.
Bob
-----Original Message-----
From: Zhu Yanjun <[email protected]>
Sent: Tuesday, May 25, 2021 10:00 AM
To: Pearson, Robert B <[email protected]>
Cc: Pearson, Robert B <[email protected]>; Jason Gunthorpe <[email protected]>; RDMA mailing list <[email protected]>
Subject: Re: [PATCH for-next v7 00/10] RDMA/rxe: Implement memory windows
Quoted 5 lines · Robert B
There's nothing to change. There is no problem. Just get the headers sync'ed.
If that doesn't fix your issues your tree has gotten corrupted somehow. But, I don't think that is the issue. I saw the same type of errors you reported whenrdma_coreis built with the old header file. That definitely will cause problems. The size of the send queue WQEs changed because new fields were added. Then user space and the kernel immediately get off from each other.Good luck,
About rdma-core, the root cause is clear. I am fine with this patch series. Thanks, Bob.
Zhu Yanjun
Quoted 154 lines
Bob
-----Original Message-----
From: Zhu Yanjun <[email protected]>
Sent: Tuesday, May 25, 2021 12:18 AM
To: Pearson, Robert B <[email protected]>
Cc: Pearson, Robert B <[email protected]>; Jason Gunthorpe <[email protected]>; RDMA mailing list <[email protected]>
Subject: Re: [PATCH for-next v7 00/10] RDMA/rxe: Implement memory windowsQuoted 12 lines · Robert B
Zhu,
I'm not sure about the script. Starting from where you were I copied <LINUX>/include/uapi/rdma/rdma_user_rxe.h to <RDMA_CORE>/kernel-headers/rdma/rdma_user_rxe.h. After running the script you should be able to just diff these two files to make sure they are the same. If they aren't copy the header file over. After the shift to 5.13
rc1+ I re-pulled both trees and applied the kernel patches and then rc1+ built everything. The python test cases look likeQuoted 7 lines
.............sssssssss.............sssssssssssssssssssssssssssssssss ss ssssssssssssssssssssssssssssssssssss.ssssssssssssssssssssssssss....s ss s.............s.....s.......ssssssssss..ss
--------------------------------------------------------------------
--
Ran 182 tests in 0.380sThanks. Please submit a new patch for this problem.
Quoted 6 lines
OK (skipped=124)
There are a lot of skips but no errors. The skips are from features that rxe does not support.
Adding the MW
rdma_corepatch picks up a small number of additional test cases involving memory windows.Thanks a lot. Look forward to these additional test cases involving memory windows.
Zhu Yanjun
Quoted 108 lines
Regards,
Bob
-----Original Message-----
From: Zhu Yanjun <[email protected]>
Sent: Monday, May 24, 2021 9:09 PM
To: Pearson, Robert B <[email protected]>
Cc: Jason Gunthorpe <[email protected]>; RDMA mailing list <[email protected]>
Subject: Re: [PATCH for-next v7 00/10] RDMA/rxe: Implement memory windowsQuoted 11 lines · Robert B
Quoted 9 lines · Zhu Yanjun
Quoted 8 lines · Bob Pearson
This series of patches implement memory windows for the
rdma_rxedriver. This is a shorter reimplementation of an earlier patch set. They apply to and depend on the current for-next linux rdma tree.Signed-off-by Bob Pearson <[email protected]>---
v7:
Fixed a duplicateINIT_RDMA_OBJ_SIZE(ib_mw, ...)inrxe_verbs.c.Quoted 5 lines
Quoted 1 line
With this patch series, there are about 17 errors and 1 failure in rdma-core.
Zhu,
You have to sync the kernel-header file with the kernel.
From the link
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/t
re e/Documentation/kbuild/headers_install.rst?h=v5.13-rc3 you mean "makeheaders_install"?In fact, after "make
headers_install", these patches still cause errors and failures in rdma-core.I will delve into these errors of rdma-core. Too many errors.
Zhu Yanjun
Quoted 64 lines
Bob
Quoted 61 lines
"
----------------------------------------------------------------
--
--
--
Ran 183 tests in 2.130sFAILED (failures=1, errors=17, skipped=124) "
After these patches, not sure if rxe can communicate with the physical NICs correctly because of the above errors and failure.
Zhu Yanjun
Quoted 47 lines
v6:
Addedrxe_prefix to subroutine names in lines that changed from Zhu's review of v5.
v5:
Fixed a typo in 10th patch.
v4:
Added a 10th patch to check when MRs have bound MWs and disallow dereg and invalidate operations.
v3:
cleaned up void return and lower case enums from Zhu's review.
v2:
cleaned up an issue inrdma_user_rxe.h
cleaned up a collision inrxe_resp.cBob Pearson (9):
RDMA/rxe: Add bind MW fields torxe_send_wrRDMA/rxe: Return errors for add index and key RDMA/rxe: Enable MW object pool
RDMA/rxe: Addib_alloc_mwandib_dealloc_mwverbs RDMA/rxe: ReplaceWR_REG_MASKbyWR_LOCAL_OP_MASKRDMA/rxe: Move local ops to subroutine RDMA/rxe: Add support for bind MW work requests RDMA/rxe: Implement invalidate MW operations RDMA/rxe: Implement memory access through MWsdrivers/infiniband/sw/rxe/Makefile | 1 + drivers/infiniband/sw/rxe/rxe.c | 1 + drivers/infiniband/sw/rxe/rxe_comp.c | 1 + drivers/infiniband/sw/rxe/rxe_loc.h | 29 +- drivers/infiniband/sw/rxe/rxe_mr.c | 79 ++++-- drivers/infiniband/sw/rxe/rxe_mw.c | 356 +++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_opcode.c | 11 +- drivers/infiniband/sw/rxe/rxe_opcode.h | 3 +- drivers/infiniband/sw/rxe/rxe_param.h | 19 +- drivers/infiniband/sw/rxe/rxe_pool.c | 45 ++-- drivers/infiniband/sw/rxe/rxe_pool.h | 8 +- drivers/infiniband/sw/rxe/rxe_req.c | 102 ++++--- drivers/infiniband/sw/rxe/rxe_resp.c | 110 +++++--- drivers/infiniband/sw/rxe/rxe_verbs.c | 5 +- drivers/infiniband/sw/rxe/rxe_verbs.h | 38 ++- include/uapi/rdma/rdma_user_rxe.h | 34 ++- 16 files changed, 691 insertions(+), 151 deletions(-)create mode 100644
drivers/infiniband/sw/rxe/rxe_mw.c
--
2.27.0
Quoted 14 lines · Robert B
On further reflection I realize I did not understand correctly the user/kernel API issue correctly. I was assuming that the user application should continue to run but that we could require re-compiling rdma-core. If we require that old rdma-core binaries run on newer kernels then the 40 bytes is an issue. I always recompiled rdma-core and didn't test running with old binaries. Fortunately there is an easy fix. The flags field in the earlier rxe mw version had one bit in it but the new version dropped that and I never went back and removed the field. Dropping the flags field doesn't break anything but lets the mw struct fit in the wr union without extending it.
I will fix, retest and resubmit.
Bob
-----Original Message-----
From: Zhu Yanjun <[email protected]>
Sent: Tuesday, May 25, 2021 10:00 AM
To: Pearson, Robert B <[email protected]>
Cc: Pearson, Robert B <[email protected]>; Jason Gunthorpe <[email protected]>; RDMA mailing list <[email protected]>
Subject: Re: [PATCH for-next v7 00/10] RDMA/rxe: Implement memory windowsOn Tue, May 25, 2021 at 1:27 PM Pearson, Robert B <[email protected]> wrote:
Quoted 9 lines
Quoted 4 lines
There's nothing to change. There is no problem. Just get the headers sync'ed.
If that doesn't fix your issues your tree has gotten corrupted somehow. But, I don't think that is the issue. I saw the same type of errors you reported whenrdma_coreis built with the old header file. That definitely will cause problems. The size of the send queue WQEs changed because new fields were added. Then user space and the kernel immediately get off from each other.Good luck,
About rdma-core, the root cause is clear. I am fine with this patch series. Thanks, Bob.
Zhu Yanjun
Well. Interesting. Having pulled latest rdma-core again and fixed the wr.mw size issue I now see a bunch of CQ and QP errors which have nothing to do with the memory windows patches. It looks more like a memory ordering problem around the queues. Is this possibly related to the recent relaxed ordering changes?? The one py test failure I have chased down is in the resize cq test. The first time it runs after building a new module I can print out the new cqe and the current queue count and see the expected 1 which is less than 6 but the code takes the wrong branch and does not report an error. Rerunning the test I get the expected behavior and the test passes. This will take a bit of effort.
Bob
Jason Gunthorpe
maintainerQuoted 22 lines · Robert B
Quoted 20 lines · Robert B
On further reflection I realize I did not understand correctly the user/kernel API issue correctly. I was assuming that the user application should continue to run but that we could require re-compiling rdma-core. If we require that old rdma-core binaries run on newer kernels then the 40 bytes is an issue. I always recompiled rdma-core and didn't test running with old binaries. Fortunately there is an easy fix. The flags field in the earlier rxe mw version had one bit in it but the new version dropped that and I never went back and removed the field. Dropping the flags field doesn't break anything but lets the mw struct fit in the wr union without extending it.
I will fix, retest and resubmit.
Bob
From: Zhu Yanjun <[email protected]>
Sent: Tuesday, May 25, 2021 10:00 AM
To: Pearson, Robert B <[email protected]>
Cc: Pearson, Robert B <[email protected]>; Jason Gunthorpe <[email protected]>; RDMA mailing list <[email protected]>
Subject: Re: [PATCH for-next v7 00/10] RDMA/rxe: Implement memory windowsQuoted 4 lines · Robert B
There's nothing to change. There is no problem. Just get the headers sync'ed.
If that doesn't fix your issues your tree has gotten corrupted somehow. But, I don't think that is the issue. I saw the same type of errors you reported whenrdma_coreis built with the old header file. That definitely will cause problems. The size of the send queue WQEs changed because new fields were added. Then user space and the kernel immediately get off from each other.Good luck,
About rdma-core, the root cause is clear. I am fine with this patch series. Thanks, Bob.
Quoted 7 lines
Quoted 2 lines
Zhu Yanjun
Well. Interesting. Having pulled latest rdma-core again and fixed the wr.mw size issue I now see a bunch of CQ and QP errors which have nothing to do with the memory windows patches. It looks more like a memory ordering problem around the queues. Is this possibly related to the recent relaxed ordering changes??
They haven't been merged and wouldn't effect a SW driver like rxe
Quoted 6 lines
The one py test failure I have chased down is in the resize cq test. The first time it runs after building a new module I can print out the new cqe and the current queue count and see the expected 1 which is less than 6 but the code takes the wrong branch and does not report an error. Rerunning the test I get the expected behavior and the test passes. This will take a bit of effort.
Bisect the kernel?
Jason