Commit de5ed00
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: 5256edc ("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>1 parent 817a68a commit de5ed00
2 files changed
Lines changed: 8 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
| 639 | + | |
639 | 640 | | |
640 | 641 | | |
641 | 642 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
| 239 | + | |
239 | 240 | | |
240 | 241 | | |
241 | 242 | | |
| |||
554 | 555 | | |
555 | 556 | | |
556 | 557 | | |
| 558 | + | |
557 | 559 | | |
558 | 560 | | |
559 | 561 | | |
| |||
611 | 613 | | |
612 | 614 | | |
613 | 615 | | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
| 616 | + | |
618 | 617 | | |
619 | 618 | | |
620 | 619 | | |
| |||
645 | 644 | | |
646 | 645 | | |
647 | 646 | | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
| 647 | + | |
652 | 648 | | |
653 | 649 | | |
654 | 650 | | |
| |||
1720 | 1716 | | |
1721 | 1717 | | |
1722 | 1718 | | |
1723 | | - | |
| 1719 | + | |
| 1720 | + | |
1724 | 1721 | | |
1725 | 1722 | | |
1726 | 1723 | | |
| |||
0 commit comments