linux/drivers/video/console
Krzysztof Helt aef7db4bd5 fbdev: fix recursive notifier and locking when fbdev console is blanked
Fix infinite recursive notifier in the fbdev layer.  This causes recursive
locking.  Dmitry Baryshkov found the problem and confirmed that the patch
fixes the bug.

After doing
# echo 1 > /sys/class/graphics/fb0/blank
I got the following in my kernel log:

=============================================
[ INFO: possible recursive locking detected ]
2.6.27-rc6-00086-gda63874-dirty #97
---------------------------------------------
echo/1564 is trying to acquire lock:
 ((fb_notifier_list).rwsem){..--}, at: [<c005a384>] __blocking_notifier_call_chain+0x38/0x6c

but task is already holding lock:
 ((fb_notifier_list).rwsem){..--}, at: [<c005a384>] __blocking_notifier_call_chain+0x38/0x6c

other info that might help us debug this:
2 locks held by echo/1564:
 #0:  (&buffer->mutex){--..}, at: [<c00ddde0>] sysfs_write_file+0x30/0x80
 #1:  ((fb_notifier_list).rwsem){..--}, at: [<c005a384>] __blocking_notifier_call_chain+0x38/0x6c

stack backtrace:
[<c0029fe4>] (dump_stack+0x0/0x14) from [<c0060ce0>] (print_deadlock_bug+0xa4/0xd0)
[<c0060c3c>] (print_deadlock_bug+0x0/0xd0) from [<c0060e54>] (check_deadlock+0x148/0x17c)
 r6:c397a1e0 r5:c397a530 r4:c04fcf98
[<c0060d0c>] (check_deadlock+0x0/0x17c) from [<c00637e8>] (validate_chain+0x3c4/0x4f0)
[<c0063424>] (validate_chain+0x0/0x4f0) from [<c0063efc>] (__lock_acquire+0x5e8/0x6b4)
[<c0063914>] (__lock_acquire+0x0/0x6b4) from [<c006402c>] (lock_acquire+0x64/0x78)
[<c0063fc8>] (lock_acquire+0x0/0x78) from [<c0316ca8>] (down_read+0x4c/0x60)
 r7:00000009 r6:ffffffff r5:c0427a40 r4:c005a384
[<c0316c5c>] (down_read+0x0/0x60) from [<c005a384>] (__blocking_notifier_call_chain+0x38/0x6c)
 r5:c0427a40 r4:c0427a74
[<c005a34c>] (__blocking_notifier_call_chain+0x0/0x6c) from [<c005a3d8>] (blocking_notifier_call_chain+0x20/0x28)
 r8:00000009 r7:c086d640 r6:c3967940 r5:00000000 r4:c38984b8
[<c005a3b8>] (blocking_notifier_call_chain+0x0/0x28) from [<c014baa0>] (fb_notifier_call_chain+0x1c/0x24)
[<c014ba84>] (fb_notifier_call_chain+0x0/0x24) from [<c014c18c>] (fb_blank+0x64/0x70)
[<c014c128>] (fb_blank+0x0/0x70) from [<c0155978>] (fbcon_blank+0x114/0x1bc)
 r5:00000001 r4:c38984b8
[<c0155864>] (fbcon_blank+0x0/0x1bc) from [<c0170ea8>] (do_blank_screen+0x1e0/0x2a0)
[<c0170cc8>] (do_blank_screen+0x0/0x2a0) from [<c0154024>] (fbcon_fb_blanked+0x74/0x94)
 r5:c3967940 r4:00000001
[<c0153fb0>] (fbcon_fb_blanked+0x0/0x94) from [<c0154228>] (fbcon_event_notify+0x100/0x12c)
 r5:fffffffe r4:c39bc194
[<c0154128>] (fbcon_event_notify+0x0/0x12c) from [<c005a0d4>] (notifier_call_chain+0x38/0x7c)
[<c005a09c>] (notifier_call_chain+0x0/0x7c) from [<c005a3a0>] (__blocking_notifier_call_chain+0x54/0x6c)
 r8:c3b51ea0 r7:00000009 r6:ffffffff r5:c0427a40 r4:c0427a74
[<c005a34c>] (__blocking_notifier_call_chain+0x0/0x6c) from [<c005a3d8>] (blocking_notifier_call_chain+0x20/0x28)
 r8:00000001 r7:c3a7e000 r6:00000000 r5:00000000 r4:c38984b8
[<c005a3b8>] (blocking_notifier_call_chain+0x0/0x28) from [<c014baa0>] (fb_notifier_call_chain+0x1c/0x24)
[<c014ba84>] (fb_notifier_call_chain+0x0/0x24) from [<c014c18c>] (fb_blank+0x64/0x70)
[<c014c128>] (fb_blank+0x0/0x70) from [<c014e450>] (store_blank+0x54/0x7c)
 r5:c38984b8 r4:c3b51ec4
