linux_dsm_epyc7002/drivers/infiniband/hw
Jason Gunthorpe aa116b810a RDMA/mlx5: Order num_pending_prefetch properly with synchronize_srcu
During destroy setting live = 0 and then synchronize_srcu() prevents
num_pending_prefetch from incrementing, and also, ensures that all work
holding that count is queued on the WQ. Testing before causes races of the
form:

    CPU0                                         CPU1
  dereg_mr()
                                          mlx5_ib_advise_mr_prefetch()
            				   srcu_read_lock()
                                            num_pending_prefetch_inc()
					      if (!live)
   live = 0
   atomic_read() == 0
     // skip flush_workqueue()
                                              atomic_inc()
 					      queue_work();
            				   srcu_read_unlock()
   WARN_ON(atomic_read())  // Fails

Swap the order so that the synchronize_srcu() prevents this.

Fixes: a6bc3875f1 ("IB/mlx5: Protect against prefetch of invalid MR")
Link: https://lore.kernel.org/r/20191001153821.23621-5-jgg@ziepe.ca
Reviewed-by: Artemy Kovalyov <artemyko@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
2019-10-04 15:54:22 -03:00
..
bnxt_re RDMA/bnxt_re: Fix spelling mistake "missin_resp" -> "missing_resp" 2019-09-16 10:58:57 -03:00
cxgb3 RDMA/{cxgb3, cxgb4, i40iw}: Remove common code 2019-08-12 10:19:43 -04:00
cxgb4 RDMA/cxgb4: Do not dma memory off of the stack 2019-10-04 15:13:27 -03:00
efa RDMA/efa: Fix incorrect error print 2019-09-16 14:25:43 -03:00
hfi1 RDMA/hfi1: Prevent memory leak in sdma_init 2019-10-01 11:34:55 -03:00
hns RDMA subsystem updates for 5.4 2019-09-21 10:26:24 -07:00
i40iw RDMA/i40iw: Associate ibdev to netdev before IB device registration 2019-10-04 14:29:14 -03:00
mlx4 Merge tag 'v5.3-rc8' into rdma.git for-next 2019-09-13 16:59:51 -03:00
mlx5 RDMA/mlx5: Order num_pending_prefetch properly with synchronize_srcu 2019-10-04 15:54:22 -03:00
mthca IB: Remove unneeded memset 2019-07-03 14:26:49 -03:00
ocrdma RDMA: Introduce ib_port_phys_state enum 2019-08-12 10:18:52 -04:00
qedr RDMA: Introduce ib_port_phys_state enum 2019-08-12 10:18:52 -04:00
qib mm/gup: add make_dirty arg to put_user_pages_dirty_lock() 2019-09-24 15:54:08 -07:00
usnic mm/gup: add make_dirty arg to put_user_pages_dirty_lock() 2019-09-24 15:54:08 -07:00
vmw_pvrdma RDMA/vmw_pvrdma: Free SRQ only once 2019-10-01 10:47:58 -03:00
Makefile rdma: Remove nes 2019-06-13 09:59:49 -04:00