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 - Moves the red-black trees used for keyed objects to rxe_mcast which was the only use case. - Corrects several reference counting errors - rebased to current for-next This patch series applies cleanly to current for-next. commit c0fe82baaeb2 ("Merge tag 'v5.16' into rdma.git for-next") Signed-off-by: Bob Pearson <rpearsonhpe@xxxxxxxxx> --- v9 Following a suggestion of Jason moved all the key code into rxe_mcast.c and separated these objects from the pools. Tightened up locking to make changes to ref count and xarray atomic with each other. Combined things to just for patches. Dropped the 0008 patch from v8 as not really necessary. v8 Fixed an additional race in 3/8 which was not handled correctly. v7 Corrected issues reported by Jason Gunthorpe Link: https://lore.kernel.org/linux-rdma/20211207190947.GH6385@xxxxxxxxxx/ Link: https://lore.kernel.org/linux-rdma/20211207191857.GI6385@xxxxxxxxxx/ Link: https://lore.kernel.org/linux-rdma/20211207192824.GJ6385@xxxxxxxxxx/ 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 (4): RDMA/rxe: Move keyed objects to rxe_mcast.c RDMA/rxe: Replace RB tree by xarray for indexes RDMA/rxe: Fix ref error in rxe_av.c RDMA/rxe: Replace mr by rkey in responder resources drivers/infiniband/sw/rxe/rxe.c | 104 +----- drivers/infiniband/sw/rxe/rxe_av.c | 19 +- drivers/infiniband/sw/rxe/rxe_loc.h | 24 +- drivers/infiniband/sw/rxe/rxe_mcast.c | 436 ++++++++++++++++------ drivers/infiniband/sw/rxe/rxe_mr.c | 1 - drivers/infiniband/sw/rxe/rxe_mw.c | 4 - drivers/infiniband/sw/rxe/rxe_net.c | 35 +- drivers/infiniband/sw/rxe/rxe_pool.c | 498 +++++++++----------------- drivers/infiniband/sw/rxe/rxe_pool.h | 109 +----- drivers/infiniband/sw/rxe/rxe_qp.c | 15 +- drivers/infiniband/sw/rxe/rxe_recv.c | 28 +- drivers/infiniband/sw/rxe/rxe_req.c | 55 +-- drivers/infiniband/sw/rxe/rxe_resp.c | 125 +++++-- drivers/infiniband/sw/rxe/rxe_verbs.c | 38 -- drivers/infiniband/sw/rxe/rxe_verbs.h | 30 +- 15 files changed, 716 insertions(+), 805 deletions(-) -- 2.32.0