From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
linux-fbdev@vger.kernel.org
Subject: [PATCH 4/4] fbdev: Debug knob to register without holding console_lock
Date: Tue, 25 Aug 2015 13:45:14 +0000 [thread overview]
Message-ID: <1440510314-8633-4-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1440510314-8633-1-git-send-email-daniel.vetter@ffwll.ch>
When the usual fbcon legacy options are enabled we have
->register_framebuffer
->fb notifier chain calls into fbcon
->fbcon sets up console on new fbi
->fbi->set_par
->drm_fb_helper_set_par exercises full kms api
And because of locking inversion hilarity all of register_framebuffer
is done with the console lock held. Which means that the first time on
driver load we exercise _all_ the kms code (all probe paths and
modeset paths for everything connected) is under the console lock.
That means if anything goes belly-up in that big pile of code nothing
ever reaches logfiles (and the machine is dead).
Usual tactic to debug that is to temporarily remove those console_lock
calls to be able to capture backtraces. I'm fed up writing this patch
and recompiling kernels. Hence this patch here to add an unsafe,
kernel-taining option to do this at runtime.
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/video/fbdev/core/fbmem.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 0705d8883ede..4e73b6f6b1c0 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1608,6 +1608,11 @@ static int do_remove_conflicting_framebuffers(struct apertures_struct *a,
return 0;
}
+static bool lockless_register_fb;
+module_param_named_unsafe(lockless_register_fb, lockless_register_fb, bool, 0400);
+MODULE_PARM_DESC(lockless_register_fb,
+ "Lockless framebuffer registration for debugging [default=off]");
+
static int do_register_framebuffer(struct fb_info *fb_info)
{
int i, ret;
@@ -1675,15 +1680,18 @@ static int do_register_framebuffer(struct fb_info *fb_info)
registered_fb[i] = fb_info;
event.info = fb_info;
- console_lock();
+ if (!lockless_register_fb)
+ console_lock();
if (!lock_fb_info(fb_info)) {
- console_unlock();
+ if (!lockless_register_fb)
+ console_unlock();
return -ENODEV;
}
fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
unlock_fb_info(fb_info);
- console_unlock();
+ if (!lockless_register_fb)
+ console_unlock();
return 0;
}
--
1.8.3.1
next parent reply other threads:[~2015-08-25 13:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1440510314-8633-1-git-send-email-daniel.vetter@ffwll.ch>
2015-08-25 13:45 ` Daniel Vetter [this message]
2015-08-25 19:24 ` [PATCH 4/4] fbdev: Debug knob to register without holding console_lock Rob Clark
2015-09-01 10:32 ` Tomi Valkeinen
2015-09-01 14:34 ` Rob Clark
2015-09-01 14:41 ` Tomi Valkeinen
2015-09-01 15:12 ` Rob Clark
2015-09-01 15:31 ` Daniel Vetter
2015-09-24 10:56 ` Tomi Valkeinen
2015-12-07 17:32 ` Tomi Valkeinen
2015-12-08 8:19 ` Daniel Vetter
2015-12-08 8:26 ` Tomi Valkeinen
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=1440510314-8633-4-git-send-email-daniel.vetter@ffwll.ch \
--to=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=plagnioj@jcrosoft.com \
--cc=tomi.valkeinen@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).