diff mbox

[1/2] drm/i915/execlists: Check for ce->state before destroy

Message ID 20180625100604.22598-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson June 25, 2018, 10:06 a.m. UTC
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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Tvrtko Ursulin June 25, 2018, 10:40 a.m. UTC | #1
On 25/06/2018 11:06, 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 | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index 33bc914c2ef5..97460ee25b7d 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -1337,9 +1337,11 @@ 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;
> +
>   	intel_ring_free(ce->ring);
>   	__i915_gem_object_release_unless_active(ce->state->obj);
>   }
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 33bc914c2ef5..97460ee25b7d 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1337,9 +1337,11 @@  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;
+
 	intel_ring_free(ce->ring);
 	__i915_gem_object_release_unless_active(ce->state->obj);
 }