Skip to content

Commit 37b06e5

Browse files
Artemy-Mellanoxdledford
authored andcommitted
IB/mlx5: Fix implicit ODP interrupted page fault
Since any page fault may be interrupted by a MMU invalidation and implicit leaf MR may be released during this process. The check for parent value is unreliable condition for an implicit MR. Use other condition that we can rely on to determine if MR is implicit. Fixes: b4cfe44 ("IB/mlx5: Implement on demand paging by adding support for MMU notifiers") Signed-off-by: Artemy Kovalyov <artemyko@mellanox.com> Signed-off-by: Moni Shoua <monis@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent 36d8421 commit 37b06e5

File tree

1 file changed

+4
-5
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+4
-5
lines changed

drivers/infiniband/hw/mlx5/odp.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -506,22 +506,21 @@ void mlx5_ib_free_implicit_mr(struct mlx5_ib_mr *imr)
506506
static int pagefault_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr,
507507
u64 io_virt, size_t bcnt, u32 *bytes_mapped)
508508
{
509+
int npages = 0, current_seq, page_shift, ret, np;
510+
bool implicit = false;
509511
struct ib_umem_odp *odp_mr = to_ib_umem_odp(mr->umem);
510512
u64 access_mask = ODP_READ_ALLOWED_BIT;
511-
int npages = 0, page_shift, np;
512513
u64 start_idx, page_mask;
513514
struct ib_umem_odp *odp;
514-
int current_seq;
515515
size_t size;
516-
int ret;
517516

518517
if (!odp_mr->page_list) {
519518
odp = implicit_mr_get_data(mr, io_virt, bcnt);
520519

521520
if (IS_ERR(odp))
522521
return PTR_ERR(odp);
523522
mr = odp->private;
524-
523+
implicit = true;
525524
} else {
526525
odp = odp_mr;
527526
}
@@ -600,7 +599,7 @@ static int pagefault_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr,
600599

601600
out:
602601
if (ret == -EAGAIN) {
603-
if (mr->parent || !odp->dying) {
602+
if (implicit || !odp->dying) {
604603
unsigned long timeout =
605604
msecs_to_jiffies(MMU_NOTIFIER_TIMEOUT);
606605

0 commit comments

Comments
 (0)