[<c014e3fc>] (store_blank+0x0/0x7c) from [<c017981c>] (dev_attr_store+0x28/0x2c)
 r8:00000001 r7:c042bf80 r6:c39eba10 r5:c3967c30 r4:c38e0140
[<c01797f4>] (dev_attr_store+0x0/0x2c) from [<c00ddaac>] (flush_write_buffer+0x54/0x68)
[<c00dda58>] (flush_write_buffer+0x0/0x68) from [<c00dde08>] (sysfs_write_file+0x58/0x80)
 r8:c3b51f78 r7:c3bcb070 r6:c39eba10 r5:00000001 r4:00000001
[<c00dddb0>] (sysfs_write_file+0x0/0x80) from [<c009de04>] (vfs_write+0xb8/0x148)
[<c009dd4c>] (vfs_write+0x0/0x148) from [<c009e384>] (sys_write+0x44/0x70)
 r7:00000004 r6:c3bcb070 r5:00000000 r4:00000000
[<c009e340>] (sys_write+0x0/0x70) from [<c0025d00>] (ret_fast_syscall+0x0/0x2c)
 r6:4001b000 r5:00000001 r4:401dc658

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Reported-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Testted-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-03 18:22:17 -07:00
..
.gitignore sparc: Ignore drivers/video/console/promcon_tbl.c conmakehash generated file 2008-07-30 16:49:52 -07:00
Kconfig mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
Makefile [VIDEO]: Fix section mismatch warning in promcon. 2007-06-04 23:52:45 -07:00
bitblit.c fbcon: fix color generation for monochrome framebuffer 2008-02-06 10:41:18 -08:00
dummycon.c Remove magic macros for screen_info structure members 2007-10-16 22:57:17 -07:00
fbcon.c fbdev: fix recursive notifier and locking when fbdev console is blanked 2008-10-03 18:22:17 -07:00
fbcon.h fbcon: fix monochrome color value calculation 2008-10-02 15:53:13 -07:00
fbcon_ccw.c fbcon: fix color generation for monochrome framebuffer 2008-02-06 10:41:18 -08:00
fbcon_cw.c fbcon: fix color generation for monochrome framebuffer 2008-02-06 10:41:18 -08:00
fbcon_rotate.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
fbcon_rotate.h [PATCH] fbcon: Code cleanups 2006-01-10 08:01:51 -08:00
fbcon_ud.c fbcon: fix color generation for monochrome framebuffer 2008-02-06 10:41:18 -08:00
font_6x11.c fbcon: Convert struct font_desc to use ISO C initializers 2007-10-16 09:43:17 -07:00
font_7x14.c fbcon: Convert struct font_desc to use ISO C initializers 2007-10-16 09:43:17 -07:00
font_8x8.c fbcon: Convert struct font_desc to use ISO C initializers 2007-10-16 09:43:17 -07:00
font_8x16.c export font_vga_8x16 2007-10-16 09:43:19 -07:00
font_10x18.c fbcon: Convert struct font_desc to use ISO C initializers 2007-10-16 09:43:17 -07:00
font_acorn_8x8.c fbcon: Convert struct font_desc to use ISO C initializers 2007-10-16 09:43:17 -07:00
font_mini_4x6.c fbcon: Convert struct font_desc to use ISO C initializers 2007-10-16 09:43:17 -07:00
font_pearl_8x8.c fbcon: Convert struct font_desc to use ISO C initializers 2007-10-16 09:43:17 -07:00
font_sun8x16.c fbcon: Convert struct font_desc to use ISO C initializers 2007-10-16 09:43:17 -07:00
font_sun12x22.c fbcon: Convert struct font_desc to use ISO C initializers 2007-10-16 09:43:17 -07:00
fonts.c cleanup after APUS removal 2008-02-06 10:41:01 -08:00
mdacon.c mdacon messing up default vc's - set default to vc13-16 again 2008-07-24 10:47:36 -07:00
newport_con.c netport_con.c: fix build errors and warnings 2007-10-18 14:37:17 -07:00
prom.uni Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
promcon.c vt: add color support to the "underline" and "italic" attributes 2007-05-08 11:15:27 -07:00
softcursor.c fbdev: change asm/uaccess.h to linux/uaccess.h 2007-10-16 09:43:17 -07:00
sticon.c video/console/stico{n,re}.c: make code static 2008-07-26 12:00:12 -07:00
sticore.c sticore: don't activate unsupported GSC STI cards on HPPA 2008-07-30 09:41:43 -07:00
tileblit.c fbcon: fix color generation for monochrome framebuffer 2008-02-06 10:41:18 -08:00
vgacon.c vt: fix background color on line feed 2008-04-29 08:06:06 -07:00