linux/drivers/video
Gu Zheng 3a41c5dbe8 fb: reorder the lock sequence to fix potential dead lock
Following commits:

50e244cc79 fb: rework locking to fix lock ordering on takeover
e93a9a8687 fb: Yet another band-aid for fixing lockdep mess
054430e773 fbcon: fix locking harder

reworked locking to fix related lock ordering on takeover, and introduced console_lock
into fbmem, but it seems that the new lock sequence(fb_info->lock ---> console_lock)
is against with the one in console_callback(console_lock ---> fb_info->lock), and leads to
a potential dead lock as following:

[  601.079000] ======================================================
[  601.079000] [ INFO: possible circular locking dependency detected ]
[  601.079000] 3.11.0 #189 Not tainted
[  601.079000] -------------------------------------------------------
[  601.079000] kworker/0:3/619 is trying to acquire lock:
[  601.079000]  (&fb_info->lock){+.+.+.}, at: [<ffffffff81397566>] lock_fb_info+0x26/0x60
[  601.079000]
but task is already holding lock:
[  601.079000]  (console_lock){+.+.+.}, at: [<ffffffff8141aae3>] console_callback+0x13/0x160
[  601.079000]
which lock already depends on the new lock.

[  601.079000]
the existing dependency chain (in reverse order) is:
[  601.079000]
-> #1 (console_lock){+.+.+.}:
[  601.079000]        [<ffffffff810dc971>] lock_acquire+0xa1/0x140
[  601.079000]        [<ffffffff810c6267>] console_lock+0x77/0x80
[  601.079000]        [<ffffffff81399448>] register_framebuffer+0x1d8/0x320
[  601.079000]        [<ffffffff81cfb4c8>] efifb_probe+0x408/0x48f
[  601.079000]        [<ffffffff8144a963>] platform_drv_probe+0x43/0x80
[  601.079000]        [<ffffffff8144853b>] driver_probe_device+0x8b/0x390
[  601.079000]        [<ffffffff814488eb>] __driver_attach+0xab/0xb0
[  601.079000]        [<ffffffff814463bd>] bus_for_each_dev+0x5d/0xa0
[  601.079000]        [<ffffffff81447e6e>] driver_attach+0x1e/0x20
[  601.079000]        [<ffffffff81447a07>] bus_add_driver+0x117/0x290
[  601.079000]        [<ffffffff81448fea>] driver_register+0x7a/0x170
[  601.079000]        [<ffffffff8144a10a>] __platform_driver_register+0x4a/0x50
[  601.079000]        [<ffffffff8144a12d>] platform_driver_probe+0x1d/0xb0
[  601.079000]        [<ffffffff81cfb0a1>] efifb_init+0x273/0x292
[  601.079000]        [<ffffffff81002132>] do_one_initcall+0x102/0x1c0
[  601.079000]        [<ffffffff81cb80a6>] kernel_init_freeable+0x15d/0x1ef
[  601.079000]        [<ffffffff8166d2de>] kernel_init+0xe/0xf0
[  601.079000]        [<ffffffff816914ec>] ret_from_fork+0x7c/0xb0
[  601.079000]
-> #0 (&fb_info->lock){+.+.+.}:
[  601.079000]        [<ffffffff810dc1d8>] __lock_acquire+0x1e18/0x1f10
[  601.079000]        [<ffffffff810dc971>] lock_acquire+0xa1/0x140
[  601.079000]        [<ffffffff816835ca>] mutex_lock_nested+0x7a/0x3b0
[  601.079000]        [<ffffffff81397566>] lock_fb_info+0x26/0x60
[  601.079000]        [<ffffffff813a4aeb>] fbcon_blank+0x29b/0x2e0
[  601.079000]        [<ffffffff81418658>] do_blank_screen+0x1d8/0x280
[  601.079000]        [<ffffffff8141ab34>] console_callback+0x64/0x160
[  601.079000]        [<ffffffff8108d855>] process_one_work+0x1f5/0x540
[  601.079000]        [<ffffffff8108e04c>] worker_thread+0x11c/0x370
[  601.079000]        [<ffffffff81095fbd>] kthread+0xed/0x100
[  601.079000]        [<ffffffff816914ec>] ret_from_fork+0x7c/0xb0
[  601.079000]
other info that might help us debug this:

[  601.079000]  Possible unsafe locking scenario:

