Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/execlists: Check for ce->state before destroy
Date: Mon, 25 Jun 2018 10:35:17 +0100	[thread overview]
Message-ID: <92d102f5-82d3-4f56-5c8f-68edb121e412@linux.intel.com> (raw)
In-Reply-To: <20180622105710.8276-1-chris@chris-wilson.co.uk>


On 22/06/2018 11:57, Chris Wilson wrote:
> As we may cancel the ce->state allocation during context pinning (but
> crucially after we mark ce as operational), that means we may be asked
> to destroy a nonexistent ce->state. Given the choice in handing a
> complex error path on pinning, and just ignoring the lack of state in
> destroy, choice the latter for simplicity.
> 
> Reported-by: Zhao Yakui <yakui.zhao@intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_lrc.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index 33bc914c2ef5..02ee3b12507f 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -1337,11 +1337,15 @@ static void execlists_schedule(struct i915_request *request,
>   
>   static void execlists_context_destroy(struct intel_context *ce)
>   {
> -	GEM_BUG_ON(!ce->state);
>   	GEM_BUG_ON(ce->pin_count);
>   
> +	if (!ce->state)
> +		return;

Or set ce->ops only after success in execlists_context_pin? Sounds 
simpler and more logical unless I am missing something.

> +
> +	GEM_BUG_ON(i915_gem_object_is_active(ce->state->obj));
> +
>   	intel_ring_free(ce->ring);
> -	__i915_gem_object_release_unless_active(ce->state->obj);
> +	i915_gem_object_put(ce->state->obj);

Hm this bit is unexpected. I don't see an immediate intersect with the 
commit message and previous change. Intuitively it makes sense that 
ce->state->obj can/must never be active once here - but then doesn't 
this second part belong in a separate patch?

Regards,

Tvrtko

>   }
>   
>   static void execlists_context_unpin(struct intel_context *ce)
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-06-25  9:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-22 10:57 [PATCH] drm/i915/execlists: Check for ce->state before destroy Chris Wilson
2018-06-22 11:19 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-06-22 18:04 ` ✓ Fi.CI.IGT: " Patchwork
2018-06-25  9:35 ` Tvrtko Ursulin [this message]
2018-06-25  9:45   ` [PATCH] " Chris Wilson

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=92d102f5-82d3-4f56-5c8f-68edb121e412@linux.intel.com \
    --to=tvrtko.ursulin@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