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: [PATCH] drm/i915/selftests: Hold rpm for unparking
Date: Thu, 09 Aug 2018 13:40:35 +0300	[thread overview]
Message-ID: <87wosz4ycc.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20180809063449.4474-1-chris@chris-wilson.co.uk>

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

> The call to i915_gem_unpark() checks that we hold a rpm wakeref before
> taking a long term wakeref for i915->gt.awake. We should therefore make
> sure we do hold the wakeref when directly calling unpark to disable
> the retire worker.

We as a caller need to hold the rpm as i915_gem_unpark does 
intel_runtime_pm_get_noresume() ?

As I don't see any other checks before gt.awake being set.

-Mika

>
> Fixes: 932cac10c8fb ("drm/i915/selftests: Prevent background reaping of active objects")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> ---
>  .../gpu/drm/i915/selftests/i915_gem_object.c  | 20 +++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_object.c b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> index d9eca1b02aee..6d3516d5bff9 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> @@ -499,6 +499,19 @@ static bool assert_mmap_offset(struct drm_i915_private *i915,
>  	return err == expected;
>  }
>  
> +static void disable_retire_worker(struct drm_i915_private *i915)
> +{
> +	mutex_lock(&i915->drm.struct_mutex);
> +	if (!i915->gt.active_requests++) {
> +		intel_runtime_pm_get(i915);
> +		i915_gem_unpark(i915);
> +		intel_runtime_pm_put(i915);
> +	}
> +	mutex_unlock(&i915->drm.struct_mutex);
> +	cancel_delayed_work_sync(&i915->gt.retire_work);
> +	cancel_delayed_work_sync(&i915->gt.idle_work);
> +}
> +
>  static int igt_mmap_offset_exhaustion(void *arg)
>  {
>  	struct drm_i915_private *i915 = arg;
> @@ -509,12 +522,7 @@ static int igt_mmap_offset_exhaustion(void *arg)
>  	int loop, err;
>  
>  	/* Disable background reaper */
> -	mutex_lock(&i915->drm.struct_mutex);
> -	if (!i915->gt.active_requests++)
> -		i915_gem_unpark(i915);
> -	mutex_unlock(&i915->drm.struct_mutex);
> -	cancel_delayed_work_sync(&i915->gt.retire_work);
> -	cancel_delayed_work_sync(&i915->gt.idle_work);
> +	disable_retire_worker(i915);
>  	GEM_BUG_ON(!i915->gt.awake);
>  
>  	/* Trim the device mmap space to only a page */
> -- 
> 2.18.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-08-09 10:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09  6:34 [PATCH] drm/i915/selftests: Hold rpm for unparking Chris Wilson
2018-08-09  7:12 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-08-09  9:03 ` ✓ Fi.CI.IGT: " Patchwork
2018-08-09 10:40 ` Mika Kuoppala [this message]
2018-08-09 10:45   ` [PATCH] " Chris Wilson
2018-08-09 10:49 ` Mika Kuoppala

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=87wosz4ycc.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