Skip to content

Commit

Permalink
IB/mlx5: Fix implicit MR GC
Browse files Browse the repository at this point in the history
When implicit MR's leaf MKey becomes unused, i.e. when it's
last page being released my MMU invalidation it is marked as "dying"
and scheduled for release by garbage collector.
Currentle consequent page fault may remove "dying" flag.
Treat leaf MKey as non-existent once it was scheduled to removal
by GC.

Fixes: 81713d3 ('IB/mlx5: Add implicit MR support')
Signed-off-by: Artemy Kovalyov <artemyko@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
Artemy Kovalyov authored and Doug Ledford committed Apr 25, 2017
1 parent 438b228 commit 523791d
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions drivers/infiniband/hw/mlx5/odp.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int check_parent(struct ib_umem_odp *odp,
{
struct mlx5_ib_mr *mr = odp->private;

return mr && mr->parent == parent;
return mr && mr->parent == parent && !odp->dying;
}

static struct ib_umem_odp *odp_next(struct ib_umem_odp *odp)
Expand Down Expand Up @@ -158,13 +158,6 @@ static void mr_leaf_free_action(struct work_struct *work)
mr->parent = NULL;
synchronize_srcu(&mr->dev->mr_srcu);

if (!READ_ONCE(odp->dying)) {
mr->parent = imr;
if (atomic_dec_and_test(&imr->num_leaf_free))
wake_up(&imr->q_leaf_free);
return;
}

ib_umem_release(odp->umem);
if (imr->live)
mlx5_ib_update_xlt(imr, idx, 1, 0,
Expand Down Expand Up @@ -436,8 +429,6 @@ static struct ib_umem_odp *implicit_mr_get_data(struct mlx5_ib_mr *mr,
nentries++;
}

odp->dying = 0;

/* Return first odp if region not covered by single one */
if (likely(!result))
result = odp;
Expand Down

0 comments on commit 523791d

Please sign in to comment.