All of lore.kernel.org
 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: [Intel-gfx] [PATCH] drm/i915/gem: Take local vma references for the parser
Date: Tue, 14 Jan 2020 17:22:40 +0200	[thread overview]
Message-ID: <87eew2f4fz.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20200113154555.1909639-1-chris@chris-wilson.co.uk>

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

> Take and hold a reference to each of the vma (and their objects) as we
> process them with the cmdparser. This stops them being freed during the
> work if the GEM execbuf is interrupted and the request we expected to
> keep the objects alive is incomplete.
>
> Fixes: 686c7c35abc2 ("drm/i915/gem: Asynchronous cmdparser")
> Closes: https://gitlab.freedesktop.org/drm/intel/issues/970
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

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

> ---
>  .../gpu/drm/i915/gem/i915_gem_execbuffer.c    | 37 ++++++++++++++++++-
>  1 file changed, 36 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index d5a0f5ae4a8b..60c984e10c4a 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -1981,9 +1981,20 @@ static int __eb_parse(struct dma_fence_work *work)
>  				       pw->trampoline);
>  }
>  
> +static void __eb_parse_release(struct dma_fence_work *work)
> +{
> +	struct eb_parse_work *pw = container_of(work, typeof(*pw), base);
> +
> +	if (pw->trampoline)
> +		i915_active_release(&pw->trampoline->active);
> +	i915_active_release(&pw->shadow->active);
> +	i915_active_release(&pw->batch->active);
> +}
> +
>  static const struct dma_fence_work_ops eb_parse_ops = {
>  	.name = "eb_parse",
>  	.work = __eb_parse,
> +	.release = __eb_parse_release,
>  };
>  
>  static int eb_parse_pipeline(struct i915_execbuffer *eb,
> @@ -1997,6 +2008,20 @@ static int eb_parse_pipeline(struct i915_execbuffer *eb,
>  	if (!pw)
>  		return -ENOMEM;
>  
> +	err = i915_active_acquire(&eb->batch->active);
> +	if (err)
> +		goto err_free;
> +
> +	err = i915_active_acquire(&shadow->active);
> +	if (err)
> +		goto err_batch;
> +
> +	if (trampoline) {
> +		err = i915_active_acquire(&trampoline->active);
> +		if (err)
> +			goto err_shadow;
> +	}
> +
>  	dma_fence_work_init(&pw->base, &eb_parse_ops);
>  
>  	pw->engine = eb->engine;
> @@ -2006,7 +2031,9 @@ static int eb_parse_pipeline(struct i915_execbuffer *eb,
>  	pw->shadow = shadow;
>  	pw->trampoline = trampoline;
>  
> -	dma_resv_lock(pw->batch->resv, NULL);
> +	err = dma_resv_lock_interruptible(pw->batch->resv, NULL);
> +	if (err)
> +		goto err_trampoline;
>  
>  	err = dma_resv_reserve_shared(pw->batch->resv, 1);
>  	if (err)
> @@ -2034,6 +2061,14 @@ static int eb_parse_pipeline(struct i915_execbuffer *eb,
>  
>  err_batch_unlock:
>  	dma_resv_unlock(pw->batch->resv);
> +err_trampoline:
> +	if (trampoline)
> +		i915_active_release(&trampoline->active);
> +err_shadow:
> +	i915_active_release(&shadow->active);
> +err_batch:
> +	i915_active_release(&eb->batch->active);
> +err_free:
>  	kfree(pw);
>  	return err;
>  }
> -- 
> 2.25.0.rc2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2020-01-14 15:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-13 15:45 [Intel-gfx] [PATCH] drm/i915/gem: Take local vma references for the parser Chris Wilson
2020-01-13 16:35 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2020-01-13 16:35 ` [Intel-gfx] ✗ Fi.CI.BUILD: warning " Patchwork
2020-01-14 15:22 ` Mika Kuoppala [this message]
2020-01-15 16:11 ` [Intel-gfx] ✓ Fi.CI.IGT: success " Patchwork

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=87eew2f4fz.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.