[PATCH] drm/i915/selftests: Improve error reporting for igt_mock_max_segment

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

 



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@xxxxxxxxxxxxxxxxxx>
Cc: Matthew Auld <matthew.auld@xxxxxxxxx>
Cc: Ramalingam C <ramalingam.c@xxxxxxxxx>
---
 .../gpu/drm/i915/selftests/intel_memory_region.c  | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/intel_memory_region.c b/drivers/gpu/drm/i915/selftests/intel_memory_region.c
index a0b518c255de..b03c2adfcf27 100644
--- a/drivers/gpu/drm/i915/selftests/intel_memory_region.c
+++ b/drivers/gpu/drm/i915/selftests/intel_memory_region.c
@@ -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, largest block %lld\n",
+		       __func__, size);
+		err = -EINVAL;
 		goto out_close;
 	}
 
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux