[Intel-gfx] [PATCH] drm/i915: get runtime PM reference around GEM set_caching IOCTL
Jani Nikula
jani.nikula at linux.intel.com
Mon Nov 16 05:33:29 PST 2015
On Wed, 04 Nov 2015, Paulo Zanoni <przanoni at gmail.com> wrote:
> 2015-11-04 17:25 GMT-02:00 Imre Deak <imre.deak at intel.com>:
>> After Damien's D3 fix I started to get runtime suspend residency for the
>> first time and that revealed a breakage on the set_caching IOCTL path
>> that accesses the HW but doesn't take an RPM ref. Fix this up.
>
> Oh, well, that's the the RPM problem that prevents me from sleeping at
> night: how can we be 100% sure we wrapped every single possible driver
> entry point? At least we shout errors and warns when we detect the
> problem.
>
> By the way, we already have some tests for specific IOCTLs on
> igt/pm_rpm, so adding a new one for this IOCTL wouldn't hurt :)
>
> Reviewed-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
Pushed to drm-intel-fixes, thanks for the patch and review.
BR,
Jani.
>
>>
>> Signed-off-by: Imre Deak <imre.deak at 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 f1e3fde..56cd501 100644
>> --- a/drivers/gpu/drm/i915/i915_gem.c
>> +++ b/drivers/gpu/drm/i915/i915_gem.c
>> @@ -3829,6 +3829,7 @@ int i915_gem_get_caching_ioctl(struct drm_device *dev, void *data,
>> int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
>> struct drm_file *file)
>> {
>> + struct drm_i915_private *dev_priv = dev->dev_private;
>> struct drm_i915_gem_caching *args = data;
>> struct drm_i915_gem_object *obj;
>> enum i915_cache_level level;
>> @@ -3857,9 +3858,11 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
>> return -EINVAL;
>> }
>>
>> + intel_runtime_pm_get(dev_priv);
>> +
>> ret = i915_mutex_lock_interruptible(dev);
>> if (ret)
>> - return ret;
>> + goto rpm_put;
>>
>> obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));
>> if (&obj->base == NULL) {
>> @@ -3872,6 +3875,9 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
>> drm_gem_object_unreference(&obj->base);
>> unlock:
>> mutex_unlock(&dev->struct_mutex);
>> +rpm_put:
>> + intel_runtime_pm_put(dev_priv);
>> +
>> return ret;
>> }
>>
>> --
>> 2.1.4
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Jani Nikula, Intel Open Source Technology Center
More information about the Intel-gfx
mailing list