linux/drivers/video
Jeremy Kerr 8dab637612 ps3fb: fix deadlock on kexec()
Since the introduction of the acquire_console_sem calls in
0333d83509, kexecing can cause the
kernel to deadlock:

 ps3fb_shutdown()
  -> unregister_framebuffer()
  -> fb_notifier_call_chain(FB_EVENT_FB_UNBIND)
  -> fbcon_fb_unbind()
  -> unbind_con_driver()
  -> bind_con_driver()
	[ acquires console_sem ]
  -> fbcon_deinit()
  -> fbops->fb_release(newinfo, 0)
  -> ps3fb_release()
  -> ps3fb_sync()
	[ acquires console_sem ]

This change avoids the deadlock by moving the acquire_console_sem()
out of ps3fb_sync(), and puts it into the two other callsites, leaving
ps3fb_release() to call ps3fb_sync() without the console semaphore.

[Geert]
  - Corrected call sequence above
  - ps3fb_release() may be called with and without console_sem held. This is an
    inconsistency that should be fixed at the fb level, but for now, try to
    acquire console_sem in ps3fb_release().

    I think it's safer to let ps3fb_release() try to acquire console_sem and
    not refresh the screen if it fails, than to call ps3fb_sync() without
    holding console_sem, as ps3fb_par may be modified at the same time, causing
    crashes or lockups.

    Besides, ps3fb_release() only calls ps3fb_sync() to refresh the screen
    when display flipping is disabled, which is an uncommon case (except during
    shutdown/kexec).

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-01-11 11:47:43 -08:00
..
aty
backlight
console
display
geode
i810
intelfb
kyro
logo
matrox
mbx
nvidia
omap
pnx4008
riva
savage
sis
vermilion
68328fb.c
Kconfig
Makefile
acornfb.c
acornfb.h
amba-clcd.c
amifb.c
arcfb.c
arkfb.c
asiliantfb.c
atafb.c
atafb.h
atafb_iplan2p2.c
atafb_iplan2p4.c
atafb_iplan2p8.c
atafb_mfb.c
atafb_utils.h
atmel_lcdfb.c
au1100fb.c
au1100fb.h
au1200fb.c
au1200fb.h
bf54x-lq043fb.c
bt431.h
bt455.h
bw2.c
c2p.c
c2p.h
cfbcopyarea.c
cfbfillrect.c
cfbimgblt.c
cg3.c
cg6.c
cg14.c
chipsfb.c
cirrusfb.c
clps711xfb.c
controlfb.c
controlfb.h
cyber2000fb.c
cyber2000fb.h
cyblafb.c
dnfb.c
edid.h
efifb.c
epson1355fb.c
fb_ddc.c
fb_defio.c
fb_draw.h
fb_notify.c
fb_sys_fops.c
fbcmap.c
fbcvt.c
fbmem.c
fbmon.c
fbsysfs.c
ffb.c
fm2fb.c
g364fb.c
gbefb.c
gxt4500.c
hecubafb.c
hgafb.c
hitfb.c
hpfb.c
igafb.c
imacfb.c
imsttfb.c
imxfb.c
imxfb.h
leo.c
macfb.c
macmodes.c
macmodes.h
maxinefb.c
modedb.c
neofb.c
offb.c
output.c
p9100.c
platinumfb.c
platinumfb.h
pm2fb.c
pm3fb.c
pmag-aa-fb.c
pmag-ba-fb.c
pmagb-b-fb.c
ps3fb.c
pvr2fb.c
pxafb.c
pxafb.h
q40fb.c
s1d13xxxfb.c
s3c2410fb.c
s3c2410fb.h
s3fb.c
sa1100fb.c
sa1100fb.h
sbuslib.c
sbuslib.h
sgivwfb.c
skeletonfb.c
sm501fb.c
sstfb.c
sticore.h
stifb.c
sunxvr500.c
sunxvr2500.c
svgalib.c
syscopyarea.c
sysfillrect.c
sysimgblt.c
tcx.c
tdfxfb.c
tgafb.c
tridentfb.c
uvesafb.c
valkyriefb.c
valkyriefb.h
vesafb.c
vfb.c
vga16fb.c
vgastate.c
vt8623fb.c
w100fb.c
w100fb.h
xilinxfb.c