[Intel-gfx] [PATCH] drm/i915: Expose a wakeref debugfs to disable (i915) runtime pm

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 23 12:23:45 UTC 2017


Some igt do nothing more active than peek at buffers through a gtt mmap.
The pagefault into the GTT wakes the device up, but it will promptly
autosuspend and zap the GTT mmap, forcing the cycle to repeat
continuously. This makes those tests much, much slower than expected as
every GTT access becomes a page-fault (and that is magnified by the
slow devices also being unable to use WC updates of the GTT).

Whilst real userspace may fall into the same trap, we hold wakerefs
while rendering and while the display is active so all in likelihood the
device will be kept awake by activity during the access; and we strongly
discourage userspace from using GTT for performance reasons anyway. So
hopefully there is no pressing issue that requires a proper fix, and not
just an opt-out for igt!

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 48572b157222..ba6dfb145e90 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -4671,6 +4671,24 @@ static int i915_sseu_status(struct seq_file *m, void *unused)
 	return 0;
 }
 
+static int i915_wakeref_open(struct inode *inode, struct file *file)
+{
+	intel_runtime_pm_get(inode->i_private);
+	return 0;
+}
+
+static int i915_wakeref_release(struct inode *inode, struct file *file)
+{
+	intel_runtime_pm_put(inode->i_private);
+	return 0;
+}
+
+static const struct file_operations i915_wakeref_fops = {
+	.owner = THIS_MODULE,
+	.open = i915_wakeref_open,
+	.release = i915_wakeref_release,
+};
+
 static int i915_forcewake_open(struct inode *inode, struct file *file)
 {
 	struct drm_i915_private *dev_priv = inode->i_private;
@@ -4867,6 +4885,12 @@ int i915_debugfs_register(struct drm_i915_private *dev_priv)
 	struct dentry *ent;
 	int ret, i;
 
+	ent = debugfs_create_file("i915_wakeref_user", S_IRUSR,
+				  minor->debugfs_root, to_i915(minor->dev),
+				  &i915_wakeref_fops);
+	if (!ent)
+		return -ENOMEM;
+
 	ent = debugfs_create_file("i915_forcewake_user", S_IRUSR,
 				  minor->debugfs_root, to_i915(minor->dev),
 				  &i915_forcewake_fops);
-- 
2.14.1



More information about the Intel-gfx mailing list