linux_dsm_epyc7002/drivers/infiniband/hw
Artemy Kovalyov de5ed007a0 IB/mlx5: Fix implicit ODP race
Following race may occur because of the call_srcu and the placement of
the synchronize_srcu vs the xa_erase.

CPU0				   CPU1

mlx5_ib_free_implicit_mr:	   destroy_unused_implicit_child_mr:
 xa_erase(odp_mkeys)
 synchronize_srcu()
				    xa_lock(implicit_children)
				    if (still in xarray)
				       atomic_inc()
				       call_srcu()
				    xa_unlock(implicit_children)
 xa_erase(implicit_children):
   xa_lock(implicit_children)
   __xa_erase()
   xa_unlock(implicit_children)

 flush_workqueue()
				   [..]
				    free_implicit_child_mr_rcu:
				     (via call_srcu)
				      queue_work()

 WARN_ON(atomic_read())
				   [..]
				    free_implicit_child_mr_work:
				     (via wq)
				      free_implicit_child_mr()
 mlx5_mr_cache_invalidate()
				     mlx5_ib_update_xlt() <-- UMR QP fail
				     atomic_dec()

The wait_event() solves the race because it blocks until
free_implicit_child_mr_work() completes.

Fixes: 5256edcb98 ("RDMA/mlx5: Rework implicit ODP destroy")
Link: https://lore.kernel.org/r/20200227113918.94432-1-leon@kernel.org
Signed-off-by: Artemy Kovalyov <artemyko@mellanox.com>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
2020-03-04 13:25:00 -04:00
..
bnxt_re RDMA subsystem updates for 5.6 2020-01-31 14:40:36 -08:00
cxgb4 RDMA/iw_cxgb4: initiate CLOSE when entering TERM 2020-02-11 14:28:00 -04:00
efa RDMA/efa: Mask access flags with the correct optional range 2020-01-29 16:41:05 -04:00
hfi1 IB/hfi1, qib: Ensure RCU is locked when accessing list 2020-03-02 11:10:21 -04:00
hns Use ODP MRs for kernel ULPs 2020-01-21 09:55:04 -04:00
i40iw Use ODP MRs for kernel ULPs 2020-01-21 09:55:04 -04:00
mlx4 IB/mlx4: Fix leak in id_map_find_del 2020-01-27 16:46:53 -04:00
mlx5 IB/mlx5: Fix implicit ODP race 2020-03-04 13:25:00 -04:00
mthca mm, tree-wide: rename put_user_page*() to unpin_user_page*() 2020-01-31 10:30:38 -08:00
ocrdma IB: Allow calls to ib_umem_get from kernel ULPs 2020-01-16 16:14:28 +02:00
qedr Use ODP MRs for kernel ULPs 2020-01-21 09:55:04 -04:00
qib IB/hfi1, qib: Ensure RCU is locked when accessing list 2020-03-02 11:10:21 -04:00
usnic mm, tree-wide: rename put_user_page*() to unpin_user_page*() 2020-01-31 10:30:38 -08:00
vmw_pvrdma IB: Allow calls to ib_umem_get from kernel ULPs 2020-01-16 16:14:28 +02:00
Makefile RDMA/iw_cxgb3: Remove the iw_cxgb3 module from kernel 2019-10-04 15:08:59 -03:00