[PATCH 1/9] habanalabs: print more info when failing to pin user memory

From: Oded Gabbay
Date: Mon Jun 14 2021 - 08:51:16 EST


From: Tomer Tayar <ttayar@xxxxxxxxx>

pin_user_pages_fast() might fail and return a negative number, or pin
less pages than requested and return the number of the pages that were
pinned.
For the latter, it is informative to print also the memory size and the
number of requested pages.

Signed-off-by: Tomer Tayar <ttayar@xxxxxxxxx>
Reviewed-by: Oded Gabbay <ogabbay@xxxxxxxxxx>
Signed-off-by: Oded Gabbay <ogabbay@xxxxxxxxxx>
---
drivers/misc/habanalabs/common/memory.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c
index a7a8984e6af2..1cff1887e2e8 100644
--- a/drivers/misc/habanalabs/common/memory.c
+++ b/drivers/misc/habanalabs/common/memory.c
@@ -1612,8 +1612,8 @@ static int get_user_memory(struct hl_device *hdev, u64 addr, u64 size,

if (rc != npages) {
dev_err(hdev->dev,
- "Failed (%d) to pin host memory with user ptr 0x%llx\n",
- rc, addr);
+ "Failed (%d) to pin host memory with user ptr 0x%llx, size 0x%llx, npages %d\n",
+ rc, addr, size, npages);
if (rc < 0)
goto destroy_pages;
npages = rc;
--
2.25.1