* Deadlock in fb and tty
@ 2013-09-11 9:25 John Tapsell
2013-09-11 15:33 ` Peter Hurley
0 siblings, 1 reply; 4+ messages in thread
From: John Tapsell @ 2013-09-11 9:25 UTC (permalink / raw)
To: linux-kernel
Hi,
I'm consistently and constantly hitting a deadlock.
console_callback in drivers/tty/vt/vt.c does: console_lock() and then calls:
do_blank_screen, which calls:
vc->vc_sw->con_blank(..) which can be a pointer to the function:
fbcon_blank in video/console/fbcon.c. This is missing a
WARN_CONSOLE_UNLOCKED. This calls:
fbcon_generic_blank which does lock_fb_info(info)
So we have a console_lock() followed by a lock_fb_info(info).
Now if while that is running, we have an ioctl call:
do_fb_ioctl in drivers/video/fbmem.c which does:
if (!lock_fb_info(info))
return -ENODEV;
console_lock();
So it tries to acquire the same locks in the reverse order. This
deadlocks consistently for me.
(I'm also curious why I'm hitting this continually, when everyone else
seems to be okay.)
I understand that this is really difficult to fix, but if anyone has
even a suggestion on how to hack it to make it work for me, I'd be
very grateful.
Thank you,
John Tapsell
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Deadlock in fb and tty 2013-09-11 9:25 Deadlock in fb and tty John Tapsell @ 2013-09-11 15:33 ` Peter Hurley 2013-09-12 13:22 ` johnflux 0 siblings, 1 reply; 4+ messages in thread From: Peter Hurley @ 2013-09-11 15:33 UTC (permalink / raw) To: John Tapsell; +Cc: linux-kernel On 09/11/2013 05:25 AM, John Tapsell wrote: > Hi, > I'm consistently and constantly hitting a deadlock. > > console_callback in drivers/tty/vt/vt.c does: console_lock() and then calls: > do_blank_screen, which calls: > vc->vc_sw->con_blank(..) which can be a pointer to the function: > fbcon_blank in video/console/fbcon.c. This is missing a > WARN_CONSOLE_UNLOCKED. This calls: > fbcon_generic_blank which does lock_fb_info(info) > > So we have a console_lock() followed by a lock_fb_info(info). > > Now if while that is running, we have an ioctl call: > > do_fb_ioctl in drivers/video/fbmem.c which does: > if (!lock_fb_info(info)) > return -ENODEV; > console_lock(); > > > So it tries to acquire the same locks in the reverse order. This > deadlocks consistently for me. > > (I'm also curious why I'm hitting this continually, when everyone else > seems to be okay.) > > I understand that this is really difficult to fix, but if anyone has > even a suggestion on how to hack it to make it work for me, I'd be > very grateful. As a temporary workaround, you can disable timed console blanking on the kernel command line with 'consoleblank=0'. Regards, Peter Hurley ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Deadlock in fb and tty 2013-09-11 15:33 ` Peter Hurley @ 2013-09-12 13:22 ` johnflux 2013-09-17 19:09 ` Peter Hurley 0 siblings, 1 reply; 4+ messages in thread From: johnflux @ 2013-09-12 13:22 UTC (permalink / raw) To: linux-kernel The following seems to be better: >From d93c1e9761ff66365d658da7d8d0d33823aa946f Mon Sep 17 00:00:00 2001 From: John Tapsell <johnflux@gmail.com> Date: Thu, 12 Sep 2013 09:16:12 +0100 Subject: [PATCH] Fix deadlock between fb_info and console. Do not lock fb_info when calling sending the FB_EVENT_CONBLANK In fbmem.c, the semantics are that we acquire the lock_fb_info first, and then console_lock. However when fbcon.c fbcon_generic_blank() is called, the console lock could already be held. Locking fb_info can thus cause a deadlock. fbmem.c sends the FB_EVENT_BLANK without locking lock_fb_info first, so this change introduces similar behaviour. --- drivers/video/console/fbcon.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 6b4fb5c..8546441 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -2333,13 +2333,9 @@ static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, vc->vc_video_erase_char = oldc; } - - if (!lock_fb_info(info)) - return; event.info = info; event.data = ␣ fb_notifier_call_chain(FB_EVENT_CONBLANK, &event); - unlock_fb_info(info); } static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) -- 1.8.1.2 How can I get this reviewed/acked please? -- View this message in context: http://linux-kernel.2935.n7.nabble.com/Deadlock-in-fb-and-tty-tp717929p718779.html Sent from the Linux Kernel mailing list archive at Nabble.com. ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Deadlock in fb and tty 2013-09-12 13:22 ` johnflux @ 2013-09-17 19:09 ` Peter Hurley 0 siblings, 0 replies; 4+ messages in thread From: Peter Hurley @ 2013-09-17 19:09 UTC (permalink / raw) To: johnflux; +Cc: linux-kernel On 09/12/2013 09:22 AM, johnflux wrote: > The following seems to be better: > > From d93c1e9761ff66365d658da7d8d0d33823aa946f Mon Sep 17 00:00:00 2001 > From: John Tapsell<johnflux@gmail.com> > Date: Thu, 12 Sep 2013 09:16:12 +0100 > Subject: [PATCH] Fix deadlock between fb_info and console. Do not lock > fb_info when calling sending the FB_EVENT_CONBLANK > > In fbmem.c, the semantics are that we acquire the lock_fb_info first, > and then console_lock. However when fbcon.c fbcon_generic_blank() is > called, the console lock could already be held. Locking fb_info can > thus cause a deadlock. > > fbmem.c sends the FB_EVENT_BLANK without locking lock_fb_info first, so > this change introduces similar behaviour. > --- > drivers/video/console/fbcon.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c > index 6b4fb5c..8546441 100644 > --- a/drivers/video/console/fbcon.c > +++ b/drivers/video/console/fbcon.c > @@ -2333,13 +2333,9 @@ static void fbcon_generic_blank(struct vc_data *vc, > struct fb_info *info, > vc->vc_video_erase_char = oldc; > } > > - > - if (!lock_fb_info(info)) > - return; > event.info = info; > event.data = ␣ > fb_notifier_call_chain(FB_EVENT_CONBLANK, &event); > - unlock_fb_info(info); > } > > static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) > -- 1.8.1.2 > How can I get this reviewed/acked please? The get_maintainer.pl script can help to discover to whom to address patches. For example, peter@thor:~/src/kernels/next$ ./scripts/get_maintainer.pl -f drivers/video/console/fbcon.c Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> (maintainer:FRAMEBUFFER LAYER) Tomi Valkeinen <tomi.valkeinen@ti.com> (maintainer:FRAMEBUFFER LAYER) Dave Airlie <airlied@redhat.com> (commit_signer:5/11=45%) Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:4/11=36%) Wang YanQing <udknight@gmail.com> (commit_signer:4/11=36%) Andrew Morton <akpm@linux-foundation.org> (commit_signer:3/11=27%) Kamal Mostafa <kamal@whence.com> (commit_signer:1/11=9%) linux-fbdev@vger.kernel.org (open list:FRAMEBUFFER LAYER) linux-kernel@vger.kernel.org (open list) In this case, you'll want to send this patch addressed to the two maintainers and cc linux-fbdev and linux-kernel. You can cc me if you want. This is covered in Documentation/SubmittingPatches, which also covers the required subject line format <hint: too long, needs subsystem identifier>. Also, if you have the lockdep report of the deadlock, it's customary to include it in the commit message. Regards, Peter Hurley PS - Don't put stuff after the '--' tag at the end of the patch. Many mailers treat that as don't care. I missed your question first time around because Thunderbird grays that text :( ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-09-17 19:09 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-09-11 9:25 Deadlock in fb and tty John Tapsell 2013-09-11 15:33 ` Peter Hurley 2013-09-12 13:22 ` johnflux 2013-09-17 19:09 ` Peter Hurley
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox