public inbox for intel-gfx@lists.freedesktop.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 1/4] drm/i915: Flush the switch-to-kernel-context harder for DROP_IDLE
Date: Tue, 7 May 2019 13:28:39 +0100	[thread overview]
Message-ID: <430571b9-a9d4-a872-afb7-e2eff3043420@linux.intel.com> (raw)
In-Reply-To: <20190507121108.18377-1-chris@chris-wilson.co.uk>


On 07/05/2019 13:11, Chris Wilson wrote:
> To complete the idle worker, we must complete 2 passes of wait-for-idle.
> At the end of the first pass, we queue a switch-to-kernel-context and
> may only idle after waiting for its completion. Speed up the flush_work
> by doing the wait explicitly, which then allows us to remove the
> unbounded loop trying to complete the flush_work in the next patch.
> 
> References: 79ffac8599c4 ("drm/i915: Invert the GEM wakeref hierarchy")
> Testcase: igt/gem_ppgtt/flind-and-close-vma-leak
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_debugfs.c | 16 ++++++++++++++--
>   1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 14cd83e9ea8b..f60aed7747e5 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -3901,14 +3901,26 @@ i915_drop_caches_set(void *data, u64 val)
>   
>   	/* No need to check and wait for gpu resets, only libdrm auto-restarts
>   	 * on ioctls on -EAGAIN. */
> -	if (val & (DROP_ACTIVE | DROP_RETIRE | DROP_RESET_SEQNO)) {
> +	if (val & (DROP_ACTIVE | DROP_IDLE | DROP_RETIRE | DROP_RESET_SEQNO)) {
>   		int ret;
>   
>   		ret = mutex_lock_interruptible(&i915->drm.struct_mutex);
>   		if (ret)
>   			return ret;
>   
> -		if (val & DROP_ACTIVE)
> +		/*
> +		 * To finish the flush of the idle_worker, we must complete
> +		 * the switch-to-kernel-context, which requires a double
> +		 * pass through wait_for_idle: first queues the switch,
> +		 * second waits for the switch.
> +		 */
> +		if (ret == 0 && val & (DROP_IDLE | DROP_ACTIVE))
> +			ret = i915_gem_wait_for_idle(i915,
> +						     I915_WAIT_INTERRUPTIBLE |
> +						     I915_WAIT_LOCKED,
> +						     MAX_SCHEDULE_TIMEOUT);
> +
> +		if (ret == 0 && val & DROP_IDLE)
>   			ret = i915_gem_wait_for_idle(i915,
>   						     I915_WAIT_INTERRUPTIBLE |
>   						     I915_WAIT_LOCKED,
> 

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

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-05-07 12:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-07 12:11 [PATCH 1/4] drm/i915: Flush the switch-to-kernel-context harder for DROP_IDLE Chris Wilson
2019-05-07 12:11 ` [PATCH 2/4] drm/i915: Remove delay for idle_work Chris Wilson
2019-05-07 12:11 ` [PATCH 3/4] drm/i915: Cancel retire_worker on parking Chris Wilson
2019-05-07 12:11 ` [PATCH 4/4] drm/i915: Stop spinning for DROP_IDLE (debugfs/i915_drop_caches) Chris Wilson
2019-05-07 12:28 ` Tvrtko Ursulin [this message]
2019-05-07 13:37 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915: Flush the switch-to-kernel-context harder for DROP_IDLE Patchwork
2019-05-07 14:40 ` ✓ Fi.CI.BAT: success " Patchwork
2019-05-07 18:56 ` ✓ Fi.CI.IGT: " 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=430571b9-a9d4-a872-afb7-e2eff3043420@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