linux_dsm_epyc7002/drivers/infiniband/hw/mlx5
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
..
ah.c RDMA: Handle AH allocations by IB/core 2019-04-08 13:05:25 -03:00
cmd.c IB/mlx5: Fix device memory flows 2019-12-12 16:55:36 -05:00
cmd.h IB/mlx5: Fix device memory flows 2019-12-12 16:55:36 -05:00
cong.c infiniband: mlx5: no need to check return value of debugfs_create functions 2019-01-24 09:22:29 -07:00
cq.c IB: Allow calls to ib_umem_get from kernel ULPs 2020-01-16 16:14:28 +02:00
devx.c RDMA/mlx5: Fix async events cleanup flows 2020-02-13 09:48:17 -04:00
doorbell.c IB: Allow calls to ib_umem_get from kernel ULPs 2020-01-16 16:14:28 +02:00
flow.c IB/mlx5: Support flow counters offset for bulk counters 2019-11-13 15:42:36 -04:00
gsi.c IB/mlx5: Fix outstanding_pi index for GSI qps 2020-01-03 15:56:41 -04:00
ib_rep.c IB/mlx5: Rename profile and init methods 2019-11-11 12:15:29 -08:00
ib_rep.h IB/mlx5: Rename profile and init methods 2019-11-11 12:15:29 -08:00
ib_virt.c IB/mlx5: Return the administrative GUID if exists 2020-01-25 14:54:39 -04:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mad.c RDMA: Change MAD processing function to remove extra casting and parameter 2019-11-12 20:20:15 -04:00
main.c IB/mlx5: Use div64_u64 for num_var_hw_entries calculation 2020-02-14 15:21:52 -04:00
Makefile RDMA/mlx5: Return ODP type per MR 2019-10-22 15:22:47 -03:00
mem.c IB/mlx5: Unify ODP MR code paths to allow extra flexibility 2020-01-03 17:00:13 -04:00
mlx5_ib.h IB/mlx5: Fix implicit ODP race 2020-03-04 13:25:00 -04:00
mr.c Use ODP MRs for kernel ULPs 2020-01-21 09:55:04 -04:00
odp.c IB/mlx5: Fix implicit ODP race 2020-03-04 13:25:00 -04:00
qp.c IB/mlx5: Return failure when rts2rts_qp_counters_set_id is not supported 2020-02-11 14:23:01 -04:00
restrack.c RDMA/nldev: Provide MR statistics 2019-10-22 15:33:31 -03:00
srq_cmd.c mlx5: Use refcount_t for refcount 2019-08-07 11:01:48 -07:00
srq.c IB: Allow calls to ib_umem_get from kernel ULPs 2020-01-16 16:14:28 +02:00
srq.h RDMA: Handle SRQ allocations by IB/core 2019-04-08 13:05:25 -03:00