[PATCH rdma-rc 2/4] IB/mlx5: Retry cache population when resource is temporarily unavailable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Artemy Kovalyov <artemyko@xxxxxxxxxxxx>

The cache population function works asynchronously. The caller must wait
for the operation to complete before the access to the cache if the
functions returns with a success status. However, the function may report
that the cache is too busy and a new attempt to populate the cache is
allowed.

Fix the behavior of the MR allocation flow when cache is empty and the
cache population function returns EAGAIN.

Fixes: 49780d42dfc9 ("IB/mlx5: Expose MR cache for mlx5_ib")
Signed-off-by: Artemy Kovalyov <artemyko@xxxxxxxxxxxx>
Signed-off-by: Moni Shoua <monis@xxxxxxxxxxxx>
Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
---
 drivers/infiniband/hw/mlx5/mr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 9b195d65a13e..f600623ce3f7 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -480,7 +480,8 @@ struct mlx5_ib_mr *mlx5_mr_cache_alloc(struct mlx5_ib_dev *dev, int entry)
 			if (err && err != -EAGAIN)
 				return ERR_PTR(err);
 
-			wait_for_completion(&ent->compl);
+			wait_for_completion_timeout(&ent->compl,
+						    msecs_to_jiffies(20));
 		} else {
 			mr = list_first_entry(&ent->head, struct mlx5_ib_mr,
 					      list);
-- 
2.19.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux