linux_dsm_epyc7002/drivers/infiniband/core
Jason Gunthorpe 9dc775e7f5 RDMA/odp: Lift umem_mutex out of ib_umem_odp_unmap_dma_pages()
This fixes a race of the form:
    CPU0                               CPU1
mlx5_ib_invalidate_range()     mlx5_ib_invalidate_range()
				 // This one actually makes npages == 0
				 ib_umem_odp_unmap_dma_pages()
				 if (npages == 0 && !dying)
  // This one does nothing
  ib_umem_odp_unmap_dma_pages()
  if (npages == 0 && !dying)
     dying = 1;
                                    dying = 1;
				    schedule_work(&umem_odp->work);
     // Double schedule of the same work
     schedule_work(&umem_odp->work);  // BOOM

npages and dying must be read and written under the umem_mutex lock.

Since whenever ib_umem_odp_unmap_dma_pages() is called mlx5 must also call
mlx5_ib_update_xlt, and both need to be done in the same locking region,
hoist the lock out of unmap.

This avoids an expensive double critical section in
mlx5_ib_invalidate_range().

Fixes: 81713d3788 ("IB/mlx5: Add implicit MR support")
Link: https://lore.kernel.org/r/20191001153821.23621-4-jgg@ziepe.ca
Reviewed-by: Artemy Kovalyov <artemyko@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
2019-10-04 15:54:21 -03:00
..
addr.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-09-28 17:47:33 -07:00
agent.c
agent.h
cache.c
cgroup.c
cm_msgs.h
cm.c RDMA/cm: Fix memory leak in cm_add/remove_one 2019-10-04 14:58:31 -03:00
cma_configfs.c
cma_priv.h
cma.c RDMA/iwcm: Fix a lock inversion issue 2019-10-01 12:11:50 -03:00
core_priv.h
counters.c
cq.c
device.c RDMA/core: Fix use after free and refcnt leak on ndev in_device in iwarp_query_port 2019-10-01 11:31:27 -03:00
fmr_pool.c
iwcm.c
iwcm.h
iwpm_msg.c
iwpm_util.c
iwpm_util.h
mad_priv.h
mad_rmpp.c
mad_rmpp.h
mad.c
Makefile
mr_pool.c
multicast.c
netlink.c
nldev.c RDMA/nldev: Reshuffle the code to avoid need to rebind QP in error path 2019-10-04 15:29:55 -03:00
opa_smi.h
packer.c
rdma_core.c
rdma_core.h
restrack.c
restrack.h
roce_gid_mgmt.c
rw.c
sa_query.c
sa.h
security.c IB/core: Fix wrong iterating on ports 2019-10-04 15:50:27 -03:00
smi.c
smi.h
sysfs.c
ucma.c
ud_header.c
umem_odp.c RDMA/odp: Lift umem_mutex out of ib_umem_odp_unmap_dma_pages() 2019-10-04 15:54:21 -03:00
umem.c mm/gup: add make_dirty arg to put_user_pages_dirty_lock() 2019-09-24 15:54:08 -07:00
user_mad.c
uverbs_cmd.c
uverbs_ioctl.c
uverbs_main.c
uverbs_marshall.c
uverbs_std_types_counters.c
uverbs_std_types_cq.c
uverbs_std_types_device.c
uverbs_std_types_dm.c
uverbs_std_types_flow_action.c
uverbs_std_types_mr.c
uverbs_std_types.c
uverbs_uapi.c
uverbs.h
verbs.c