All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramalingam C <ramalingam.c@intel.com>
To: intel-gfx@lists.freedesktop.org, rodrigo.vivi@intel.com, daniel@ffwll.ch
Cc: paulo.r.zanoni@intel.com
Subject: [PATCH] drm/i915: Fixing mutex deadlock window at eDP DRRS
Date: Tue,  3 Mar 2015 12:11:46 +0530	[thread overview]
Message-ID: <1425364906-31769-1-git-send-email-ramalingam.c@intel.com> (raw)
In-Reply-To: <54F2CCA6.9070606@intel.com>

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>
---
 drivers/gpu/drm/i915/intel_dp.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index d1141d3..0a57763 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4966,12 +4966,13 @@ void intel_edp_drrs_invalidate(struct drm_device *dev,
 	if (!dev_priv->drrs.dp)
 		return;
 
+	cancel_delayed_work_sync(&dev_priv->drrs.work);
+
 	mutex_lock(&dev_priv->drrs.mutex);
 	crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
 	pipe = to_intel_crtc(crtc)->pipe;
 
 	if (dev_priv->drrs.refresh_rate_type == DRRS_LOW_RR) {
-		cancel_delayed_work_sync(&dev_priv->drrs.work);
 		intel_dp_set_drrs_state(dev_priv->dev,
 				dev_priv->drrs.dp->attached_connector->panel.
 				fixed_mode->vrefresh);
@@ -5004,13 +5005,13 @@ void intel_edp_drrs_flush(struct drm_device *dev,
 	if (!dev_priv->drrs.dp)
 		return;
 
+	cancel_delayed_work_sync(&dev_priv->drrs.work);
+
 	mutex_lock(&dev_priv->drrs.mutex);
 	crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
 	pipe = to_intel_crtc(crtc)->pipe;
 	dev_priv->drrs.busy_frontbuffer_bits &= ~frontbuffer_bits;
 
-	cancel_delayed_work_sync(&dev_priv->drrs.work);
-
 	if (dev_priv->drrs.refresh_rate_type != DRRS_LOW_RR &&
 			!dev_priv->drrs.busy_frontbuffer_bits)
 		schedule_delayed_work(&dev_priv->drrs.work,
-- 
1.7.9.5

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

  reply	other threads:[~2015-03-03  6:46 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-13 10:02 [PATCH 0/6] eDP DRRS based on frontbuffer tracking Ramalingam C
2015-02-13 10:02 ` [PATCH 1/6] drm/i915: Add support for DRRS in intel_dp_set_m_n Ramalingam C
2015-02-19 17:22   ` Rodrigo Vivi
2015-02-13 10:03 ` [PATCH 2/6] drm/i915/bdw: Add support for DRRS to switch RR Ramalingam C
2015-02-19 17:25   ` Rodrigo Vivi
2015-02-20  6:15     ` Ramalingam C
2015-02-20 18:34       ` Rodrigo Vivi
2015-02-13 10:03 ` [PATCH 3/6] drm/i915: Support for RR switching on VLV Ramalingam C
2015-02-13 10:03 ` [PATCH 4/6] drm/i915: Enable eDP DRRS for CHV Ramalingam C
2015-02-19 18:09   ` Rodrigo Vivi
2015-02-13 10:03 ` [PATCH 5/6] Documentation/drm: DocBook integration for DRRS Ramalingam C
2015-02-13 10:03 ` [PATCH 6/6] drm/i915: Add debugfs entry " Ramalingam C
2015-02-19 18:45   ` Rodrigo Vivi
2015-02-20 14:37     ` Ramalingam C
2015-02-23 12:05       ` [PATCH] " Ramalingam C
2015-02-23 18:19         ` Rodrigo Vivi
2015-03-03 12:20           ` Ramalingam C
2015-02-24  0:39         ` Daniel Vetter
2015-02-27 13:59           ` Ramalingam C
2015-03-03 15:23             ` Ramalingam C
2015-03-04 23:00               ` Rodrigo Vivi
2015-03-05 11:18                 ` Daniel Vetter
2015-03-05 11:22                   ` Ramalingam C
2015-03-05 13:04                     ` Daniel Vetter
2015-02-23 12:08 ` [PATCH] drm/i915: Enhancing eDP DRRS debug message Ramalingam C
2015-02-23 18:20   ` Rodrigo Vivi
2015-02-24  0:51 ` [PATCH 0/6] eDP DRRS based on frontbuffer tracking Daniel Vetter
2015-02-27 14:29   ` Ramalingam C
2015-02-27 15:37     ` Daniel Vetter
2015-03-01  8:24       ` Ramalingam C
2015-03-03  6:41         ` Ramalingam C [this message]
2015-03-04 22:55           ` [PATCH] drm/i915: Fixing mutex deadlock window at eDP DRRS Rodrigo Vivi
2015-03-05 11:49             ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425364906-31769-1-git-send-email-ramalingam.c@intel.com \
    --to=ramalingam.c@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.