[Intel-gfx] [PATCH] drm/i915/selftests: Report ENOMEM clearly for an allocation failure
Matthew Auld
matthew.william.auld at gmail.com
Fri Nov 17 16:17:42 UTC 2017
On 17 November 2017 at 15:31, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> 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.
>
> v2: Avoid malloc(0) since that returns ZERO_SIZE_PTR not NULL.
> v3: Fixup similar construction for lowlevel_hole
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.auld at intel.com>
> Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
> Link: https://patchwork.freedesktop.org/patch/msgid/20171117101732.4335-1-chris@chris-wilson.co.uk
> Reviewed-by: Matthew Auld <matthew.auld at intel.com> #v1
> ---
> drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 36 +++++++++++++++++++--------
> 1 file changed, 26 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> index 3dcf886a2802..ca83c51b8cac 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> @@ -216,13 +216,21 @@ static int lowlevel_hole(struct drm_i915_private *i915,
> hole_size = (hole_end - hole_start) >> size;
> if (hole_size > KMALLOC_MAX_SIZE / sizeof(u32))
> hole_size = KMALLOC_MAX_SIZE / sizeof(u32);
> - count = hole_size;
> + count = hole_size / 2;
Oh wait, we need div_u64(), or maybe just hole_size >> 1...
More information about the Intel-gfx
mailing list