Skip to content

Commit 3954e73

Browse files
ramalingamcdanvet
authored andcommitted
drm/i915: Fixing mutex deadlock window at eDP DRRS
In invalidate and flush functions of eDP DRRS, if deferred downclock work starts execution at a time window between acquiring the drrs mutex and cancellation of the deferred work (intel_edp_drrs_downclock_work), then deferred work will find drrs mutex locked and wait for the same. Meanwhile the function that acquired mutex drrs invalidate/flush will wait for the completion of the deferred work before releasing the mutex. Thats a deadlock. To avoid such deadlock scenario, this change cancels the deferred work before acquiring the mutex at invalidate and flush functions. Signed-off-by: Ramalingam C <ramalingam.c@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent a54746e commit 3954e73

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/gpu/drm/i915/intel_dp.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4966,12 +4966,13 @@ void intel_edp_drrs_invalidate(struct drm_device *dev,
49664966
if (!dev_priv->drrs.dp)
49674967
return;
49684968

4969+
cancel_delayed_work_sync(&dev_priv->drrs.work);
4970+
49694971
mutex_lock(&dev_priv->drrs.mutex);
49704972
crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
49714973
pipe = to_intel_crtc(crtc)->pipe;
49724974

49734975
if (dev_priv->drrs.refresh_rate_type == DRRS_LOW_RR) {
4974-
cancel_delayed_work_sync(&dev_priv->drrs.work);
49754976
intel_dp_set_drrs_state(dev_priv->dev,
49764977
dev_priv->drrs.dp->attached_connector->panel.
49774978
fixed_mode->vrefresh);
@@ -5004,13 +5005,13 @@ void intel_edp_drrs_flush(struct drm_device *dev,
50045005
if (!dev_priv->drrs.dp)
50055006
return;
50065007

5008+
cancel_delayed_work_sync(&dev_priv->drrs.work);
5009+
50075010
mutex_lock(&dev_priv->drrs.mutex);
50085011
crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
50095012
pipe = to_intel_crtc(crtc)->pipe;
50105013
dev_priv->drrs.busy_frontbuffer_bits &= ~frontbuffer_bits;
50115014

5012-
cancel_delayed_work_sync(&dev_priv->drrs.work);
5013-
50145015
if (dev_priv->drrs.refresh_rate_type != DRRS_LOW_RR &&
50155016
!dev_priv->drrs.busy_frontbuffer_bits)
50165017
schedule_delayed_work(&dev_priv->drrs.work,

0 commit comments

Comments
 (0)