If we can not run the drunk_hole test because we couldn't allocate the memory for the permutation array (even after we tried trimming the size), report a clear ENOMEM. Similary, if we are asked to operate on a hole too small for ourselves, make it skip quietly.
Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk> Cc: Matthew Auld <matthew.a...@intel.com> Cc: Mika Kuoppala <mika.kuopp...@linux.intel.com> --- drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c index 3dcf886a2802..d0ce496606ed 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c @@ -705,12 +705,18 @@ static int drunk_hole(struct drm_i915_private *i915, if (hole_size > KMALLOC_MAX_SIZE / sizeof(u32)) hole_size = KMALLOC_MAX_SIZE / sizeof(u32); count = hole_size; + if (!count) { + pr_debug("%s: hole is too small [%llx - %llx] >> %d: %d\n", + __func__, hole_start, hole_end, size, count); + break; + } + do { count >>= 1; order = i915_random_order(count, &prng); } while (!order && count); if (!order) - break; + return -ENOMEM; /* Ignore allocation failures (i.e. don't report them as * a test failure) as we are purposefully allocating very -- 2.15.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx