Re: [PATCH] drm/i915: Fix wakeref cookie handling in debugfs/i915_forcewake_user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Tvrtko Ursulin (2019-01-17 14:48:31)
> From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> 
> To avoid a false positive of a leaked wakeref, we can store the cookie
> in file->private_data and use it in intel_runtime_pm_put.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 64d805d9ae59..487b6eeba031 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -4408,7 +4408,7 @@ static int i915_forcewake_open(struct inode *inode, struct file *file)
>         if (INTEL_GEN(i915) < 6)
>                 return 0;
>  
> -       intel_runtime_pm_get(i915);
> +       file->private_data = (void *)(uintptr_t)intel_runtime_pm_get(i915);
>         intel_uncore_forcewake_user_get(i915);
>  
>         return 0;
> @@ -4422,7 +4422,8 @@ static int i915_forcewake_release(struct inode *inode, struct file *file)
>                 return 0;
>  
>         intel_uncore_forcewake_user_put(i915);
> -       intel_runtime_pm_put_unchecked(i915);
> +       intel_runtime_pm_put(i915,
> +                            (intel_wakeref_t)(uintptr_t)file->private_data);

We definitely don't need to cast between integer types after uintptr,
but I can see the desire for symmetry.

Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
-Chris
 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux