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@xxxxxxxxxxxxxxxxxx> Cc: Antonio Argenziano <antonio.argenziano@xxxxxxxxx> --- 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@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx