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/5] drm/i915: Remove num_pages parameter to i915_error_object_create()
Date: Fri, 15 Aug 2014 21:07:55 +0300 [thread overview]
Message-ID: <87zjf562ys.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <1407870351-6064-3-git-send-email-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> For cleanliness, i915_error_object_create() was written to handle the
> NULL pointer in a central location. The macro that wrapped it and passed
> it a num_pages to use, was not safe. As we now never limit the num_pages
> to use (we did so at one point to only capture the first page of the
> context), we can remove the redundant macro and be NULL safe again.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> Cc: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
> drivers/gpu/drm/i915/i915_gpu_error.c | 25 ++++++++++---------------
> 1 file changed, 10 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index 6d280c07..726e6b1 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -558,12 +558,12 @@ static void i915_error_state_free(struct kref *error_ref)
> }
>
> static struct drm_i915_error_object *
> -i915_error_object_create_sized(struct drm_i915_private *dev_priv,
> - struct drm_i915_gem_object *src,
> - struct i915_address_space *vm,
> - int num_pages)
> +i915_error_object_create(struct drm_i915_private *dev_priv,
> + struct drm_i915_gem_object *src,
> + struct i915_address_space *vm)
> {
> struct drm_i915_error_object *dst;
> + int num_pages;
> bool use_ggtt;
> int i = 0;
> u32 reloc_offset;
> @@ -571,6 +571,8 @@ i915_error_object_create_sized(struct drm_i915_private *dev_priv,
> if (src == NULL || src->pages == NULL)
> return NULL;
>
> + num_pages = src->base.size >> PAGE_SHIFT;
> +
> dst = kmalloc(sizeof(*dst) + num_pages * sizeof(u32 *), GFP_ATOMIC);
> if (dst == NULL)
> return NULL;
> @@ -649,13 +651,8 @@ unwind:
> kfree(dst);
> return NULL;
> }
> -#define i915_error_object_create(dev_priv, src, vm) \
> - i915_error_object_create_sized((dev_priv), (src), (vm), \
> - (src)->base.size>>PAGE_SHIFT)
> -
> #define i915_error_ggtt_object_create(dev_priv, src) \
> - i915_error_object_create_sized((dev_priv), (src), &(dev_priv)->gtt.base, \
> - (src)->base.size>>PAGE_SHIFT)
> + i915_error_object_create((dev_priv), (src), &(dev_priv)->gtt.base)
>
> static void capture_bo(struct drm_i915_error_buffer *err,
> struct i915_vma *vma)
> @@ -1004,8 +1001,7 @@ static void i915_gem_record_rings(struct drm_device *dev,
> request->batch_obj,
> vm);
>
> - if (HAS_BROKEN_CS_TLB(dev_priv->dev) &&
> - ring->scratch.obj)
> + if (HAS_BROKEN_CS_TLB(dev_priv->dev))
> error->ring[i].wa_batchbuffer =
> i915_error_ggtt_object_create(dev_priv,
> ring->scratch.obj);
> @@ -1027,9 +1023,8 @@ static void i915_gem_record_rings(struct drm_device *dev,
> error->ring[i].ringbuffer =
> i915_error_ggtt_object_create(dev_priv, ring->buffer->obj);
>
> - if (ring->status_page.obj)
> - error->ring[i].hws_page =
> - i915_error_ggtt_object_create(dev_priv, ring->status_page.obj);
> + error->ring[i].hws_page =
> + i915_error_ggtt_object_create(dev_priv, ring->status_page.obj);
>
> i915_gem_record_active_context(ring, error, &error->ring[i]);
>
> --
> 1.9.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2014-08-15 18:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-12 19:05 [PATCH 1/5] drm/i915: Print captured bo for all VM in error state Chris Wilson
2014-08-12 19:05 ` [PATCH 2/5] drm/i915: Do not access stolen memory directly by the CPU, even for error capture Chris Wilson
2014-08-14 14:51 ` Mika Kuoppala
2014-08-14 19:35 ` Chris Wilson
2014-08-15 11:11 ` Mika Kuoppala
2014-08-15 18:07 ` Mika Kuoppala
2014-08-12 19:05 ` [PATCH 3/5] drm/i915: Remove num_pages parameter to i915_error_object_create() Chris Wilson
2014-08-15 18:07 ` Mika Kuoppala [this message]
2014-08-12 19:05 ` [PATCH 4/5] drm/i915: Suppress a WARN on reading an object back for a GPU hang Chris Wilson
2014-08-15 18:09 ` Mika Kuoppala
2014-08-25 21:27 ` Daniel Vetter
2014-08-12 19:05 ` [PATCH 5/5] drm/i915: s/seqno/request/ tracking inside objects Chris Wilson
2014-08-27 9:55 ` Daniel Vetter
2014-08-27 10:39 ` Chris Wilson
2014-09-02 10:06 ` John Harrison
2014-09-06 9:12 ` Chris Wilson
2014-08-13 14:50 ` [PATCH 1/5] drm/i915: Print captured bo for all VM in error state Mika Kuoppala
2014-08-14 6:50 ` Chris Wilson
2014-08-14 10:18 ` Mika Kuoppala
2014-08-14 15:03 ` Daniel Vetter
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=87zjf562ys.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox