Skip to content

Commit 7919514

Browse files
chiarameiohasrleon
authored andcommitted
RDMA/mlx5: Fix calculation of total invalidated pages
When invalidating an address range in mlx5, there is an optimization to do UMR operations in chunks. Previously, the invalidation counter was incorrectly updated for the same indexes within a chunk. Now, the invalidation counter is updated only when a chunk is complete and mlx5r_umr_update_xlt() is called. This ensures that the counter accurately represents the number of pages invalidated using UMR. Fixes: a3de94e ("IB/mlx5: Introduce ODP diagnostic counters") Signed-off-by: Chiara Meiohas <[email protected]> Reviewed-by: Michael Guralnik <[email protected]> Link: https://patch.msgid.link/560deb2433318e5947282b070c915f3c81fef77f.1741875692.git.leon@kernel.org Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 5ed3b0c commit 7919514

File tree

1 file changed

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

1 file changed

+6
-4
lines changed

drivers/infiniband/hw/mlx5/odp.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,6 @@ static bool mlx5_ib_invalidate_range(struct mmu_interval_notifier *mni,
308308
blk_start_idx = idx;
309309
in_block = 1;
310310
}
311-
312-
/* Count page invalidations */
313-
invalidations += idx - blk_start_idx + 1;
314311
} else {
315312
u64 umr_offset = idx & umr_block_mask;
316313

@@ -320,14 +317,19 @@ static bool mlx5_ib_invalidate_range(struct mmu_interval_notifier *mni,
320317
MLX5_IB_UPD_XLT_ZAP |
321318
MLX5_IB_UPD_XLT_ATOMIC);
322319
in_block = 0;
320+
/* Count page invalidations */
321+
invalidations += idx - blk_start_idx + 1;
323322
}
324323
}
325324
}
326-
if (in_block)
325+
if (in_block) {
327326
mlx5r_umr_update_xlt(mr, blk_start_idx,
328327
idx - blk_start_idx + 1, 0,
329328
MLX5_IB_UPD_XLT_ZAP |
330329
MLX5_IB_UPD_XLT_ATOMIC);
330+
/* Count page invalidations */
331+
invalidations += idx - blk_start_idx + 1;
332+
}
331333

332334
mlx5_update_odp_stats_with_handled(mr, invalidations, invalidations);
333335

0 commit comments

Comments
 (0)