diff mbox

[2/9] drm/i915/frontbuffer: Mark frontbuffer flush and invalidate with might_sleep()

Message ID 20180127024923.3093-2-dhinakaran.pandiyan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dhinakaran Pandiyan Jan. 27, 2018, 2:49 a.m. UTC
Frontbuffer flush and invalidate call psr, fbc and drrs functions that use
mutexes but they can be called in atomic contexts in the fbdev path. The
point where the spinlocks are acquired is up in the call stack that is not
entirely easy to spot, so annotate with might_sleep().

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 drivers/gpu/drm/i915/intel_frontbuffer.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Rodrigo Vivi Feb. 1, 2018, 6:42 a.m. UTC | #1
On Sat, Jan 27, 2018 at 02:49:16AM +0000, Dhinakaran Pandiyan wrote:
> Frontbuffer flush and invalidate call psr, fbc and drrs functions that use
> mutexes but they can be called in atomic contexts in the fbdev path. The
> point where the spinlocks are acquired is up in the call stack that is not
> entirely easy to spot, so annotate with might_sleep().
>

makes sense

> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_frontbuffer.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_frontbuffer.c b/drivers/gpu/drm/i915/intel_frontbuffer.c
> index fcfc217e754e..3a8d3d06c26a 100644
> --- a/drivers/gpu/drm/i915/intel_frontbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_frontbuffer.c
> @@ -79,6 +79,7 @@ void __intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
>  		spin_unlock(&dev_priv->fb_tracking.lock);
>  	}
>  
> +	might_sleep();
>  	intel_psr_invalidate(dev_priv, frontbuffer_bits);
>  	intel_edp_drrs_invalidate(dev_priv, frontbuffer_bits);
>  	intel_fbc_invalidate(dev_priv, frontbuffer_bits, origin);
> @@ -108,6 +109,7 @@ static void intel_frontbuffer_flush(struct drm_i915_private *dev_priv,
>  	if (!frontbuffer_bits)
>  		return;
>  
> +	might_sleep();
>  	intel_edp_drrs_flush(dev_priv, frontbuffer_bits);
>  	intel_psr_flush(dev_priv, frontbuffer_bits, origin);
>  	intel_fbc_flush(dev_priv, frontbuffer_bits, origin);
> -- 
> 2.14.1
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_frontbuffer.c b/drivers/gpu/drm/i915/intel_frontbuffer.c
index fcfc217e754e..3a8d3d06c26a 100644
--- a/drivers/gpu/drm/i915/intel_frontbuffer.c
+++ b/drivers/gpu/drm/i915/intel_frontbuffer.c
@@ -79,6 +79,7 @@  void __intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
 		spin_unlock(&dev_priv->fb_tracking.lock);
 	}
 
+	might_sleep();
 	intel_psr_invalidate(dev_priv, frontbuffer_bits);
 	intel_edp_drrs_invalidate(dev_priv, frontbuffer_bits);
 	intel_fbc_invalidate(dev_priv, frontbuffer_bits, origin);
@@ -108,6 +109,7 @@  static void intel_frontbuffer_flush(struct drm_i915_private *dev_priv,
 	if (!frontbuffer_bits)
 		return;
 
+	might_sleep();
 	intel_edp_drrs_flush(dev_priv, frontbuffer_bits);
 	intel_psr_flush(dev_priv, frontbuffer_bits, origin);
 	intel_fbc_flush(dev_priv, frontbuffer_bits, origin);