@@ -290,7 +290,8 @@ void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv)
* The other option is to introduce a new forcewake lock which must be
* acquired prior to any register read.
*/
- WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex));
+ WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex) &&
+ !dev_priv->forcewake_count);
if (dev_priv->forcewake_count++ == 0)
__gen6_gt_force_wake_get(dev_priv);
@@ -307,7 +308,8 @@ void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv)
/*
* See gen6_gt_force_wake_get()
*/
- WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex));
+ WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex) &&
+ !dev_priv->forcewake_count);
if (--dev_priv->forcewake_count == 0)
__gen6_gt_force_wake_put(dev_priv);
This patch may help mask some of the warnings. Because it's only a requirement to hold struct_mutex to obtain a reference, it is acceptable from a hardware perspective to not hold struct_mutex if there is already a reference. However, it's still extremely dangerous since there is no real synchronization with the reference count (it could change right after our check). This should only be used by developers who want to debug some of the warnings, but want to deal with a possibly smaller set of warnings to start with. It should not go upstream. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> --- drivers/gpu/drm/i915/i915_drv.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)