Fix race conditions in rxe_pool
Subsystems (2)
v10 cover Fix race conditions in rxe_pool
There are several race conditions discovered in the current rdma_rxe driver. They mostly relate to races between normal operations and destroying objects. This patch series
- Makes several minor cleanups in rxe_pool.[ch]
- Replaces the red-black trees currently used by xarrays for indices
- Corrects several reference counting errors
- Adds wait for completions to the paths in verbs APIs which destroy objects.
- Changes read side locking to rcu.
---
v10
Rebased to current wip/jgg-for-next.
Split some patches into smaller ones.
v9
Corrected issues reported by Jason Gunthorpe, Converted locking in rxe_mcast.c and rxe_pool.c to use RCU Split up the patches into smaller changes
v8
Fixed an additional race in 3/8 which was not handled correctly.
v7
Corrected issues reported by Jason Gunthorpe
v6
Fixed a kzalloc flags bug.
Fixed comment bug reported by 'Kernel Test Robot'.
Changed type of rxe_pool.c in __rxe_fini().
v5
Removed patches already accepted into for-next and addressed comments from Jason Gunthorpe.
v4
Restructured patch series to change to xarray earlier which greatly simplified the changes.
Rebased to current for-next
v3
Changed rxe_alloc to use GFP_KERNEL
Addressed other comments by Jason Gunthorp
Merged the previous 06/10 and 07/10 patches into one since they overlapped Added some minor cleanups as 10/10
v2
Rebased to current for-next.
Added 4 additional patches
Bob Pearson (11):
RDMA/rxe: Reverse the sense of RXE_POOL_NO_ALLOC RDMA/rxe: Delete _locked() APIs for pool objects RDMA/rxe: Replace obj by elem in declaration RDMA/rxe: Replace red-black trees by xarrays RDMA/rxe: Stop lookup of partially built objects RDMA/rxe: Add wait_for_completion to pool objects RDMA/rxe: Fix ref error in rxe_av.c RDMA/rxe: Replace mr by rkey in responder resources RDMA/rxe: Convert read side locking to rcu RDMA/rxe: Move max_elem into rxe_type_info RDMA/rxe: Cleanup rxe_pool.c
drivers/infiniband/sw/rxe/rxe.c | 87 +---- drivers/infiniband/sw/rxe/rxe_av.c | 19 +- drivers/infiniband/sw/rxe/rxe_loc.h | 5 +- drivers/infiniband/sw/rxe/rxe_mr.c | 4 +- drivers/infiniband/sw/rxe/rxe_mw.c | 13 +- drivers/infiniband/sw/rxe/rxe_net.c | 17 +- drivers/infiniband/sw/rxe/rxe_pool.c | 453 ++++++++++++++------------ drivers/infiniband/sw/rxe/rxe_pool.h | 74 ++--- drivers/infiniband/sw/rxe/rxe_qp.c | 10 +- drivers/infiniband/sw/rxe/rxe_req.c | 55 ++-- drivers/infiniband/sw/rxe/rxe_resp.c | 125 ++++--- drivers/infiniband/sw/rxe/rxe_verbs.c | 55 ++-- drivers/infiniband/sw/rxe/rxe_verbs.h | 1 - 13 files changed, 462 insertions(+), 456 deletions(-)
base-commit: 3ac3107872b8dd4b5c4c1b598fcbc24983cd009b
Patch applies to current wip/jgg-for-next with or without the last two (5-6/6) patches in the multicast series.
Signature · 1 line
2.32.0
PATCH v10 1/11 RDMA/rxe: Reverse the sense of RXE_POOL_NO_ALLOC
There is only one remaining object type that allocates its own memory, that is MR. So the sense of RXE_POOL_NO_ALLOC is changed to RXE_POOL_ALLOC. Add checks to rxe_alloc() and rxe_add_to_pool() to make sure the correct call is used for the setting of this flag.
--- drivers/infiniband/sw/rxe/rxe_pool.c | 27 ++++++++++++++++++--------- drivers/infiniband/sw/rxe/rxe_pool.h | 2 +- 2 files changed, 19 insertions(+), 10 deletions(-)
drivers/infiniband/sw/rxe/rxe_pool.c +18 -9
@@ -21,19 +21,17 @@ static const struct rxe_type_info { .name = "rxe-uc", .size = sizeof(struct rxe_ucontext), .elem_offset = offsetof(struct rxe_ucontext, elem), - .flags = RXE_POOL_NO_ALLOC, }, [RXE_TYPE_PD] = { .name = "rxe-pd", .size = sizeof(struct rxe_pd), .elem_offset = offsetof(struct rxe_pd, elem), - .flags = RXE_POOL_NO_ALLOC, }, [RXE_TYPE_AH] = { .name = "rxe-ah", .size = sizeof(struct rxe_ah), .elem_offset = offsetof(struct rxe_ah, elem), - .flags = RXE_POOL_INDEX | RXE_POOL_NO_ALLOC, + .flags = RXE_POOL_INDEX, .min_index = RXE_MIN_AH_INDEX, .max_index = RXE_MAX_AH_INDEX, },
@@ -41,7 +39,7 @@ static const struct rxe_type_info { .name = "rxe-srq", .size = sizeof(struct rxe_srq), .elem_offset = offsetof(struct rxe_srq, elem), - .flags = RXE_POOL_INDEX | RXE_POOL_NO_ALLOC, + .flags = RXE_POOL_INDEX, .min_index = RXE_MIN_SRQ_INDEX, .max_index = RXE_MAX_SRQ_INDEX, },
@@ -50,7 +48,7 @@ static const struct rxe_type_info { .size = sizeof(struct rxe_qp), .elem_offset = offsetof(struct rxe_qp, elem), .cleanup = rxe_qp_cleanup, - .flags = RXE_POOL_INDEX | RXE_POOL_NO_ALLOC, + .flags = RXE_POOL_INDEX, .min_index = RXE_MIN_QP_INDEX, .max_index = RXE_MAX_QP_INDEX, },
@@ -58,7 +56,6 @@ static const struct rxe_type_info { .name = "rxe-cq", .size = sizeof(struct rxe_cq), .elem_offset = offsetof(struct rxe_cq, elem), - .flags = RXE_POOL_NO_ALLOC, .cleanup = rxe_cq_cleanup, }, [RXE_TYPE_MR] = {
@@ -66,7 +63,7 @@ static const struct rxe_type_info { .size = sizeof(struct rxe_mr), .elem_offset = offsetof(struct rxe_mr, elem), .cleanup = rxe_mr_cleanup, - .flags = RXE_POOL_INDEX, + .flags = RXE_POOL_INDEX | RXE_POOL_ALLOC, .min_index = RXE_MIN_MR_INDEX, .max_index = RXE_MAX_MR_INDEX, },
@@ -75,7 +72,7 @@ static const struct rxe_type_info { .size = sizeof(struct rxe_mw), .elem_offset = offsetof(struct rxe_mw, elem), .cleanup = rxe_mw_cleanup, - .flags = RXE_POOL_INDEX | RXE_POOL_NO_ALLOC, + .flags = RXE_POOL_INDEX, .min_index = RXE_MIN_MW_INDEX, .max_index = RXE_MAX_MW_INDEX, },
@@ -264,6 +261,12 @@ void *rxe_alloc(struct rxe_pool *pool)struct rxe_pool_elem *elem;void *obj; +if (!(pool->flags &RXE_POOL_ALLOC )) { +pr_warn_once ("%s: Pool %s must call rxe_add_to_pool\n" , + __func__, pool->name); +return NULL ; + } +if (atomic_inc_return (&pool->num_elem) > pool->max_elem) goto out_cnt;
@@ -286,6 +289,12 @@ void *rxe_alloc(struct rxe_pool *pool)int __rxe_add_to_pool (struct rxe_pool *pool,struct rxe_pool_elem *elem) { +if (pool->flags &RXE_POOL_ALLOC ) { +pr_warn_once ("%s: Pool %s must call rxe_alloc\n" , + __func__, pool->name); +return -EINVAL ; + } +if (atomic_inc_return (&pool->num_elem) > pool->max_elem) goto out_cnt;
@@ -310,7 +319,7 @@ void rxe_elem_release(struct kref *kref)if (pool->cleanup) pool->cleanup (elem); -if (!(pool->flags &RXE_POOL_NO_ALLOC )) { +if (pool->flags &RXE_POOL_ALLOC ) { obj = elem->obj;kfree (obj); }
drivers/infiniband/sw/rxe/rxe_pool.h +1 -1
@@ -9,7 +9,7 @@enum rxe_pool_flags {RXE_POOL_INDEX =BIT (1 ), -RXE_POOL_NO_ALLOC =BIT (4 ), +RXE_POOL_ALLOC =BIT (2 ), };enum rxe_elem_type {
Signature · 1 line
2.32.0
Jason Gunthorpe
maintainerRe: [PATCH for-next v10 01/11] RDMA/rxe: Reverse the sense of RXE_POOL_NO_ALLOC
drivers/infiniband/sw/rxe/rxe_pool.c void *rxe_alloc(struct rxe_pool *pool) · line 266
Quoted 7 lines · Bob Pearson
drivers/infiniband/sw/rxe/rxe_pool.c +3
-0@@ -264,6 +261,12 @@ void *rxe_alloc(struct rxe_pool *pool)struct rxe_pool_elem *elem;void *obj; +if (!(pool->flags &RXE_POOL_ALLOC )) { +pr_warn_once ("%s: Pool %s must call rxe_add_to_pool\n" , + __func__, pool->name);
Just make these
if (WARN_ON(!(pool->flags & RXE_POOL_ALLOC)))
return NULL;
Jason
PATCH v10 2/11 RDMA/rxe: Delete _locked() APIs for pool objects
In reply to Bob PearsonSince caller managed locks for indexed objects are no longer used these APIs are deleted.
--- drivers/infiniband/sw/rxe/rxe_pool.c | 67 ++++------------------------ drivers/infiniband/sw/rxe/rxe_pool.h | 24 ++-------- 2 files changed, 12 insertions(+), 79 deletions(-)
drivers/infiniband/sw/rxe/rxe_pool.c +8 -59
@@ -189,17 +189,6 @@ static int rxe_insert_index(struct rxe_pool *pool, struct rxe_pool_elem *new)return 0 ; } -int __rxe_add_index_locked (struct rxe_pool_elem *elem) -{ -struct rxe_pool *pool = elem->pool; -int err; - - elem->index =alloc_index (pool); - err =rxe_insert_index (pool, elem); - -return err; -} -int __rxe_add_index (struct rxe_pool_elem *elem) {struct rxe_pool *pool = elem->pool;
@@ -207,55 +196,24 @@ int __rxe_add_index(struct rxe_pool_elem *elem)int err;write_lock_irqsave (&pool->pool_lock, flags); - err =__rxe_add_index_locked (elem); + elem->index =alloc_index (pool); + err =rxe_insert_index (pool, elem);write_unlock_irqrestore (&pool->pool_lock, flags);return err; } -void __rxe_drop_index_locked (struct rxe_pool_elem *elem) -{ -struct rxe_pool *pool = elem->pool; - -clear_bit (elem->index - pool->index.min_index, pool->index.table); -rb_erase (&elem->index_node, &pool->index.tree); -} -void __rxe_drop_index (struct rxe_pool_elem *elem) {struct rxe_pool *pool = elem->pool;unsigned long flags;write_lock_irqsave (&pool->pool_lock, flags); -__rxe_drop_index_locked (elem); +clear_bit (elem->index - pool->index.min_index, pool->index.table); +rb_erase (&elem->index_node, &pool->index.tree);write_unlock_irqrestore (&pool->pool_lock, flags); } -void *rxe_alloc_locked (struct rxe_pool *pool) -{ -struct rxe_pool_elem *elem; -void *obj; - -if (atomic_inc_return (&pool->num_elem) > pool->max_elem) - goto out_cnt; - - obj =kzalloc (pool->elem_size,GFP_ATOMIC ); -if (!obj) - goto out_cnt; - - elem = (struct rxe_pool_elem *)((u8 *)obj + pool->elem_offset); - - elem->pool = pool; - elem->obj = obj; -kref_init (&elem->ref_cnt); - -return obj; - -out_cnt: -atomic_dec (&pool->num_elem); -return NULL ; -} -void *rxe_alloc (struct rxe_pool *pool) {struct rxe_pool_elem *elem;
@@ -327,12 +285,14 @@ void rxe_elem_release(struct kref *kref)atomic_dec (&pool->num_elem); } -void *rxe_pool_get_index_locked (struct rxe_pool *pool,u32 index) +void *rxe_pool_get_index (struct rxe_pool *pool,u32 index) { -struct rb_node *node;struct rxe_pool_elem *elem; +struct rb_node *node; +unsigned long flags;void *obj; +read_lock_irqsave (&pool->pool_lock, flags); node = pool->index.tree.rb_node;while (node) {
@@ -352,17 +312,6 @@ void *rxe_pool_get_index_locked(struct rxe_pool *pool, u32 index) }else { obj =NULL ; } - -return obj; -} - -void *rxe_pool_get_index (struct rxe_pool *pool,u32 index) -{ -unsigned long flags; -void *obj; - -read_lock_irqsave (&pool->pool_lock, flags); - obj =rxe_pool_get_index_locked (pool, index);read_unlock_irqrestore (&pool->pool_lock, flags);return obj;
drivers/infiniband/sw/rxe/rxe_pool.h +4 -20
@@ -68,9 +68,7 @@ int rxe_pool_init(struct rxe_dev *rxe, struct rxe_pool *pool,/* free resources from object pool */ void rxe_pool_cleanup (struct rxe_pool *pool); -/* allocate an object from pool holding and not holding the pool lock */ -void *rxe_alloc_locked (struct rxe_pool *pool); - +/* allocate an object from pool */ void *rxe_alloc (struct rxe_pool *pool);/* connect already allocated object to pool */
@@ -79,32 +77,18 @@ int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem);#define rxe_add_to_pool (pool, obj) __rxe_add_to_pool(pool, &(obj)->elem)/* assign an index to an indexed object and insert object into -* pool's rb tree holding and not holding the pool_lock +* pool's rb tree */ -int __rxe_add_index_locked (struct rxe_pool_elem *elem); - -#define rxe_add_index_locked (obj) __rxe_add_index_locked(&(obj)->elem) -int __rxe_add_index (struct rxe_pool_elem *elem);#define rxe_add_index (obj) __rxe_add_index(&(obj)->elem) -/* drop an index and remove object from rb tree -* holding and not holding the pool_lock -*/ -void __rxe_drop_index_locked (struct rxe_pool_elem *elem); - -#define rxe_drop_index_locked (obj) __rxe_drop_index_locked(&(obj)->elem) - +/* drop an index and remove object from rb tree */ void __rxe_drop_index (struct rxe_pool_elem *elem);#define rxe_drop_index (obj) __rxe_drop_index(&(obj)->elem) -/* lookup an indexed object from index holding and not holding the pool_lock. -* takes a reference on object -*/ -void *rxe_pool_get_index_locked (struct rxe_pool *pool,u32 index); - +/* lookup an indexed object from index. takes a reference on object */ void *rxe_pool_get_index (struct rxe_pool *pool,u32 index);/* cleanup an object when all references are dropped */
Signature · 1 line
2.32.0
PATCH v10 3/11 RDMA/rxe: Replace obj by elem in declaration
In reply to Bob PearsonFix a harmless typo replacing obj by elem in the cleanup fields. This has no effect but is confusing.
--- drivers/infiniband/sw/rxe/rxe_pool.c | 2 +- drivers/infiniband/sw/rxe/rxe_pool.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/sw/rxe/rxe_pool.c +1 -1
@@ -12,7 +12,7 @@ static const struct rxe_type_info {const char *name;size_t size;size_t elem_offset; -void (*cleanup)(struct rxe_pool_elem *obj); +void (*cleanup)(struct rxe_pool_elem *elem);enum rxe_pool_flags flags;u32 min_index;u32 max_index;
drivers/infiniband/sw/rxe/rxe_pool.h +1 -1
@@ -39,7 +39,7 @@ struct rxe_pool {struct rxe_dev *rxe;const char *name;rwlock_t pool_lock;/* protects pool add/del/search */ -void (*cleanup)(struct rxe_pool_elem *obj); +void (*cleanup)(struct rxe_pool_elem *elem);enum rxe_pool_flags flags;enum rxe_elem_type type;
Signature · 1 line
2.32.0
PATCH v10 4/11 RDMA/rxe: Replace red-black trees by xarrays
In reply to Bob PearsonCurrently the rxe driver uses red-black trees to add indices to the rxe object pools. Linux xarrays provide a better way to implement the same functionality for indices. This patch replaces red-black trees by xarrays for pool objects. Since xarrays already have a spinlock use that in place of the pool rwlock. Make sure that all changes in the xarray(index) and kref(ref counnt) occur atomically.
--- drivers/infiniband/sw/rxe/rxe.c | 87 ++------- drivers/infiniband/sw/rxe/rxe_mr.c | 1 - drivers/infiniband/sw/rxe/rxe_mw.c | 8 - drivers/infiniband/sw/rxe/rxe_pool.c | 244 ++++++++++---------------- drivers/infiniband/sw/rxe/rxe_pool.h | 43 ++--- drivers/infiniband/sw/rxe/rxe_verbs.c | 12 -- 6 files changed, 118 insertions(+), 277 deletions(-)
drivers/infiniband/sw/rxe/rxe.c +12 -75
@@ -114,83 +114,26 @@ static void rxe_init_ports(struct rxe_dev *rxe) }/* init pools of managed objects */ -static int rxe_init_pools (struct rxe_dev *rxe) +static void rxe_init_pools (struct rxe_dev *rxe) { -int err; - - err =rxe_pool_init (rxe, &rxe->uc_pool,RXE_TYPE_UC , - rxe->max_ucontext); -if (err) - goto err1; - - err =rxe_pool_init (rxe, &rxe->pd_pool,RXE_TYPE_PD , - rxe->attr.max_pd); -if (err) - goto err2; - - err =rxe_pool_init (rxe, &rxe->ah_pool,RXE_TYPE_AH , - rxe->attr.max_ah); -if (err) - goto err3; - - err =rxe_pool_init (rxe, &rxe->srq_pool,RXE_TYPE_SRQ , - rxe->attr.max_srq); -if (err) - goto err4; - - err =rxe_pool_init (rxe, &rxe->qp_pool,RXE_TYPE_QP , - rxe->attr.max_qp); -if (err) - goto err5; - - err =rxe_pool_init (rxe, &rxe->cq_pool,RXE_TYPE_CQ , - rxe->attr.max_cq); -if (err) - goto err6; - - err =rxe_pool_init (rxe, &rxe->mr_pool,RXE_TYPE_MR , - rxe->attr.max_mr); -if (err) - goto err7; - - err =rxe_pool_init (rxe, &rxe->mw_pool,RXE_TYPE_MW , - rxe->attr.max_mw); -if (err) - goto err8; - -return 0 ; - -err8: -rxe_pool_cleanup (&rxe->mr_pool); -err7: -rxe_pool_cleanup (&rxe->cq_pool); -err6: -rxe_pool_cleanup (&rxe->qp_pool); -err5: -rxe_pool_cleanup (&rxe->srq_pool); -err4: -rxe_pool_cleanup (&rxe->ah_pool); -err3: -rxe_pool_cleanup (&rxe->pd_pool); -err2: -rxe_pool_cleanup (&rxe->uc_pool); -err1: -return err; +rxe_pool_init (rxe, &rxe->uc_pool,RXE_TYPE_UC , rxe->max_ucontext); +rxe_pool_init (rxe, &rxe->pd_pool,RXE_TYPE_PD , rxe->attr.max_pd); +rxe_pool_init (rxe, &rxe->ah_pool,RXE_TYPE_AH , rxe->attr.max_ah); +rxe_pool_init (rxe, &rxe->srq_pool,RXE_TYPE_SRQ , rxe->attr.max_srq); +rxe_pool_init (rxe, &rxe->qp_pool,RXE_TYPE_QP , rxe->attr.max_qp); +rxe_pool_init (rxe, &rxe->cq_pool,RXE_TYPE_CQ , rxe->attr.max_cq); +rxe_pool_init (rxe, &rxe->mr_pool,RXE_TYPE_MR , rxe->attr.max_mr); +rxe_pool_init (rxe, &rxe->mw_pool,RXE_TYPE_MW , rxe->attr.max_mw); }/* initialize rxe device state */ -static int rxe_init (struct rxe_dev *rxe) +static void rxe_init (struct rxe_dev *rxe) { -int err; -/* init default device parameters */ rxe_init_device_param (rxe);rxe_init_ports (rxe); - - err =rxe_init_pools (rxe); -if (err) -return err; +rxe_init_pools (rxe);/* init pending mmap list */ spin_lock_init (&rxe->mmap_offset_lock);
@@ -202,8 +145,6 @@ static int rxe_init(struct rxe_dev *rxe) rxe->mcg_tree =RB_ROOT ;mutex_init (&rxe->usdev_lock); - -return 0 ; }void rxe_set_mtu (struct rxe_dev *rxe,unsigned int ndev_mtu)
@@ -225,11 +166,7 @@ void rxe_set_mtu(struct rxe_dev *rxe, unsigned int ndev_mtu)*/ int rxe_add (struct rxe_dev *rxe,unsigned int mtu,const char *ibdev_name) { -int err; - - err =rxe_init (rxe); -if (err) -return err; +rxe_init (rxe);rxe_set_mtu (rxe, mtu);
drivers/infiniband/sw/rxe/rxe_mr.c +0 -1
@@ -691,7 +691,6 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) mr->state =RXE_MR_STATE_INVALID ;rxe_drop_ref (mr_pd (mr)); -rxe_drop_index (mr);rxe_drop_ref (mr);return 0 ;
drivers/infiniband/sw/rxe/rxe_mw.c +0 -8
@@ -20,7 +20,6 @@ int rxe_alloc_mw(struct ib_mw *ibmw, struct ib_udata *udata)return ret; } -rxe_add_index (mw); mw->rkey = ibmw->rkey = (mw->elem.index <<8 ) |rxe_get_next_key (-1 ); mw->state = (mw->ibmw.type ==IB_MW_TYPE_2 ) ?RXE_MW_STATE_FREE :RXE_MW_STATE_VALID ;
@@ -329,10 +328,3 @@ struct rxe_mw *rxe_lookup_mw(struct rxe_qp *qp, int access, u32 rkey)return mw; } - -void rxe_mw_cleanup (struct rxe_pool_elem *elem) -{ -struct rxe_mw *mw =container_of (elem,typeof (*mw), elem); - -rxe_drop_index (mw); -}
drivers/infiniband/sw/rxe/rxe_pool.c +95 -149
373 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_pool.h +11 -32
85 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_verbs.c +0 -12
@@ -181,7 +181,6 @@ static int rxe_create_ah(struct ib_ah *ibah,return err;/* create index > 0 */ -rxe_add_index (ah); ah->ah_num = ah->elem.index;if (uresp) {
@@ -189,7 +188,6 @@ static int rxe_create_ah(struct ib_ah *ibah, err =copy_to_user (&uresp->ah_num, &ah->ah_num,sizeof (uresp->ah_num));if (err) { -rxe_drop_index (ah);rxe_drop_ref (ah);return -EFAULT ; }
@@ -230,7 +228,6 @@ static int rxe_destroy_ah(struct ib_ah *ibah, u32 flags) {struct rxe_ah *ah =to_rah (ibah); -rxe_drop_index (ah);rxe_drop_ref (ah);return 0 ; }
@@ -438,7 +435,6 @@ static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init,if (err)return err; -rxe_add_index (qp); err =rxe_qp_from_init (rxe, qp, pd, init, uresp, ibqp->pd, udata);if (err) goto qp_init;
@@ -446,7 +442,6 @@ static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init,return 0 ; qp_init: -rxe_drop_index (qp);rxe_drop_ref (qp);return err; }
@@ -501,7 +496,6 @@ static int rxe_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)return ret;rxe_qp_destroy (qp); -rxe_drop_index (qp);rxe_drop_ref (qp);return 0 ; }
@@ -908,7 +902,6 @@ static struct ib_mr *rxe_get_dma_mr(struct ib_pd *ibpd, int access)if (!mr)return ERR_PTR (-ENOMEM ); -rxe_add_index (mr);rxe_add_ref (pd);rxe_mr_init_dma (pd, access, mr);
@@ -932,7 +925,6 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd, goto err2; } -rxe_add_index (mr);rxe_add_ref (pd);
@@ -944,7 +936,6 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd, err3:rxe_drop_ref (pd); -rxe_drop_index (mr);rxe_drop_ref (mr); err2:return ERR_PTR (err);
@@ -967,8 +958,6 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type, goto err1; } -rxe_add_index (mr); -rxe_add_ref (pd); err =rxe_mr_init_fast (pd, max_num_sg, mr);
@@ -979,7 +968,6 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type, err2:rxe_drop_ref (pd); -rxe_drop_index (mr);rxe_drop_ref (mr); err1:return ERR_PTR (err);
Signature · 1 line
2.32.0
Jason Gunthorpe
maintainerRe: [PATCH for-next v10 04/11] RDMA/rxe: Replace red-black trees by xarrays
drivers/infiniband/sw/rxe/rxe_pool.c void *rxe_alloc(struct rxe_pool *pool) · line 204
Quoted 7 lines · Bob Pearson
drivers/infiniband/sw/rxe/rxe_pool.c +7
-0+void *rxe_pool_get_index (struct rxe_pool *pool,u32 index) +{ +struct rxe_pool_elem *elem; +unsigned long flags; +void *obj; + +spin_lock_irqsave (&pool->xa.xa_lock, flags);
You can't reach into the xa_lock like this, use the xa_lock() family of functions instead, everywhere.
Jason
Re: [PATCH for-next v10 04/11] RDMA/rxe: Replace red-black trees by xarrays
There is a xa_lock_irqsave()/ublock_irqrestore but I actually need some things that they don't support.
In particular there is not an option to call xa_alloc_cyclic_irqsave and I also need an irqsave version
of kref_put_lock and had to code one which calls the refcount version but again that takes the address
of a lock and not an xarray. All this is because rdmacm is crazy and makes verbs api calls with
spinlocks held.
Bob
Quoted 15 lines · Jason Gunthorpe
drivers/infiniband/sw/rxe/rxe_pool.c void *rxe_alloc(struct rxe_pool *pool) · line 204
Quoted 7 lines · Bob Pearson
drivers/infiniband/sw/rxe/rxe_pool.c +7
-0+void *rxe_pool_get_index (struct rxe_pool *pool,u32 index) +{ +struct rxe_pool_elem *elem; +unsigned long flags; +void *obj; + +spin_lock_irqsave (&pool->xa.xa_lock, flags);You can't reach into the
xa_locklike this, use thexa_lock()family of functions instead, everywhere.Jason
Jason Gunthorpe
maintainerRe: [PATCH for-next v10 04/11] RDMA/rxe: Replace red-black trees by xarrays
Quoted 3 lines · Robert Pearson
There is a xa_lock_irqsave()/ublock_irqrestore but I actually need some things that they don't support.
In particular there is not an option to callxa_alloc_cyclic_irqsave
Well, yes, there is actually good reason for this. The lock/unlock scheme that the allocating xarray functions use can't be trivially nested like this.
When, and only when, you need to allocate the non-blocking AH you should use this pattern
xa_lock_irqsave(..)__xa_alloc_cyclic_reserve(..., GFP_ATOMIC);xa_lock_irq_restore(..)
Everything else should use a simple _irq (is this even needed?) variant without nesting under another spinlock
Quoted 4 lines
and I also need an irqsave version of
kref_put_lockand had to code one which calls the refcount version but again that takes the address of a lock and not an xarray. All this is because rdmacm is crazy and makes verbs api calls with spinlocks held.
You shouldn't need kref_put_lock at all. It isn't really a kref, just use a normal refcount and trigger the completion when it reaches
0. Nothing fancy required.
Jason
PATCH v10 5/11 RDMA/rxe: Stop lookup of partially built objects
In reply to Bob PearsonCurrently the rdma_rxe driver has a security weakness due to adding objects which are partially initialized to indices allowing external actors to gain access to them by sending packets which refer to their index (e.g. qpn, rkey, etc).
This patch adds a member to the pool element struct indicating whether the object should/or should not allow looking up from its index. This variable is set only after the object is completely created and unset as soon as possible when the object is destroyed.
--- drivers/infiniband/sw/rxe/rxe_mr.c | 1 + drivers/infiniband/sw/rxe/rxe_mw.c | 3 +++ drivers/infiniband/sw/rxe/rxe_pool.c | 2 +- drivers/infiniband/sw/rxe/rxe_pool.h | 5 +++++ drivers/infiniband/sw/rxe/rxe_verbs.c | 22 +++++++++++++++++++++- 5 files changed, 31 insertions(+), 2 deletions(-)
drivers/infiniband/sw/rxe/rxe_mr.c +1 -0
@@ -689,6 +689,7 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)return -EINVAL ; } +rxe_disable (mr); mr->state =RXE_MR_STATE_INVALID ;rxe_drop_ref (mr_pd (mr));rxe_drop_ref (mr);
drivers/infiniband/sw/rxe/rxe_mw.c +3 -0
@@ -25,6 +25,8 @@ int rxe_alloc_mw(struct ib_mw *ibmw, struct ib_udata *udata) RXE_MW_STATE_FREE :RXE_MW_STATE_VALID ;spin_lock_init (&mw->lock); +rxe_enable (mw); +return 0 ; }
@@ -56,6 +58,7 @@ int rxe_dealloc_mw(struct ib_mw *ibmw)struct rxe_mw *mw =to_rmw (ibmw);struct rxe_pd *pd =to_rpd (ibmw->pd); +rxe_disable (mw);spin_lock_bh (&mw->lock);rxe_do_dealloc_mw (mw);spin_unlock_bh (&mw->lock);
drivers/infiniband/sw/rxe/rxe_pool.c +1 -1
@@ -203,7 +203,7 @@ void *rxe_pool_get_index(struct rxe_pool *pool, u32 index)spin_lock_irqsave (&pool->xa.xa_lock, flags); elem =xa_load (&pool->xa, index); -if (elem &&kref_get_unless_zero (&elem->ref_cnt)) +if (elem && elem->enabled &&kref_get_unless_zero (&elem->ref_cnt)) obj = elem->obj;else obj =NULL ;
drivers/infiniband/sw/rxe/rxe_pool.h +5 -0
@@ -29,6 +29,7 @@ struct rxe_pool_elem {struct kref ref_cnt;struct list_head list;u32 index; +bool enabled; };struct rxe_pool {
@@ -81,4 +82,8 @@ int __rxe_drop_ref(struct rxe_pool_elem *elem);#define rxe_read_ref (obj) kref_read(&(obj)->elem.ref_cnt) +#define rxe_enable (obj) ((obj)->elem.enabled = true) + +#define rxe_disable (obj) ((obj)->elem.enabled = false) +#endif /* RXE_POOL_H */
drivers/infiniband/sw/rxe/rxe_verbs.c +21 -1
@@ -150,6 +150,7 @@ static int rxe_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)struct rxe_pd *pd =to_rpd (ibpd);rxe_drop_ref (pd); +return 0 ; }
@@ -197,6 +198,9 @@ static int rxe_create_ah(struct ib_ah *ibah, }rxe_init_av (init_attr->ah_attr, &ah->av); + +rxe_enable (ah); +return 0 ; }
@@ -228,6 +232,8 @@ static int rxe_destroy_ah(struct ib_ah *ibah, u32 flags) {struct rxe_ah *ah =to_rah (ibah); +rxe_disable (ah); +rxe_drop_ref (ah);return 0 ; }
@@ -310,6 +316,8 @@ static int rxe_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init,if (err) goto err2; +rxe_enable (srq); +return 0 ; err2:
@@ -368,6 +376,8 @@ static int rxe_destroy_srq(struct ib_srq *ibsrq, struct ib_udata *udata) {struct rxe_srq *srq =to_rsrq (ibsrq); +rxe_disable (srq); +if (srq->rq.queue)rxe_queue_cleanup (srq->rq.queue);
@@ -439,6 +449,8 @@ static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init,if (err) goto qp_init; +rxe_enable (qp); +return 0 ; qp_init:
@@ -495,6 +507,7 @@ static int rxe_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)if (ret)return ret; +rxe_disable (qp);rxe_qp_destroy (qp);rxe_drop_ref (qp);return 0 ;
@@ -807,9 +820,10 @@ static int rxe_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata) {struct rxe_cq *cq =to_rcq (ibcq); -rxe_cq_disable (cq); +rxe_cq_disable (cq);rxe_drop_ref (cq); +return 0 ; }
@@ -905,6 +919,8 @@ static struct ib_mr *rxe_get_dma_mr(struct ib_pd *ibpd, int access)rxe_add_ref (pd);rxe_mr_init_dma (pd, access, mr); +rxe_enable (mr); +return &mr->ibmr; }
@@ -932,6 +948,8 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd,if (err) goto err3; +rxe_enable (mr); +return &mr->ibmr; err3:
@@ -964,6 +982,8 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type,if (err) goto err2; +rxe_enable (mr); +return &mr->ibmr; err2:
Signature · 1 line
2.32.0
Jason Gunthorpe
maintainerRe: [PATCH for-next v10 05/11] RDMA/rxe: Stop lookup of partially built objects
Quoted 9 lines · Bob Pearson
Currently the
rdma_rxedriver has a security weakness due to adding objects which are partially initialized to indices allowing external actors to gain access to them by sending packets which refer to their index (e.g. qpn, rkey, etc).This patch adds a member to the pool element struct indicating whether the object should/or should not allow looking up from its index. This variable is set only after the object is completely created and unset as soon as possible when the object is destroyed.
Why do we have to put incompletely initialized pointers into the xarray?
Either:
1) Do the xa_alloc after everything is setup properly, splitting allocation and ID assignment.
2) Do xa_alloc(XA_ZERO_ENTRY) at the start to reserve the ID then xa_store to set the pointer (can't fail) or xa_erase() to abort it
drivers/infiniband/sw/rxe/rxe_pool.h int __rxe_drop_ref(struct rxe_pool_elem *elem); · line 87
Quoted 7 lines
drivers/infiniband/sw/rxe/rxe_pool.h +3
-0@@ -81,4 +82,8 @@ int __rxe_drop_ref(struct rxe_pool_elem *elem);#define rxe_read_ref (obj) kref_read(&(obj)->elem.ref_cnt) +#define rxe_enable (obj) ((obj)->elem.enabled = true) + +#define rxe_disable (obj) ((obj)->elem.enabled = false)
None of this is locked properly. A release/acquire needs to happen to ensure all the stores that initialized the memory are visible to the reader. Both of the above will ensure that happens.
Jason
PATCH v10 6/11 RDMA/rxe: Add wait_for_completion to pool objects
In reply to Bob PearsonReference counting for object deletion can cause an object to wait for something else to happen before an object gets deleted. The destroy verbs can then return to rdma-core with the object still holding references. Adding wait_for_completion in this path prevents this.
--- drivers/infiniband/sw/rxe/rxe_mr.c | 2 +- drivers/infiniband/sw/rxe/rxe_mw.c | 2 +- drivers/infiniband/sw/rxe/rxe_pool.c | 49 +++++++++++++++++++++------ drivers/infiniband/sw/rxe/rxe_pool.h | 6 ++++ drivers/infiniband/sw/rxe/rxe_verbs.c | 23 +++++++------ 5 files changed, 59 insertions(+), 23 deletions(-)
drivers/infiniband/sw/rxe/rxe_mr.c +1 -1
@@ -692,7 +692,7 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)rxe_disable (mr); mr->state =RXE_MR_STATE_INVALID ;rxe_drop_ref (mr_pd (mr)); -rxe_drop_ref (mr); +rxe_drop_wait (mr);return 0 ; }
drivers/infiniband/sw/rxe/rxe_mw.c +1 -1
@@ -63,8 +63,8 @@ int rxe_dealloc_mw(struct ib_mw *ibmw)rxe_do_dealloc_mw (mw);spin_unlock_bh (&mw->lock); -rxe_drop_ref (mw);rxe_drop_ref (pd); +rxe_drop_wait (mw);return 0 ; }
drivers/infiniband/sw/rxe/rxe_pool.c +39 -10
87 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_pool.h +6 -0
@@ -28,6 +28,7 @@ struct rxe_pool_elem {void *obj;struct kref ref_cnt;struct list_head list; +struct completion complete;u32 index;bool enabled; };
@@ -38,6 +39,7 @@ struct rxe_pool {void (*cleanup)(struct rxe_pool_elem *elem);enum rxe_pool_flags flags;enum rxe_elem_type type; +unsigned int timeouts;unsigned int max_elem;atomic_t num_elem;
@@ -86,4 +88,8 @@ int __rxe_drop_ref(struct rxe_pool_elem *elem);#define rxe_disable (obj) ((obj)->elem.enabled = false) +int __rxe_drop_wait (struct rxe_pool_elem *elem); + +#define rxe_drop_wait (obj) __rxe_drop_wait(&(obj)->elem) +#endif /* RXE_POOL_H */
drivers/infiniband/sw/rxe/rxe_verbs.c +12 -11
@@ -115,7 +115,7 @@ static void rxe_dealloc_ucontext(struct ib_ucontext *ibuc) {struct rxe_ucontext *uc =to_ruc (ibuc); -rxe_drop_ref (uc); +rxe_drop_wait (uc); } static int rxe_port_immutable(struct ib_device *dev, u32 port_num,
@@ -149,7 +149,7 @@ static int rxe_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) {struct rxe_pd *pd =to_rpd (ibpd); -rxe_drop_ref (pd); +rxe_drop_wait (pd);return 0 ; }
@@ -189,7 +189,7 @@ static int rxe_create_ah(struct ib_ah *ibah, err =copy_to_user (&uresp->ah_num, &ah->ah_num,sizeof (uresp->ah_num));if (err) { -rxe_drop_ref (ah); +rxe_drop_wait (ah);return -EFAULT ; } }else if (ah->is_user) {
@@ -233,8 +233,8 @@ static int rxe_destroy_ah(struct ib_ah *ibah, u32 flags)struct rxe_ah *ah =to_rah (ibah);rxe_disable (ah); +rxe_drop_wait (ah); -rxe_drop_ref (ah);return 0 ; }
@@ -322,7 +322,7 @@ static int rxe_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init, err2:rxe_drop_ref (pd); -rxe_drop_ref (srq); +rxe_drop_wait (srq); err1:return err; }
@@ -382,7 +382,8 @@ static int rxe_destroy_srq(struct ib_srq *ibsrq, struct ib_udata *udata)rxe_queue_cleanup (srq->rq.queue);rxe_drop_ref (srq->pd); -rxe_drop_ref (srq); +rxe_drop_wait (srq); +return 0 ; }
@@ -454,7 +455,7 @@ static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init,return 0 ; qp_init: -rxe_drop_ref (qp); +rxe_drop_wait (qp);return err; }
@@ -509,7 +510,7 @@ static int rxe_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)rxe_disable (qp);rxe_qp_destroy (qp); -rxe_drop_ref (qp); +rxe_drop_wait (qp);return 0 ; }
@@ -822,7 +823,7 @@ static int rxe_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)rxe_cq_disable (cq); -rxe_drop_ref (cq); +rxe_drop_wait (cq);return 0 ; }
@@ -954,7 +955,7 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd, err3:rxe_drop_ref (pd); -rxe_drop_ref (mr); +rxe_drop_wait (mr); err2:return ERR_PTR (err); }
@@ -988,7 +989,7 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type, err2:rxe_drop_ref (pd); -rxe_drop_ref (mr); +rxe_drop_wait (mr); err1:return ERR_PTR (err); }
Signature · 1 line
2.32.0
Jason Gunthorpe
maintainerRe: [PATCH for-next v10 06/11] RDMA/rxe: Add wait_for_completion to pool objects
drivers/infiniband/sw/rxe/rxe_pool.c int __rxe_drop_ref(struct rxe_pool_elem *elem) · line 259
Quoted 4 lines · Bob Pearson
int
__rxe_add_ref(struct rxe_pool_elem *elem)drivers/infiniband/sw/rxe/rxe_pool.c +0
-0@@ -262,3 +258,36 @@ int __rxe_drop_ref(struct rxe_pool_elem *elem)return kref_put_lock_irqsave (&elem->ref_cnt, rxe_elem_release, &pool->xa.xa_lock);
Also can't touch the xa_lock to do stuff like this,
drivers/infiniband/sw/rxe/rxe_pool.c int __rxe_drop_ref(struct rxe_pool_elem *elem) · line 263
Quoted 1 line
drivers/infiniband/sw/rxe/rxe_pool.c +1
-0+int __rxe_drop_wait (struct rxe_pool_elem *elem)
I think I would call this something else since it it basically unconditionally frees the memory.
drivers/infiniband/sw/rxe/rxe_pool.c int __rxe_drop_ref(struct rxe_pool_elem *elem) · line 275
Quoted 12 lines
drivers/infiniband/sw/rxe/rxe_pool.c +11
-0+{ +struct rxe_pool *pool = elem->pool; +static int timeout =RXE_POOL_TIMEOUT ; +int ret; + +__rxe_drop_ref (elem); +if (timeout) { + ret =wait_for_completion_timeout (&elem->complete, timeout); +if (!ret) { +pr_warn ("Timed out waiting for %s#%d\n" , + pool->name +4 , elem->index);
This is a WARN_ON event, kernel is broken, and you should leak the memory rather than cause memory corruption.
drivers/infiniband/sw/rxe/rxe_pool.c int __rxe_drop_ref(struct rxe_pool_elem *elem) · line 280
Quoted 5 lines
drivers/infiniband/sw/rxe/rxe_pool.c +5
-0+if (++pool->timeouts ==RXE_MAX_POOL_TIMEOUTS ) { + timeout =0 ; +pr_warn ("Reached max %s timeouts.\n" , + pool->name +4 ); + }
Why?
drivers/infiniband/sw/rxe/rxe_pool.c int __rxe_drop_ref(struct rxe_pool_elem *elem) · line 292
Quoted 12 lines
drivers/infiniband/sw/rxe/rxe_pool.c +12
-0+ } + } + +if (pool->cleanup) + pool->cleanup (elem); + +if (pool->flags &RXE_POOL_ALLOC ) +kfree (elem->obj); + +atomic_dec (&pool->num_elem); + +return ret;
And we return a failure code but freed the memory? This shouldn't fail
But the idea is right..
Jason
PATCH v10 7/11 RDMA/rxe: Fix ref error in rxe_av.c
In reply to Bob PearsonThe commit referenced below can take a reference to the AH which is never dropped. This only happens in the UD request path. This patch optionally passes that AH back to the caller so that it can hold the reference while the AV is being accessed and then drop it. Code to do this is added to rxe_req.c. The AV is also passed to rxe_prepare in rxe_net.c as an optimization.
--- drivers/infiniband/sw/rxe/rxe_av.c | 19 +++++++++- drivers/infiniband/sw/rxe/rxe_loc.h | 5 ++- drivers/infiniband/sw/rxe/rxe_net.c | 17 +++++---- drivers/infiniband/sw/rxe/rxe_req.c | 55 +++++++++++++++++----------- drivers/infiniband/sw/rxe/rxe_resp.c | 2 +- 5 files changed, 63 insertions(+), 35 deletions(-)
drivers/infiniband/sw/rxe/rxe_av.c +17 -2
@@ -99,11 +99,14 @@ void rxe_av_fill_ip_info(struct rxe_av *av, struct rdma_ah_attr *attr) av->network_type = type; } -struct rxe_av *rxe_get_av (struct rxe_pkt_info *pkt) +struct rxe_av *rxe_get_av (struct rxe_pkt_info *pkt,struct rxe_ah **ahp) {struct rxe_ah *ah;u32 ah_num; +if (ahp) + *ahp =NULL ; +if (!pkt || !pkt->qp)return NULL ;
@@ -117,10 +120,22 @@ struct rxe_av *rxe_get_av(struct rxe_pkt_info *pkt)if (ah_num) {/* only new user provider or kernel client */ ah =rxe_pool_get_index (&pkt->rxe->ah_pool, ah_num); -if (!ah || ah->ah_num != ah_num ||rxe_ah_pd (ah) != pkt->qp->pd) { +if (!ah) {pr_warn ("Unable to find AH matching ah_num\n" );return NULL ; } + +if (rxe_ah_pd (ah) != pkt->qp->pd) { +pr_warn ("PDs don't match for AH and QP\n" ); +rxe_drop_ref (ah); +return NULL ; + } + +if (ahp) + *ahp = ah; +else +rxe_drop_ref (ah); +return &ah->av; }
drivers/infiniband/sw/rxe/rxe_loc.h +3 -2
@@ -19,7 +19,7 @@ void rxe_av_to_attr(struct rxe_av *av, struct rdma_ah_attr *attr);void rxe_av_fill_ip_info (struct rxe_av *av,struct rdma_ah_attr *attr); -struct rxe_av *rxe_get_av (struct rxe_pkt_info *pkt); +struct rxe_av *rxe_get_av (struct rxe_pkt_info *pkt,struct rxe_ah **ahp);/* rxe_cq.c */ int rxe_cq_chk_attr(struct rxe_dev *rxe, struct rxe_cq *cq,
@@ -94,7 +94,8 @@ void rxe_mw_cleanup(struct rxe_pool_elem *arg);/* rxe_net.c */ struct sk_buff *rxe_init_packet (struct rxe_dev *rxe,struct rxe_av *av,int paylen,struct rxe_pkt_info *pkt); -int rxe_prepare (struct rxe_pkt_info *pkt,struct sk_buff *skb); +int rxe_prepare (struct rxe_av *av,struct rxe_pkt_info *pkt, +struct sk_buff *skb);int rxe_xmit_packet (struct rxe_qp *qp,struct rxe_pkt_info *pkt,struct sk_buff *skb);const char *rxe_parent_name (struct rxe_dev *rxe,unsigned int port_num);
drivers/infiniband/sw/rxe/rxe_net.c +9 -8
@@ -271,13 +271,13 @@ static void prepare_ipv6_hdr(struct dst_entry *dst, struct sk_buff *skb, ip6h->payload_len =htons (skb->len -sizeof (*ip6h)); } -static int prepare4 (struct rxe_pkt_info *pkt,struct sk_buff *skb) +static int prepare4 (struct rxe_av *av,struct rxe_pkt_info *pkt, +struct sk_buff *skb) {struct rxe_qp *qp = pkt->qp;struct dst_entry *dst;bool xnet = false;__be16 df =htons (IP_DF ); -struct rxe_av *av =rxe_get_av (pkt);struct in_addr *saddr = &av->sgid_addr._sockaddr_in.sin_addr;struct in_addr *daddr = &av->dgid_addr._sockaddr_in.sin_addr;
@@ -297,11 +297,11 @@ static int prepare4(struct rxe_pkt_info *pkt, struct sk_buff *skb)return 0 ; } -static int prepare6 (struct rxe_pkt_info *pkt,struct sk_buff *skb) +static int prepare6 (struct rxe_av *av,struct rxe_pkt_info *pkt, +struct sk_buff *skb) {struct rxe_qp *qp = pkt->qp;struct dst_entry *dst; -struct rxe_av *av =rxe_get_av (pkt);struct in6_addr *saddr = &av->sgid_addr._sockaddr_in6.sin6_addr;struct in6_addr *daddr = &av->dgid_addr._sockaddr_in6.sin6_addr;
@@ -322,16 +322,17 @@ static int prepare6(struct rxe_pkt_info *pkt, struct sk_buff *skb)return 0 ; } -int rxe_prepare (struct rxe_pkt_info *pkt,struct sk_buff *skb) +int rxe_prepare (struct rxe_av *av,struct rxe_pkt_info *pkt, +struct sk_buff *skb) {int err =0 ;if (skb->protocol ==htons (ETH_P_IP )) - err =prepare4 (pkt, skb); + err =prepare4 (av, pkt, skb);else if (skb->protocol ==htons (ETH_P_IPV6 )) - err =prepare6 (pkt, skb); + err =prepare6 (av, pkt, skb); -if (ether_addr_equal (skb->dev->dev_addr,rxe_get_av (pkt)->dmac)) +if (ether_addr_equal (skb->dev->dev_addr, av->dmac)) pkt->mask |=RXE_LOOPBACK_MASK ;return err;
drivers/infiniband/sw/rxe/rxe_req.c +33 -22
121 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_resp.c +1 -1
@@ -633,7 +633,7 @@ static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp,if (ack->mask &RXE_ATMACK_MASK )atmack_set_orig (ack, qp->resp.atomic_orig); - err =rxe_prepare (ack, skb); + err =rxe_prepare (&qp->pri_av, ack, skb);if (err) {kfree_skb (skb);return NULL ;
Signature · 1 line
2.32.0
Jason Gunthorpe
maintainerRe: [PATCH for-next v10 07/11] RDMA/rxe: Fix ref error in rxe_av.c
Quoted 9 lines · Bob Pearson
The commit referenced below can take a reference to the AH which is never dropped. This only happens in the UD request path. This patch optionally passes that AH back to the caller so that it can hold the reference while the AV is being accessed and then drop it. Code to do this is added to
rxe_req.c. The AV is also passed torxe_prepareinrxe_net.cas an optimization.Fixes e2fe06c90806 ("RDMA/rxe: Lookup kernel AH from ah index in UD WQEs")Signed-off-by Bob Pearson <[email protected]>
Quoted 7 lines
--- drivers/infiniband/sw/rxe/rxe_av.c | 19 +++++++++- drivers/infiniband/sw/rxe/rxe_loc.h | 5 ++- drivers/infiniband/sw/rxe/rxe_net.c | 17 +++++---- drivers/infiniband/sw/rxe/rxe_req.c | 55 +++++++++++++++++----------- drivers/infiniband/sw/rxe/rxe_resp.c | 2 +- 5 files changed, 63 insertions(+), 35 deletions(-)
This should be ordered earlier as the prior patch turns this into a bigger problem?
Jason
PATCH v10 8/11 RDMA/rxe: Replace mr by rkey in responder resources
In reply to Bob PearsonCurrently rxe saves a copy of MR in responder resources for RDMA reads. Since the responder resources are never freed just over written if more are needed this MR may not have a reference freed until the QP is destroyed. This patch uses the rkey instead of the MR and on subsequent packets of a multipacket read reply message it looks up the MR from the rkey for each packet. This makes it possible for a user to deregister an MR or unbind a MW on the fly and get correct behaviour.
--- drivers/infiniband/sw/rxe/rxe_qp.c | 10 +-- drivers/infiniband/sw/rxe/rxe_resp.c | 123 ++++++++++++++++++-------- drivers/infiniband/sw/rxe/rxe_verbs.h | 1 - 3 files changed, 87 insertions(+), 47 deletions(-)
drivers/infiniband/sw/rxe/rxe_qp.c +2 -8
@@ -135,12 +135,8 @@ static void free_rd_atomic_resources(struct rxe_qp *qp)void free_rd_atomic_resource (struct rxe_qp *qp,struct resp_res *res) { -if (res->type ==RXE_ATOMIC_MASK ) { +if (res->type ==RXE_ATOMIC_MASK )kfree_skb (res->atomic.skb); - }else if (res->type ==RXE_READ_MASK ) { -if (res->read.mr) -rxe_drop_ref (res->read.mr); - } res->type =0 ; }
@@ -825,10 +821,8 @@ static void rxe_qp_do_cleanup(struct work_struct *work)if (qp->pd)rxe_drop_ref (qp->pd); -if (qp->resp.mr) { +if (qp->resp.mr)rxe_drop_ref (qp->resp.mr); - qp->resp.mr =NULL ; - }if (qp_type (qp) ==IB_QPT_RC )sk_dst_reset (qp->sk->sk);
drivers/infiniband/sw/rxe/rxe_resp.c +85 -38
154 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_verbs.h +0 -1
@@ -157,7 +157,6 @@ struct resp_res {struct sk_buff *skb; } atomic;struct { -struct rxe_mr *mr;u64 va_org;u32 rkey;u32 length;
Signature · 1 line
2.32.0
PATCH v10 9/11 RDMA/rxe: Convert read side locking to rcu
In reply to Bob PearsonUse rcu_read_lock() for protecting read side operations in rxe_pool.c.
--- drivers/infiniband/sw/rxe/rxe_pool.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/infiniband/sw/rxe/rxe_pool.c +9 -4
@@ -202,16 +202,15 @@ int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem)void *rxe_pool_get_index (struct rxe_pool *pool,u32 index) {struct rxe_pool_elem *elem; -unsigned long flags;void *obj; -spin_lock_irqsave (&pool->xa.xa_lock, flags); +rcu_read_lock (); elem =xa_load (&pool->xa, index);if (elem && elem->enabled &&kref_get_unless_zero (&elem->ref_cnt)) obj = elem->obj;else obj =NULL ; -spin_unlock_irqrestore (&pool->xa.xa_lock, flags); +rcu_read_unlock ();return obj; }
@@ -259,13 +258,18 @@ int __rxe_drop_ref(struct rxe_pool_elem *elem) &pool->xa.xa_lock); } -int __rxe_drop_wait (struct rxe_pool_elem *elem) {struct rxe_pool *pool = elem->pool;static int timeout =RXE_POOL_TIMEOUT ;int ret; +if (elem->enabled) { +pr_warn_once ("%s#%d: should be disabled by now\n" , + elem->pool->name +4 , elem->index); + elem->enabled = false; + } +__rxe_drop_ref (elem);if (timeout) {
@@ -284,6 +288,7 @@ int __rxe_drop_wait(struct rxe_pool_elem *elem)if (pool->cleanup) pool->cleanup (elem); +/* if we reach here it is safe to free the object */ if (pool->flags &RXE_POOL_ALLOC )kfree (elem->obj);
Signature · 1 line
2.32.0
Jason Gunthorpe
maintainerRe: [PATCH for-next v10 09/11] RDMA/rxe: Convert read side locking to rcu
Quoted 17 lines · Bob Pearson
Use
rcu_read_lock()for protecting read side operations inrxe_pool.c.Signed-off-by Bob Pearson <[email protected]>--- drivers/infiniband/sw/rxe/rxe_pool.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)drivers/infiniband/sw/rxe/rxe_pool.c +0
-1@@ -202,16 +202,15 @@ int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem)void *rxe_pool_get_index (struct rxe_pool *pool,u32 index) {struct rxe_pool_elem *elem; -unsigned long flags;void *obj;
drivers/infiniband/sw/rxe/rxe_pool.c int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem) · line 213
Quoted 10 lines
drivers/infiniband/sw/rxe/rxe_pool.c +2
-2-spin_lock_irqsave (&pool->xa.xa_lock, flags); +rcu_read_lock (); elem =xa_load (&pool->xa, index);if (elem && elem->enabled &&kref_get_unless_zero (&elem->ref_cnt)) obj = elem->obj;else obj =NULL ; -spin_unlock_irqrestore (&pool->xa.xa_lock, flags); +rcu_read_unlock ();
Where is the kfree_rcu to go along with this?
Jason
PATCH v10 10/11 RDMA/rxe: Move max_elem into rxe_type_info
In reply to Bob PearsonMove the maximum number of elements from a parameter in rxe_pool_init to a member of the rxe_type_info array.
--- drivers/infiniband/sw/rxe/rxe.c | 16 ++++++++-------- drivers/infiniband/sw/rxe/rxe_pool.c | 13 +++++++++++-- drivers/infiniband/sw/rxe/rxe_pool.h | 2 +- 3 files changed, 20 insertions(+), 11 deletions(-)
drivers/infiniband/sw/rxe/rxe.c +8 -8
@@ -116,14 +116,14 @@ static void rxe_init_ports(struct rxe_dev *rxe)/* init pools of managed objects */ static void rxe_init_pools (struct rxe_dev *rxe) { -rxe_pool_init (rxe, &rxe->uc_pool,RXE_TYPE_UC , rxe->max_ucontext); -rxe_pool_init (rxe, &rxe->pd_pool,RXE_TYPE_PD , rxe->attr.max_pd); -rxe_pool_init (rxe, &rxe->ah_pool,RXE_TYPE_AH , rxe->attr.max_ah); -rxe_pool_init (rxe, &rxe->srq_pool,RXE_TYPE_SRQ , rxe->attr.max_srq); -rxe_pool_init (rxe, &rxe->qp_pool,RXE_TYPE_QP , rxe->attr.max_qp); -rxe_pool_init (rxe, &rxe->cq_pool,RXE_TYPE_CQ , rxe->attr.max_cq); -rxe_pool_init (rxe, &rxe->mr_pool,RXE_TYPE_MR , rxe->attr.max_mr); -rxe_pool_init (rxe, &rxe->mw_pool,RXE_TYPE_MW , rxe->attr.max_mw); +rxe_pool_init (rxe, &rxe->uc_pool,RXE_TYPE_UC ); +rxe_pool_init (rxe, &rxe->pd_pool,RXE_TYPE_PD ); +rxe_pool_init (rxe, &rxe->ah_pool,RXE_TYPE_AH ); +rxe_pool_init (rxe, &rxe->srq_pool,RXE_TYPE_SRQ ); +rxe_pool_init (rxe, &rxe->qp_pool,RXE_TYPE_QP ); +rxe_pool_init (rxe, &rxe->cq_pool,RXE_TYPE_CQ ); +rxe_pool_init (rxe, &rxe->mr_pool,RXE_TYPE_MR ); +rxe_pool_init (rxe, &rxe->mw_pool,RXE_TYPE_MW ); }/* initialize rxe device state */
drivers/infiniband/sw/rxe/rxe_pool.c +11 -2
@@ -18,6 +18,7 @@ static const struct rxe_type_info {enum rxe_pool_flags flags;u32 min_index;u32 max_index; +u32 max_elem; } rxe_type_info[RXE_NUM_TYPES] = { [RXE_TYPE_UC] = { .name = "rxe-uc",
@@ -25,6 +26,7 @@ static const struct rxe_type_info { .elem_offset = offsetof(struct rxe_ucontext, elem), .min_index = 1, .max_index = UINT_MAX, + .max_elem = UINT_MAX, }, [RXE_TYPE_PD] = { .name = "rxe-pd",
@@ -32,6 +34,7 @@ static const struct rxe_type_info { .elem_offset = offsetof(struct rxe_pd, elem), .min_index = 1, .max_index = UINT_MAX, + .max_elem = UINT_MAX, }, [RXE_TYPE_AH] = { .name = "rxe-ah",
@@ -39,6 +42,7 @@ static const struct rxe_type_info { .elem_offset = offsetof(struct rxe_ah, elem), .min_index = RXE_MIN_AH_INDEX, .max_index = RXE_MAX_AH_INDEX, + .max_elem = RXE_MAX_AH_INDEX - RXE_MIN_AH_INDEX + 1, }, [RXE_TYPE_SRQ] = { .name = "rxe-srq",
@@ -46,6 +50,7 @@ static const struct rxe_type_info { .elem_offset = offsetof(struct rxe_srq, elem), .min_index = RXE_MIN_SRQ_INDEX, .max_index = RXE_MAX_SRQ_INDEX, + .max_elem = RXE_MAX_SRQ_INDEX - RXE_MIN_SRQ_INDEX + 1, }, [RXE_TYPE_QP] = { .name = "rxe-qp",
@@ -54,6 +59,7 @@ static const struct rxe_type_info { .cleanup = rxe_qp_cleanup, .min_index = RXE_MIN_QP_INDEX, .max_index = RXE_MAX_QP_INDEX, + .max_elem = RXE_MAX_QP_INDEX - RXE_MIN_QP_INDEX + 1, }, [RXE_TYPE_CQ] = { .name = "rxe-cq",
@@ -62,6 +68,7 @@ static const struct rxe_type_info { .cleanup = rxe_cq_cleanup, .min_index = 1, .max_index = UINT_MAX, + .max_elem = UINT_MAX, }, [RXE_TYPE_MR] = { .name = "rxe-mr",
@@ -71,6 +78,7 @@ static const struct rxe_type_info { .flags = RXE_POOL_ALLOC, .min_index = RXE_MIN_MR_INDEX, .max_index = RXE_MAX_MR_INDEX, + .max_elem = RXE_MAX_MR_INDEX - RXE_MIN_MR_INDEX + 1, }, [RXE_TYPE_MW] = { .name = "rxe-mw",
@@ -78,11 +86,12 @@ static const struct rxe_type_info { .elem_offset = offsetof(struct rxe_mw, elem), .min_index = RXE_MIN_MW_INDEX, .max_index = RXE_MAX_MW_INDEX, + .max_elem = RXE_MAX_MW_INDEX - RXE_MIN_MW_INDEX + 1, }, };void rxe_pool_init (struct rxe_dev *rxe,struct rxe_pool *pool, -enum rxe_elem_type type,unsigned int max_elem) +enum rxe_elem_type type) {const struct rxe_type_info *info = &rxe_type_info[type];
@@ -91,7 +100,7 @@ void rxe_pool_init(struct rxe_dev *rxe, struct rxe_pool *pool, pool->rxe = rxe; pool->name = info->name; pool->type = type; - pool->max_elem = max_elem; + pool->max_elem = info->max_elem; pool->elem_size =ALIGN (info->size,RXE_POOL_ALIGN ); pool->elem_offset = info->elem_offset; pool->flags = info->flags;
drivers/infiniband/sw/rxe/rxe_pool.h +1 -1
@@ -56,7 +56,7 @@ struct rxe_pool {* pool elements will be allocated out of a slab cache */ void rxe_pool_init (struct rxe_dev *rxe,struct rxe_pool *pool, -enum rxe_elem_type type,u32 max_elem); +enum rxe_elem_type type);/* free resources from object pool */ void rxe_pool_cleanup (struct rxe_pool *pool);
Signature · 1 line
2.32.0
PATCH v10 11/11 RDMA/rxe: Cleanup rxe_pool.c
In reply to Bob PearsonMinor cleanup of rxe_pool.c. Add document comment headers for the subroutines. Increase alignment for pool elements.
--- drivers/infiniband/sw/rxe/rxe_pool.c | 110 ++++++++++++++++++++++----- 1 file changed, 93 insertions(+), 17 deletions(-)
drivers/infiniband/sw/rxe/rxe_pool.c +93 -17
@@ -1,14 +1,20 @@// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB /* +* Copyright (c) 2022 Hewlett Packard Enterprise, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved. */ #include "rxe.h" -#define RXE_POOL_TIMEOUT (200) -#define RXE_MAX_POOL_TIMEOUTS (3) -#define RXE_POOL_ALIGN (16) +#define RXE_POOL_TIMEOUT 200/* jiffies */ +#define RXE_MAX_POOL_TIMEOUTS 3 + +#ifdef L1_CACHE_BYTES +#define RXE_POOL_ALIGN L1_CACHE_BYTES +#else +#define RXE_POOL_ALIGN 64 +#endif static const struct rxe_type_info { const char *name;
@@ -21,7 +27,7 @@ static const struct rxe_type_info {u32 max_elem; } rxe_type_info[RXE_NUM_TYPES] = { [RXE_TYPE_UC] = { - .name = "rxe-uc", + .name = "uc", .size = sizeof(struct rxe_ucontext), .elem_offset = offsetof(struct rxe_ucontext, elem), .min_index = 1,
@@ -29,7 +35,7 @@ static const struct rxe_type_info { .max_elem = UINT_MAX, }, [RXE_TYPE_PD] = { - .name = "rxe-pd", + .name = "pd", .size = sizeof(struct rxe_pd), .elem_offset = offsetof(struct rxe_pd, elem), .min_index = 1,
@@ -37,7 +43,7 @@ static const struct rxe_type_info { .max_elem = UINT_MAX, }, [RXE_TYPE_AH] = { - .name = "rxe-ah", + .name = "ah", .size = sizeof(struct rxe_ah), .elem_offset = offsetof(struct rxe_ah, elem), .min_index = RXE_MIN_AH_INDEX,
@@ -45,7 +51,7 @@ static const struct rxe_type_info { .max_elem = RXE_MAX_AH_INDEX - RXE_MIN_AH_INDEX + 1, }, [RXE_TYPE_SRQ] = { - .name = "rxe-srq", + .name = "srq", .size = sizeof(struct rxe_srq), .elem_offset = offsetof(struct rxe_srq, elem), .min_index = RXE_MIN_SRQ_INDEX,
@@ -53,7 +59,7 @@ static const struct rxe_type_info { .max_elem = RXE_MAX_SRQ_INDEX - RXE_MIN_SRQ_INDEX + 1, }, [RXE_TYPE_QP] = { - .name = "rxe-qp", + .name = "qp", .size = sizeof(struct rxe_qp), .elem_offset = offsetof(struct rxe_qp, elem), .cleanup = rxe_qp_cleanup,
@@ -62,7 +68,7 @@ static const struct rxe_type_info { .max_elem = RXE_MAX_QP_INDEX - RXE_MIN_QP_INDEX + 1, }, [RXE_TYPE_CQ] = { - .name = "rxe-cq", + .name = "cq", .size = sizeof(struct rxe_cq), .elem_offset = offsetof(struct rxe_cq, elem), .cleanup = rxe_cq_cleanup,
@@ -71,7 +77,7 @@ static const struct rxe_type_info { .max_elem = UINT_MAX, }, [RXE_TYPE_MR] = { - .name = "rxe-mr", + .name = "mr", .size = sizeof(struct rxe_mr), .elem_offset = offsetof(struct rxe_mr, elem), .cleanup = rxe_mr_cleanup,
@@ -81,7 +87,7 @@ static const struct rxe_type_info { .max_elem = RXE_MAX_MR_INDEX - RXE_MIN_MR_INDEX + 1, }, [RXE_TYPE_MW] = { - .name = "rxe-mw", + .name = "mw", .size = sizeof(struct rxe_mw), .elem_offset = offsetof(struct rxe_mw, elem), .min_index = RXE_MIN_MW_INDEX,
@@ -90,6 +96,12 @@ static const struct rxe_type_info { }, }; +/** +* rxe_pool_init - initialize a rxe object pool +* @rxe: rxe device pool belongs to +* @pool: object pool +* @type: pool type +*/ void rxe_pool_init (struct rxe_dev *rxe,struct rxe_pool *pool,enum rxe_elem_type type) {
@@ -113,6 +125,10 @@ void rxe_pool_init(struct rxe_dev *rxe, struct rxe_pool *pool, pool->limit.min = info->min_index; } +/** +* rxe_pool_cleanup - free any remaining pool resources +* @pool: object pool +*/ void rxe_pool_cleanup (struct rxe_pool *pool) {struct rxe_pool_elem *elem;
@@ -135,9 +151,15 @@ void rxe_pool_cleanup(struct rxe_pool *pool)if (elem_count || obj_count)pr_warn ("Freed %d indices and %d objects from pool %s\n" , - elem_count, obj_count, pool->name +4 ); + elem_count, obj_count, pool->name); } +/** +* rxe_alloc - allocate a new pool object +* @pool: object pool +* +* Returns: object on success else NULL +*/ void *rxe_alloc (struct rxe_pool *pool) {struct rxe_pool_elem *elem;
@@ -178,6 +200,13 @@ void *rxe_alloc(struct rxe_pool *pool)return NULL ; } +/** +* __rxe_add_to_pool - add rdma-core allocated object to rxe object pool +* @pool: object pool +* @elem: rxe_pool_elem embedded in object +* +* Returns: 0 on success else an error +*/ int __rxe_add_to_pool (struct rxe_pool *pool,struct rxe_pool_elem *elem) {int err;
@@ -208,6 +237,13 @@ int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem)return -EINVAL ; } +/** +* rxe_pool_get - find object in pool with given index +* @pool: object pool +* @index: index +* +* Returns: object on success else NULL +*/ void *rxe_pool_get_index (struct rxe_pool *pool,u32 index) {struct rxe_pool_elem *elem;
@@ -224,6 +260,16 @@ void *rxe_pool_get_index(struct rxe_pool *pool, u32 index)return obj; } +/** +* rxe_elem_release - remove object index and complete +* @kref: kref embedded in pool element +* @flags: flags for lock release +* +* Context: called holding pool->xa.xa_lock which must be +* dropped. Called from __rxe_drop_ref() when the ref count +* reaches zero. Completes the object scheduling +* a waiter on the object. +*/ static void rxe_elem_release (struct kref *kref,unsigned long flags) __releases(&pool->xa.xa_lock) {
@@ -238,13 +284,28 @@ static void rxe_elem_release(struct kref *kref, unsigned long flags)complete (&elem->complete); } +/** +* __rxe_add_ref - gets a kref on the object unless ref count is zero +* @elem: rxe_pool_elem embedded in object +* +* Returns: 1 if reference is added else 0 because +* ref count has reached zero +*/ int __rxe_add_ref (struct rxe_pool_elem *elem) {return kref_get_unless_zero (&elem->ref_cnt); } -/* local copy of kref_put_lock_irqsave same as kref_put_lock -* except for _irqsave locks +/** +* kref_put_lock_irqsave - local copy of kref_put_lock +* @kref: kref embedded in elem +* @release: cleanup function called when ref count reaches zero +* @lock: irqsave spinlock to take if ref count reaches zero +* +* Same as kref_put_lock except for _irqsave locks +* +* Returns: 1 if ref count reaches zero and release is called +* while holding the lock else 0. */ static int kref_put_lock_irqsave(struct kref *kref, void (*release)(struct kref *kref, unsigned long flags),
@@ -259,6 +320,15 @@ static int kref_put_lock_irqsave(struct kref *kref,return 0 ; } +/** +* __rxe_drop_ref - puts a kref on the object +* @elem: rxe_pool_elem embedded in object +* +* Puts a kref on the object and if ref count reaches zero +* takes the lock and calls release() which must free the lock. +* +* Returns: 1 if ref count reaches zero and release called else 0 +*/ int __rxe_drop_ref (struct rxe_pool_elem *elem) {struct rxe_pool *pool = elem->pool;
@@ -267,6 +337,12 @@ int __rxe_drop_ref(struct rxe_pool_elem *elem) &pool->xa.xa_lock); } +/** +* __rxe_drop_wait - put a kref on object and wait for completion +* @elem: rxe_pool_elem embedded in object +* +* Returns: non-zero value if completion is reached else 0 if timeout +*/ int __rxe_drop_wait (struct rxe_pool_elem *elem) {struct rxe_pool *pool = elem->pool;
@@ -275,7 +351,7 @@ int __rxe_drop_wait(struct rxe_pool_elem *elem)if (elem->enabled) {pr_warn_once ("%s#%d: should be disabled by now\n" , - elem->pool->name +4 , elem->index); + elem->pool->name, elem->index); elem->enabled = false; }
@@ -285,11 +361,11 @@ int __rxe_drop_wait(struct rxe_pool_elem *elem) ret =wait_for_completion_timeout (&elem->complete, timeout);if (!ret) {pr_warn ("Timed out waiting for %s#%d\n" , - pool->name +4 , elem->index); + pool->name, elem->index);if (++pool->timeouts ==RXE_MAX_POOL_TIMEOUTS ) { timeout =0 ;pr_warn ("Reached max %s timeouts.\n" , - pool->name +4 ); + pool->name); } } }
Signature · 1 line
2.32.0
Jason Gunthorpe
maintainerQuoted 10 lines · Bob Pearson
There are several race conditions discovered in the current
rdma_rxedriver. They mostly relate to races between normal operations and destroying objects. This patch series
- Makes several minor cleanups in rxe_pool.[ch]
- Replaces the red-black trees currently used by xarrays for indices
- Corrects several reference counting errors
- Adds wait for completions to the paths in verbs APIs which destroy objects.
- Changes read side locking to rcu.
Quoted 5 lines
Signed-off-by Bob Pearson <[email protected]>---
v10
Rebased to current wip/jgg-for-next.
Split some patches into smaller ones.
Before I look at this, can I apply it without the last two mcast patches?
Thanks,
Jason