From: Thierry Reding <thierry.reding@gmail.com>
To: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Subject: [PATCH 1/8] drm: Try to acquire modeset lock on panic or sysrq
Date: Tue, 29 Apr 2014 11:44:32 +0200 [thread overview]
Message-ID: <1398764679-7933-2-git-send-email-thierry.reding@gmail.com> (raw)
In-Reply-To: <1398764679-7933-1-git-send-email-thierry.reding@gmail.com>
From: Thierry Reding <treding@nvidia.com>
Commit 62ff94a54921 "drm/crtc-helper: remove LOCKING from kerneldoc"
causes drm_helper_crtc_in_use() and drm_helper_encoder_in_use() to
complain loudly during a kernel panic or sysrq processing. This is
caused by nobody acquiring the modeset lock in these code paths.
This patch fixes this by trying to acquire the modeset lock for each
FB helper that's forced to kernel mode. If the lock can't be acquired,
it's likely that somebody else is performing a modeset. However, doing
another modeset concurrently might make things even worse, so the safe
option is to simply bail out in that case.
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/gpu/drm/drm_fb_helper.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 04d3fd3658f3..158d8e51db3d 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -326,12 +326,21 @@ static bool drm_fb_helper_force_kernel_mode(void)
return false;
list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) {
- if (helper->dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+ struct drm_device *dev = helper->dev;
+
+ if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+ continue;
+
+ if (!mutex_trylock(&dev->mode_config.mutex)) {
+ error = true;
continue;
+ }
ret = drm_fb_helper_restore_fbdev_mode(helper);
if (ret)
error = true;
+
+ mutex_unlock(&dev->mode_config.mutex);
}
return error;
}
--
1.9.2
next prev parent reply other threads:[~2014-04-29 9:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-29 9:44 [PATCH 0/8] drm: Various minor fixes and cleanups Thierry Reding
2014-04-29 9:44 ` Thierry Reding [this message]
2014-04-29 9:44 ` [PATCH 2/8] drm/edid: Drop revision argument for drm_mode_std() Thierry Reding
2014-04-29 9:44 ` [PATCH 3/8] drm/edid: Cleanup kerneldoc Thierry Reding
2014-04-29 10:32 ` Daniel Vetter
2014-04-29 9:44 ` [PATCH 4/8] drm/fb: Fix typos Thierry Reding
2014-04-29 9:44 ` [PATCH 5/8] drm: Fixup flip-work kerneldoc Thierry Reding
2014-04-29 9:44 ` [PATCH 6/8] drm/dp: Fix typo in comment Thierry Reding
2014-04-29 9:44 ` [PATCH 7/8] drm: Fix indentation of closing brace Thierry Reding
2014-04-29 9:44 ` [PATCH 8/8] drm: Make drm_crtc_helper_disable() return void Thierry Reding
2014-04-29 10:35 ` [PATCH 0/8] drm: Various minor fixes and cleanups Daniel Vetter
2014-04-29 14:28 ` Thierry Reding
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=1398764679-7933-2-git-send-email-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
/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.