Intel-GFX Archive on 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
Cc: Matthew Auld <matthew.auld@intel.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/gt: Close race between cacheline_retire and free
Date: Fri, 06 Mar 2020 18:19:55 +0200	[thread overview]
Message-ID: <87v9nh3178.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20200306154647.3528345-1-chris@chris-wilson.co.uk>

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

> If the cacheline may still be busy, atomically mark it for future
> release, and only if we can determine that it will never be used again,
> immediately free it.
>
> Closes: https://gitlab.freedesktop.org/drm/intel/issues/1392
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>

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

> ---
>  drivers/gpu/drm/i915/gt/intel_timeline.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_timeline.c b/drivers/gpu/drm/i915/gt/intel_timeline.c
> index 54e1e55f3c81..91debbc97c9a 100644
> --- a/drivers/gpu/drm/i915/gt/intel_timeline.c
> +++ b/drivers/gpu/drm/i915/gt/intel_timeline.c
> @@ -192,11 +192,15 @@ static void cacheline_release(struct intel_timeline_cacheline *cl)
>  
>  static void cacheline_free(struct intel_timeline_cacheline *cl)
>  {
> +	if (!i915_active_acquire_if_busy(&cl->active)) {
> +		__idle_cacheline_free(cl);
> +		return;
> +	}
> +
>  	GEM_BUG_ON(ptr_test_bit(cl->vaddr, CACHELINE_FREE));
>  	cl->vaddr = ptr_set_bit(cl->vaddr, CACHELINE_FREE);
>  
> -	if (i915_active_is_idle(&cl->active))
> -		__idle_cacheline_free(cl);
> +	i915_active_release(&cl->active);
>  }
>  
>  int intel_timeline_init(struct intel_timeline *timeline,
> -- 
> 2.25.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-03-06 16:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-06 15:46 [Intel-gfx] [PATCH] drm/i915/gt: Close race between cacheline_retire and free Chris Wilson
2020-03-06 16:19 ` Mika Kuoppala [this message]
2020-03-06 23:54 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for " Patchwork
2020-03-07  0:04 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-03-07 18:44 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " 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=87v9nh3178.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    /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