All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Expose a debugfs to acquire the BKL^Wstruct_mutex
@ 2017-08-15 23:40 Chris Wilson
  2017-08-16  0:50 ` ✓ Fi.CI.BAT: success for " Patchwork
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Wilson @ 2017-08-15 23:40 UTC (permalink / raw)
  To: intel-gfx

To demonstrate how pervasive an issue our BKL is, aka struct_mutex,
provide a debugfs file whose sole purpose is to hold the struct_mutex.
To make matters worse, it does not even partake in the backoff required
for resets, so the likely event of holding the file open will be to
wedge the driver. Hopefully, this should prove instrumental in the
crusade to eradicate the BKL and transition to fine-grained locking and
much smoother multi-client behaviour.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Antonio Argenziano <antonio.argenziano@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 329fb3649dc3..0af11dcca160 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -4709,6 +4709,27 @@ static const struct file_operations i915_forcewake_fops = {
 	.release = i915_forcewake_release,
 };
 
+static int BKL_struct_mutex_open(struct inode *inode, struct file *file)
+{
+	struct drm_i915_private *i915 = inode->i_private;
+
+	return mutex_lock_interruptible(&i915->drm.struct_mutex);
+}
+
+static int BKL_struct_mutex_release(struct inode *inode, struct file *file)
+{
+	struct drm_i915_private *i915 = inode->i_private;
+
+	mutex_unlock(&i915->drm.struct_mutex);
+	return 0;
+}
+
+static const struct file_operations BKL_struct_mutex_fops = {
+	.owner = THIS_MODULE,
+	.open = BKL_struct_mutex_open,
+	.release = BKL_struct_mutex_release,
+};
+
 static int i915_hpd_storm_ctl_show(struct seq_file *m, void *data)
 {
 	struct drm_i915_private *dev_priv = m->private;
@@ -4879,6 +4900,12 @@ int i915_debugfs_register(struct drm_i915_private *dev_priv)
 	if (!ent)
 		return -ENOMEM;
 
+	ent = debugfs_create_file("BKL_struct_mutex", S_IRUSR,
+				  minor->debugfs_root, to_i915(minor->dev),
+				  &BKL_struct_mutex_fops);
+	if (!ent)
+		return -ENOMEM;
+
 	ret = intel_pipe_crc_create(minor);
 	if (ret)
 		return ret;
-- 
2.13.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-16  0:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-15 23:40 [PATCH] drm/i915: Expose a debugfs to acquire the BKL^Wstruct_mutex Chris Wilson
2017-08-16  0:50 ` ✓ Fi.CI.BAT: success for " Patchwork

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.