Jeremy Kerr 8dab637612 ps3fb: fix deadlock on kexec()
Since the introduction of the acquire_console_sem calls in
0333d83509c7d8496c8965b5ba9bc0c98e83c259, 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
..
2007-10-18 14:37:17 -07:00
2007-10-16 09:43:14 -07:00
2007-10-19 11:53:42 -07:00
2007-11-14 18:45:38 -08:00
2007-10-19 23:22:11 +02:00
2007-07-31 15:39:39 -07:00
2005-04-16 15:20:36 -07:00
2007-05-04 17:59:05 -07:00
2007-05-04 17:59:05 -07:00
2007-05-04 17:59:05 -07:00
2007-05-04 17:59:05 -07:00
2007-05-04 17:59:05 -07:00
2007-05-04 17:59:05 -07:00
2007-11-29 09:24:53 -08:00
2007-10-18 14:37:17 -07:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2007-10-13 21:53:08 -07:00
2007-07-26 11:35:18 -07:00
2007-10-27 22:18:12 -07:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2007-11-29 09:24:52 -08:00
2007-05-08 11:15:26 -07:00
2007-10-13 21:53:08 -07:00
2007-11-14 18:45:42 -08:00
2007-10-16 09:43:20 -07:00
2008-01-11 11:47:43 -08:00
2006-01-17 15:53:11 -08:00
2007-10-16 09:43:14 -07:00
2007-10-16 09:43:22 -07:00
2007-10-16 09:43:19 -07:00
2005-04-16 15:20:36 -07:00
2007-10-16 09:43:18 -07:00
2007-05-08 11:15:32 -07:00
2007-07-17 10:23:13 -07:00
2007-05-23 20:14:13 -07:00
2007-10-14 08:56:33 -07:00