habanalabs: print more info when failing to pin user memory
authorTomer Tayar <ttayar@habana.ai>
Thu, 10 Jun 2021 17:48:39 +0000 (20:48 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Fri, 18 Jun 2021 12:23:42 +0000 (15:23 +0300)
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@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/memory.c

index a7a8984e6af2abbbfd1c8df8e685bb1c47393492..1cff1887e2e8995cf90000783c57e168ae113c8f 100644 (file)
@@ -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;