drm/i915/selftests: Improve error reporting for igt_mock_max_segment
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 7 Dec 2020 13:03:46 +0000 (13:03 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 7 Dec 2020 14:36:44 +0000 (14:36 +0000)
When we fail to find a single block large enough to require splitting,
report the largest block we did find.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Ramalingam C <ramalingam.c@intel.com>
Reviewed-by: Ramalingam C <ramalingam.c@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201207130346.11849-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/selftests/intel_memory_region.c

index a0b518c..a55079a 100644 (file)
@@ -384,16 +384,15 @@ static int igt_mock_max_segment(void *arg)
                goto out_put;
        }
 
-       err = -EINVAL;
+       size = 0;
        list_for_each_entry(block, &obj->mm.blocks, link) {
-               if (i915_buddy_block_size(&mem->mm, block) > max_segment) {
-                       err = 0;
-                       break;
-               }
+               if (i915_buddy_block_size(&mem->mm, block) > size)
+                       size = i915_buddy_block_size(&mem->mm, block);
        }
-       if (err) {
-               pr_err("%s: Failed to create a huge contiguous block\n",
-                      __func__);
+       if (size < max_segment) {
+               pr_err("%s: Failed to create a huge contiguous block [> %u], largest block %lld\n",
+                      __func__, max_segment, size);
+               err = -EINVAL;
                goto out_close;
        }