[Intel-gfx] [PATCH 1/4] drm/i915/gt: Report context-is-closed prior to pinning

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Fri Mar 20 13:15:03 UTC 2020


On 20/03/2020 13:01, Chris Wilson wrote:
> Our assertion caught that we do try to pin a closed context if userspace
> is viciously racing context-closure with execbuf, so make it fail
> gracefully.
> 
> Closes: https://gitlab.freedesktop.org/drm/intel/issues/1492
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
> ---
>   drivers/gpu/drm/i915/gt/intel_context.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_context.c b/drivers/gpu/drm/i915/gt/intel_context.c
> index aea992e46c42..7132bf616cc4 100644
> --- a/drivers/gpu/drm/i915/gt/intel_context.c
> +++ b/drivers/gpu/drm/i915/gt/intel_context.c
> @@ -97,8 +97,6 @@ int __intel_context_do_pin(struct intel_context *ce)
>   {
>   	int err;
>   
> -	GEM_BUG_ON(intel_context_is_closed(ce));
> -
>   	if (unlikely(!test_bit(CONTEXT_ALLOC_BIT, &ce->flags))) {
>   		err = intel_context_alloc_state(ce);
>   		if (err)
> @@ -114,6 +112,11 @@ int __intel_context_do_pin(struct intel_context *ce)
>   		goto out_release;
>   	}
>   
> +	if (unlikely(intel_context_is_closed(ce))) {
> +		err = -ENOENT;
> +		goto out_release;
> +	}
> +
>   	if (likely(!atomic_add_unless(&ce->pin_count, 1, 0))) {
>   		err = intel_context_active_acquire(ce);
>   		if (unlikely(err))
> 

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

Regards,

Tvrtko


More information about the Intel-gfx mailing list