Skip to content

Commit

Permalink
drm/i915/perf: ensure we keep a reference on the driver
Browse files Browse the repository at this point in the history
The i915 perf stream has its own file descriptor and is tied to
reference of the driver. We haven't taken care of keep the driver
alive.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Fixes: eec688e ("drm/i915: Add i915 perf infrastructure")
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190709123351.5645-2-lionel.g.landwerlin@intel.com
  • Loading branch information
Lionel Landwerlin authored and Chris Wilson committed Jul 9, 2019
1 parent 681c774 commit a5af1df
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/gpu/drm/i915/i915_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2517,6 +2517,9 @@ static int i915_perf_release(struct inode *inode, struct file *file)
i915_perf_destroy_locked(stream);
mutex_unlock(&dev_priv->perf.lock);

/* Release the reference the perf stream kept on the driver. */
drm_dev_put(&dev_priv->drm);

return 0;
}

Expand Down Expand Up @@ -2652,6 +2655,11 @@ i915_perf_open_ioctl_locked(struct drm_i915_private *dev_priv,
if (!(param->flags & I915_PERF_FLAG_DISABLED))
i915_perf_enable_locked(stream);

/* Take a reference on the driver that will be kept with stream_fd
* until its release.
*/
drm_dev_get(&dev_priv->drm);

return stream_fd;

err_open:
Expand Down

0 comments on commit a5af1df

Please sign in to comment.