[  601.079000]        CPU0                    CPU1
[  601.079000]        ----                    ----
[  601.079000]   lock(console_lock);
[  601.079000]                                lock(&fb_info->lock);
[  601.079000]                                lock(console_lock);
[  601.079000]   lock(&fb_info->lock);
[  601.079000]
 *** DEADLOCK ***

so we reorder the lock sequence the same as it in console_callback() to
avoid this issue. And following Tomi's suggestion, fix these similar
issues all in fb subsystem.

Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2013-11-11 15:52:59 +02:00
..
aty framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
backlight backlight: tosa: Remove redundant spi_set_drvdata 2013-09-26 11:47:27 +03:00
console fbdev: fbcon: select VT_HW_CONSOLE_BINDING 2013-08-02 16:17:51 -07:00
exynos video: exynos_mipi_dsi: Unlock the mutex before returning 2013-10-30 13:52:36 +02:00
geode framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
i810 video: i810fb: remove unnecessary pci_set_drvdata() 2013-09-19 13:30:07 +03:00
intelfb video: intelfb: remove unnecessary pci_set_drvdata() 2013-09-19 13:30:07 +03:00
kyro framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
logo Bye, bye, WfW flag 2013-09-11 19:55:12 -07:00
matrox video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
mb862xx video: mb862xx: Remove redundant dev_set_drvdata 2013-09-26 13:49:09 +03:00
mbx framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
mmp video: mmp: add pitch info in mmp_win structure 2013-09-20 12:52:33 +03:00
msm ARM: msm: Move mach/board.h contents to common.h 2013-08-06 11:18:02 -07:00
nvidia video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
omap video: omapfb: use dev_get_platdata() 2013-09-20 12:22:01 +03:00
omap2 omapdss: Add new panel driver for Topolly td028ttec1 LCD. 2013-10-31 12:30:36 +02:00
riva video: riva: Remove incorrect checks 2013-09-26 11:52:31 +03:00
savage video: savagefb: remove unnecessary pci_set_drvdata() 2013-09-19 13:30:09 +03:00
sis framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
vermilion fbdev/vermillion: use vm_iomap_memory() 2013-04-24 08:41:42 +03:00
via viafb: rename display_timing to via_display_timing 2013-01-24 08:59:44 +01:00
68328fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
acornfb.c drivers/video/acornfb.c: remove dead code 2013-09-11 15:56:22 -07:00
acornfb.h drivers/video/acornfb.c: remove dead code 2013-09-11 15:56:22 -07:00
amba-clcd.c video: amba-clcd: Remove unnecessary amba_set_drvdata() 2013-10-09 12:35:44 +03:00
amifb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
arcfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
arkfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
asiliantfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
atafb_iplan2p2.c
atafb_iplan2p4.c
atafb_iplan2p8.c
atafb_mfb.c
atafb_utils.h
atafb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
atafb.h
atmel_lcdfb.c video: atmel_lcdfb: add device tree suport 2013-09-27 09:26:20 +03:00
au1100fb.c Video / au1100fb: Use module_platform_driver() to simplify code 2013-09-30 10:51:10 +03:00
au1100fb.h
au1200fb.c Video / au1200fb: Use module_platform_driver() to simplify code 2013-09-30 10:51:09 +03:00
au1200fb.h
auo_k190x.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-04-30 09:36:50 -07:00
auo_k190x.h
auo_k1900fb.c AUO-K190x: add runtime-pm calls to controller init functions 2013-04-04 13:08:06 +03:00
auo_k1901fb.c AUO-K190x: add runtime-pm calls to controller init functions 2013-04-04 13:08:06 +03:00
bf54x-lq043fb.c Video / bf54x-lq043fb: Use module_platform_driver() to simplify code 2013-09-30 10:51:09 +03:00
bf537-lq035.c Drivers: video: remove __dev* attributes. 2013-01-03 15:57:01 -08:00
bfin_adv7393fb.c procfs: new helper - PDE_DATA(inode) 2013-04-09 14:13:32 -04:00
bfin_adv7393fb.h
bfin-lq035q1-fb.c fbdev: bfin-lq035q1-fb: Use dev_pm_ops 2013-06-26 16:16:26 +03:00
bfin-t350mcqb-fb.c Video / bfin-t350mcqb-fb: Use module_platform_driver() to simplify code 2013-09-30 10:51:08 +03:00
broadsheetfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
bt431.h
bt455.h
bw2.c video: bw2: Remove redundant dev_set_drvdata 2013-09-26 13:49:22 +03:00
c2p_core.h
c2p_iplan2.c
c2p_planar.c
c2p.h
carminefb_regs.h
carminefb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
carminefb.h
cfbcopyarea.c
cfbfillrect.c
cfbimgblt.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
cg3.c video: cg3: Remove redundant dev_set_drvdata 2013-09-26 13:49:23 +03:00
cg6.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
cg14.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
chipsfb.c Drivers: video: remove __dev* attributes. 2013-01-03 15:57:01 -08:00
cirrusfb.c video: cirrusfb: Remove incorrect checks 2013-09-26 11:52:31 +03:00
clps711xfb.c ARM defconfigs: add missing inclusions of linux/platform_device.h 2013-02-14 15:14:32 -08:00
cobalt_lcdfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
controlfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
controlfb.h
cyber2000fb.c video: cyber2000fb: remove unnecessary pci_set_drvdata() 2013-09-19 13:30:06 +03:00
cyber2000fb.h
da8xx-fb.c video: da8xx-fb: remove unwanted define 2013-10-30 13:36:48 +02:00
display_timing.c video: add display_timing and videomode 2013-01-24 09:03:04 +01:00
dnfb.c Drivers: video: remove __dev* attributes. 2013-01-03 15:57:01 -08:00
edid.h
efifb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
ep93xx-fb.c video: ep93xx-fb: use dev_get_platdata() 2013-09-20 12:22:02 +03:00
fb_ddc.c
fb_defio.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
fb_draw.h
fb_notify.c
fb_sys_fops.c
fb-puv3.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
fbcmap.c drivers: video: fbcmap: remove the redundency and incorrect checkings 2013-08-30 11:41:24 +03:00
fbcvt.c
fbmem.c fb: reorder the lock sequence to fix potential dead lock 2013-11-11 15:52:59 +02:00
fbmon.c Merge branch '3.10/fb-mmap' into for-next 2013-04-26 09:14:47 +03:00
fbsysfs.c fb: reorder the lock sequence to fix potential dead lock 2013-11-11 15:52:59 +02:00
ffb.c video: ffb: Remove redundant dev_set_drvdata 2013-09-26 13:49:24 +03:00
fm2fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
fsl-diu-fb.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
g364fb.c
gbefb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
goldfishfb.c treewide: Fix typos in printk 2013-03-20 16:26:32 +01:00
grvga.c video: grvga: Remove redundant dev_set_drvdata 2013-09-26 13:49:07 +03:00
gxt4500.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
hdmi.c video/hdmi: Rename HDMI_IDENTIFIER to HDMI_IEEE_OUI 2013-08-30 08:42:01 +10:00
hecubafb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
hgafb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
hitfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
hpfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
hyperv_fb.c hyperv-fb: add blanking support 2013-10-09 12:52:50 +03:00
i740_reg.h
i740fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
igafb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
imsttfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
imxfb.c video: imxfb: use dev_get_platdata() 2013-09-20 12:22:03 +03:00
jz4740_fb.c Video / jz4740_fb: Use module_platform_driver() to simplify code 2013-09-30 10:51:09 +03:00
Kconfig video: atmel_lcdfb: add device tree suport 2013-09-27 09:26:20 +03:00
leo.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
macfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
macmodes.c
macmodes.h
Makefile lib: Move fonts from drivers/video/console/ to lib/fonts/ 2013-06-28 10:28:22 +02:00
maxinefb.c
metronomefb.c fbdev: fix error return code in metronomefb_probe() 2013-10-29 12:20:11 +02:00
modedb.c
mx3fb.c video: mx3fb: use dev_get_platdata() 2013-09-20 12:22:01 +03:00
mxsfb.c fbdev changes for 3.12: 2013-09-05 09:49:32 -07:00
n411.c
neofb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
nuc900fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
nuc900fb.h
of_display_timing.c Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2013-07-09 16:04:31 -07:00
of_videomode.c videomode: videomode_from_timing work 2013-03-21 14:34:33 +02:00
offb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
output.c video: output: convert class code to use dev_groups 2013-07-26 10:37:02 +03:00
p9100.c video: p9100: Remove redundant dev_set_drvdata 2013-09-26 13:49:25 +03:00
platinumfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
platinumfb.h
pm2fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
pm3fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
pmag-aa-fb.c
pmag-ba-fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
pmagb-b-fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
ps3fb.c fbdev/ps3fb: Fix section mismatch warning for ps3fb_probe 2013-09-11 11:39:39 +10:00
pvr2fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
pxa3xx-gcu.c Various fbdev changes for 3.11 2013-07-09 15:51:32 -07:00
pxa3xx-gcu.h
pxa168fb.c video: pxa168fb: use dev_get_platdata() 2013-09-20 12:22:01 +03:00
pxa168fb.h
pxafb.c video: pxafb: use dev_get_platdata() 2013-09-20 12:22:02 +03:00
pxafb.h
q40fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
s1d13xxxfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
s3c2410fb.c video: s3c2410: use dev_get_platdata() 2013-09-20 12:22:02 +03:00
s3c2410fb.h
s3c-fb.c video: s3c-fb: use dev_get_platdata() 2013-09-20 12:23:21 +03:00
s3fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
sa1100fb.c video: sa1100fb: use dev_get_platdata() 2013-09-20 12:22:02 +03:00
sa1100fb.h
sbuslib.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
sbuslib.h
sgivwfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
sh7760fb.c video: sh7760fb: fix to pass correct device identity to free_irq() 2013-07-29 11:25:03 +03:00
sh_mipi_dsi.c video: remove unnecessary platform_set_drvdata() 2013-06-26 14:44:40 +03:00
sh_mobile_hdmi.c fbdev: shmobile-hdmi: Convert to clk_prepare/unprepare 2013-11-11 15:32:58 +02:00
sh_mobile_lcdcfb.c fb: reorder the lock sequence to fix potential dead lock 2013-11-11 15:52:59 +02:00
sh_mobile_lcdcfb.h fbdev: sh_mobile_lcdc: Store the backlight brightness internally 2012-11-21 15:50:01 +01:00
sh_mobile_meram.c Drivers: video: remove __dev* attributes. 2013-01-03 15:57:01 -08:00
simplefb.c simplefb: use write-combined remapping 2013-10-30 12:49:02 +02:00
skeletonfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
sm501fb.c Drivers: video: remove __dev* attributes. 2013-01-03 15:57:01 -08:00
smscufx.c video: smscufx: Use NULL instead of 0 2013-09-26 11:50:08 +03:00
ssd1307fb.c video: ssd1307fb: Remove redundant of_match_ptr 2013-10-09 12:35:44 +03:00
sstfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
sticore.h
stifb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
sunxvr500.c Drivers: video: remove __dev* attributes. 2013-01-03 15:57:01 -08:00
sunxvr1000.c video: sunxvr1000: Remove redundant dev_set_drvdata 2013-09-26 13:49:26 +03:00
sunxvr2500.c Drivers: video: remove __dev* attributes. 2013-01-03 15:57:01 -08:00
svgalib.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
syscopyarea.c
sysfillrect.c
sysimgblt.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
tcx.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
tdfxfb.c video: tdfxfb: remove unnecessary pci_set_drvdata() 2013-09-19 13:30:10 +03:00
tgafb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
tmiofb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
tridentfb.c video: tridentfb: remove unnecessary pci_set_drvdata() 2013-09-19 13:30:10 +03:00
udlfb.c video: udlfb: Use NULL instead of 0 2013-09-26 11:50:07 +03:00
uvesafb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
valkyriefb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
valkyriefb.h
vesafb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
vfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
vga16fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
vgastate.c
videomode.c videomode: videomode_from_timing work 2013-03-21 14:34:33 +02:00
vt8500lcdfb.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
vt8500lcdfb.h
vt8623fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
w100fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
w100fb.h
wm8505fb_regs.h
wm8505fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
wmt_ge_rops.c video: wmt_ge_rops: Fix a trivial typo 2013-10-09 12:35:46 +03:00
wmt_ge_rops.h video: vt8500: Make wmt_ge_rops optional 2013-04-04 13:07:33 +03:00
xen-fbfront.c Drivers: video: remove __dev* attributes. 2013-01-03 15:57:01 -08:00
xilinxfb.c video: xilinxfb: Fix for "Use standard variable name convention" 2013-10-29 10:49:40 +02:00