From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/6] drm/i915: Limit number of capture objects
Date: Mon, 10 Sep 2018 16:14:56 +0300 [thread overview]
Message-ID: <8736uhwl2n.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20180907112856.28242-3-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> If we fail to allocate an array for a large number of user requested
> capture objects, reduce the array size and try to grab at least some of
> the objects!
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_gpu_error.c | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index f7f2aa71d8d9..2835cacd0d08 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -1365,15 +1365,20 @@ static void request_record_user_bo(struct i915_request *request,
> {
> struct i915_capture_list *c;
> struct drm_i915_error_object **bo;
> - long count;
> + long count, max;
>
> - count = 0;
> + max = 0;
> for (c = request->capture_list; c; c = c->next)
> - count++;
> + max++;
> + if (!max)
> + return;
>
> - bo = NULL;
> - if (count)
> - bo = kcalloc(count, sizeof(*bo), GFP_ATOMIC);
> + bo = kmalloc_array(max, sizeof(*bo), GFP_ATOMIC);
There seems to be no need to zero the array.
> + if (!bo) {
> + /* If we can't capture everything, try to capture something. */
> + max = min_t(long, max, PAGE_SIZE / sizeof(*bo));
Perhaps there is some bookkeeping in slab so this would spill to 2
pages eventually?
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> + bo = kmalloc_array(max, sizeof(*bo), GFP_ATOMIC);
> + }
> if (!bo)
> return;
>
> @@ -1382,7 +1387,8 @@ static void request_record_user_bo(struct i915_request *request,
> bo[count] = i915_error_object_create(request->i915, c->vma);
> if (!bo[count])
> break;
> - count++;
> + if (++count == max)
> + break;
> }
>
> ee->user_bo = bo;
> --
> 2.19.0.rc2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-09-10 13:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-07 11:28 [PATCH 1/6] drm/i915: Missed interrupt simulation is no more, tell the world Chris Wilson
2018-09-07 11:28 ` [PATCH 2/6] drm/i915: Reorder execobject[] to insert non-48b objects into the low 4G Chris Wilson
2018-09-07 11:28 ` [PATCH 3/6] drm/i915: Limit number of capture objects Chris Wilson
2018-09-10 13:14 ` Mika Kuoppala [this message]
2018-09-10 13:25 ` Chris Wilson
2018-09-07 11:28 ` [PATCH 4/6] drm/i915: Handle incomplete Z_FINISH for compressed error states Chris Wilson
2018-09-07 11:28 ` [PATCH 5/6] drm/i915: Clear the error PTE just once on finish Chris Wilson
2018-09-07 11:28 ` [PATCH 6/6] drm/i915: Cache the error string Chris Wilson
2018-09-07 11:38 ` ✗ Fi.CI.SPARSE: warning for series starting with [1/6] drm/i915: Missed interrupt simulation is no more, tell the world Patchwork
2018-09-07 11:54 ` ✓ Fi.CI.BAT: success " Patchwork
2018-09-07 12:30 ` [PATCH 1/6] " Mika Kuoppala
2018-09-07 14:26 ` ✓ Fi.CI.IGT: success for series starting with [1/6] " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8736uhwl2n.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.