fb_ops.fp_pan_display() and locking
From: Geert Uytterhoeven <hidden>
Date: 2007-10-03 16:48:07
Unlike the other fb_ops, .fp_pan_display() may be called from interrupt context. This can happen when calling printk() from an interrupt handler, while accelerating text console scrolling by using a virtual screen. Hence one cannot use a mutex to provide locking in .fp_pan_display(), or something like this happens (assumed CONFIG_DEBUG_SPINLOCK_SLEEP=y): | BUG: sleeping function called from invalid context at linux/kernel/mutex.c:86 | in_atomic():1, irqs_disabled():1 | Call Trace: | [c000000005f4b430] [c00000000000effc] .show_stack+0x68/0x1b0 (unreliable) | [c000000005f4b4d0] [c000000000046ed8] .__might_sleep+0xec/0x108 | [c000000005f4b550] [c0000000003a3ce4] .mutex_lock+0x28/0x48 | [c000000005f4b5e0] [c0000000001fb1e8] .xxxfb_pan_display+0x34/0x88 | [c000000005f4b680] [c0000000001e6e10] .fb_pan_display+0x120/0x180 | [c000000005f4b710] [c0000000001f43b4] .bit_update_start+0x28/0x60 | [c000000005f4b7a0] [c0000000001f238c] .fbcon_scroll+0x6a0/0xeb8 | [c000000005f4b870] [c000000000213524] .scrup+0xa0/0x14c | [c000000005f4b910] [c000000000213610] .lf+0x40/0x9c | [c000000005f4b990] [c000000000218d00] .vt_console_print+0x214/0x3c8 | [c000000005f4ba40] [c00000000004f150] .__call_console_drivers+0xc8/0xf8 | [c000000005f4bad0] [c00000000004f604] .release_console_sem+0x19c/0x2bc | [c000000005f4bb80] [c00000000004ff78] .vprintk+0x338/0x3f4 | [c000000005f4bc60] [c00000000005006c] .printk+0x38/0x48 | [c000000005f4bcf0] [c000000000053d38] .do_exit+0x3f0/0x96c | [c000000005f4bda0] [c000000000054368] .sys_exit_group+0x0/0x8 | [c000000005f4be30] [c000000000008834] syscall_exit+0x0/0x40 Omapfb and vmlfb use a mutex in .fp_pan_display(). Probably nobody noticed this problem yet because the mere presence of a virtual screen and panning support is not sufficient to enable panning for accelerating text console scrolling. One has to explicitly set FBINFO_HWACCEL_YPAN in fb_info.flags, too, which both omapfb and vmlfb don't do (yet). With kind regards, Geert Uytterhoeven Software Architect Sony Network and Software Technology Center Europe The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium Phone: +32 (0)2 700 8453 Fax: +32 (0)2 700 8622 E-mail: Geert.Uytterhoeven@sonycom.com Internet: http://www.sony-europe.com/ Sony Network and Software Technology Center Europe A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 0413.825.160 · RPR Brussels Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619