All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: imre.deak@intel.com, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: add missing rpm ref to i915_gem_pwrite_ioctl
Date: Thu, 18 Dec 2014 15:45:25 +0200	[thread overview]
Message-ID: <874mst3wcq.fsf@intel.com> (raw)
In-Reply-To: <1418753574.3177.2.camel@ideak-mobl>

On Tue, 16 Dec 2014, Imre Deak <imre.deak@intel.com> wrote:
> On Wed, 2014-11-12 at 16:40 +0200, Imre Deak wrote:
>> Without this RPM ref we can hit the device suspended WARN via:
>> i915_gem_object_pin()->ggtt_bind_vma->gen6_ggtt_insert_entries(). I
>> noticed this on my BYT while keeping the i915 device in runtime
>> suspended state for a while. I chose this place to take the ref to
>> avoid the possible deadlock via the mutex_lock taken both later in this
>> function and in the runtime suspend handler. This can happen if an RPM
>> suspend event is queued and need to be flushed before taking the RPM
>> ref.
>
> Testcase: igt/pm_rpm/gem-evict-pwrite
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87363

Pushed to drm-intel-next-fixes, thanks for the patch.

BR,
Jani.

>
>> Signed-off-by: Imre Deak <imre.deak@intel.com>
>> ---
>>  drivers/gpu/drm/i915/i915_gem.c | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
>> index 86cf428..ec2ee28 100644
>> --- a/drivers/gpu/drm/i915/i915_gem.c
>> +++ b/drivers/gpu/drm/i915/i915_gem.c
>> @@ -1075,6 +1075,7 @@ int
>>  i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
>>  		      struct drm_file *file)
>>  {
>> +	struct drm_i915_private *dev_priv = dev->dev_private;
>>  	struct drm_i915_gem_pwrite *args = data;
>>  	struct drm_i915_gem_object *obj;
>>  	int ret;
>> @@ -1094,9 +1095,11 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
>>  			return -EFAULT;
>>  	}
>>  
>> +	intel_runtime_pm_get(dev_priv);
>> +
>>  	ret = i915_mutex_lock_interruptible(dev);
>>  	if (ret)
>> -		return ret;
>> +		goto put_rpm;
>>  
>>  	obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));
>>  	if (&obj->base == NULL) {
>> @@ -1148,6 +1151,9 @@ out:
>>  	drm_gem_object_unreference(&obj->base);
>>  unlock:
>>  	mutex_unlock(&dev->struct_mutex);
>> +put_rpm:
>> +	intel_runtime_pm_put(dev_priv);
>> +
>>  	return ret;
>>  }
>>  
>
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

      reply	other threads:[~2014-12-18 13:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12 14:40 [PATCH] drm/i915: add missing rpm ref to i915_gem_pwrite_ioctl Imre Deak
2014-11-12 15:32 ` Daniel Vetter
2014-11-13 12:58   ` [PATCH] tests/pm_rpm: add gem-evict-pwrite subtest Imre Deak
2014-11-13  2:10 ` [PATCH] drm/i915: add missing rpm ref to shuang.he
2014-12-16 18:12 ` [PATCH] drm/i915: add missing rpm ref to i915_gem_pwrite_ioctl Imre Deak
2014-12-18 13:45   ` Jani Nikula [this message]

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=874mst3wcq.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=imre.deak@intel.com \
    --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.