intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/7] drm/i915: Check context status before looking up our obj/vma
Date: Thu, 17 Aug 2017 17:10:02 +0300	[thread overview]
Message-ID: <87valmqo91.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20170816085210.4199-2-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> Since we keep the context around across the slow lookup where we may
> drop the struct_mutex, we should double check that the context is still
> valid upon reacquisition.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index 359d5dc6d8df..044fb1205554 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -679,13 +679,6 @@ static int eb_select_context(struct i915_execbuffer *eb)
>  	if (unlikely(!ctx))
>  		return -ENOENT;
>  
> -	if (unlikely(i915_gem_context_is_banned(ctx))) {
> -		DRM_DEBUG("Context %u tried to submit while banned\n",
> -			  ctx->user_handle);
> -		i915_gem_context_put(ctx);
> -		return -EIO;
> -	}
> -
>  	eb->ctx = ctx;
>  	eb->vm = ctx->ppgtt ? &ctx->ppgtt->base : &eb->i915->ggtt.base;
>  
> @@ -707,6 +700,12 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb)
>  	int slow_pass = -1;
>  	int err;
>  
> +	if (unlikely(i915_gem_context_is_closed(eb->ctx)))
> +		return -ENOENT;
> +
> +	if (unlikely(i915_gem_context_is_banned(eb->ctx)))
> +		return -EIO;
> +

We are referring the lut before the context has been validated.
Not that it matters but for style, please consider assigning
the lut after the context check.

Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>

>  	INIT_LIST_HEAD(&eb->relocs);
>  	INIT_LIST_HEAD(&eb->unbound);
>  
> -- 
> 2.13.3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-08-17 14:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-16  8:52 [PATCH 1/7] drm/i915: Don't use MI_STORE_DWORD_IMM on Sandybridge/vcs Chris Wilson
2017-08-16  8:52 ` [PATCH 2/7] drm/i915: Check context status before looking up our obj/vma Chris Wilson
2017-08-17 14:10   ` Mika Kuoppala [this message]
2017-08-17 15:43     ` Chris Wilson
2017-08-16  8:52 ` [PATCH 3/7] drm/i915: Convert execbuf to use struct-of-array packing for critical fields Chris Wilson
2017-08-16  8:52 ` [PATCH 4/7] drm/i915: Simplify eb_lookup_vmas() Chris Wilson
2017-08-16  8:52 ` [PATCH 5/7] drm/i915: Replace execbuf vma ht with an idr Chris Wilson
2017-08-16  8:52 ` [PATCH 6/7] drm/i915: Trivial grammar fix s/opt of/opt out of/ in comment Chris Wilson
2017-08-17 13:38   ` Joonas Lahtinen
2017-08-16  8:52 ` [PATCH 7/7] drm/i915: Mark the GT as busy before idling the previous request Chris Wilson
2017-08-17 13:38   ` Joonas Lahtinen
2017-08-17 14:47     ` [PATCH v2] " Chris Wilson
2017-08-18  9:11       ` Joonas Lahtinen
2017-08-16  9:10 ` ✓ Fi.CI.BAT: success for series starting with [1/7] drm/i915: Don't use MI_STORE_DWORD_IMM on Sandybridge/vcs Patchwork
2017-08-17 15:36 ` ✓ Fi.CI.BAT: success for series starting with [1/7] drm/i915: Don't use MI_STORE_DWORD_IMM on Sandybridge/vcs (rev2) Patchwork
2017-08-18 11:40   ` Chris Wilson
2017-08-18 11:07 ` [PATCH 1/7] drm/i915: Don't use MI_STORE_DWORD_IMM on Sandybridge/vcs Mika Kuoppala
2017-08-18 11:17   ` Chris Wilson
2017-08-18 11:23     ` Mika Kuoppala

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=87valmqo91.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;
as well as URLs for NNTP newsgroup(s).