手機 - Motorola XT897 - Debian 8 - 關於msm_fb_pan_idle crash問題



參考資訊:
http://simons-hackbits.blogspot.com/2014/11/debian-on-nexus-7-experimenting-with.html

開啟framebuffer console後,msm_fb會有如下問題:

[   32.002166,1] Console: switching to colour frame buffer device 67x60
[   32.068548,0] panel_enable is called
[   32.196398,0]  MIPI panel Manufacture_id = 0x83
[   32.196398,0]  MIPI panel Controller_ver = 0x5
[   32.196459,0]  MIPI panel Controller_drv_ver = 0x5
[   32.196551,0] panel_enable completed. Power_mode =0x98
[   32.197924,0] mdp4_csc_config: Block type 10 isn't supported by CSC.
[   32.198473,0] mdp4_fetch_cfg: dmap=47 vg=47
[   83.965298,0] BUG: scheduling while atomic: modprobe/331/0x00000002
[   83.965328,0] Modules linked in: fbcon(+) bitblit fbcon_rotate fbcon_ccw fbcon_ud fbcon_cw softcursor font evbug atmxt
[   83.965420,0] [<c006027c>] (unwind_backtrace+0x0/0xfc) from [<c0848d0c>] (__schedule+0x780/0x9f0)
[   83.965481,0] [<c0848d0c>] (__schedule+0x780/0x9f0) from [<c0849674>] (schedule_timeout+0x1c0/0x364)
[   83.965542,0] [<c0849674>] (schedule_timeout+0x1c0/0x364) from [<c08483e4>] (wait_for_common+0x108/0x19c)
[   83.965573,0] [<c08483e4>] (wait_for_common+0x108/0x19c) from [<c03a36ac>] (msm_fb_pan_idle+0x54/0xcc)
[   83.965603,0] [<c03a36ac>] (msm_fb_pan_idle+0x54/0xcc) from [<c03a3f18>] (msm_fb_pan_display_ex+0x104/0x1e8)
[   83.965664,0] [<c03a3f18>] (msm_fb_pan_display_ex+0x104/0x1e8) from [<c03a4040>] (msm_fb_pan_display+0x44/0x54)
[   83.965695,0] [<c03a4040>] (msm_fb_pan_display+0x44/0x54) from [<c03a4388>] (msm_fb_imageblit.part.6+0x64/0x74)
[   83.965756,0] [<c03a4388>] (msm_fb_imageblit.part.6+0x64/0x74) from [<bf02fba8>] (bit_putcs+0x244/0x3e8 [bitblit])
[   83.965817,0] [<bf02fba8>] (bit_putcs+0x244/0x3e8 [bitblit]) from [<bf034cf0>] (fbcon_putcs+0xf4/0x124 [fbcon])
[   83.965878,0] [<bf034cf0>] (fbcon_putcs+0xf4/0x124 [fbcon]) from [<bf03812c>] (fbcon_redraw.isra.12+0x194/0x1cc [fbcon])
[   83.965939,0] [<bf03812c>] (fbcon_redraw.isra.12+0x194/0x1cc [fbcon]) from [<bf03835c>] (fbcon_scroll+0x1f8/0xda8 [fbcon])
[   83.966000,0] [<bf03835c>] (fbcon_scroll+0x1f8/0xda8 [fbcon]) from [<c0412100>] (scrup+0xf8/0x104)
[   83.966030,0] [<c0412100>] (scrup+0xf8/0x104) from [<c0412194>] (lf+0x88/0x90)
[   83.966091,0] [<c0412194>] (lf+0x88/0x90) from [<c0412f7c>] (vt_console_print+0x27c/0x390)
[   83.966122,0] [<c0412f7c>] (vt_console_print+0x27c/0x390) from [<c00d9060>] (__call_console_drivers+0xe0/0x108)
[   83.966183,0] [<c00d9060>] (__call_console_drivers+0xe0/0x108) from [<c00d9ad4>] (console_unlock+0xe8/0x214)
[   83.966213,0] [<c00d9ad4>] (console_unlock+0xe8/0x214) from [<c04145b4>] (take_over_console+0x84/0x88)
[   83.966274,0] [<c04145b4>] (take_over_console+0x84/0x88) from [<bf03f194>] (fb_console_init+0x194/0x1dc [fbcon])
[   83.966336,0] [<bf03f194>] (fb_console_init+0x194/0x1dc [fbcon]) from [<c0053684>] (do_one_initcall+0x138/0x190)
[   83.966366,0] [<c0053684>] (do_one_initcall+0x138/0x190) from [<c0116ec0>] (sys_init_module+0xc20/0x1d70)
[   83.966427,0] [<c0116ec0>] (sys_init_module+0xc20/0x1d70) from [<c0059080>] (ret_fast_syscall+0x0/0x30)

drivers/tty/vt/vt.c

2483 static void vt_console_print(struct console *co, const char *b, unsigned count)
2484 {
2485     struct vc_data *vc = vc_cons[fg_console].d;
2486     unsigned char c;
2487     static DEFINE_SPINLOCK(printing_lock);
2488     const ushort *start;
2489     ushort cnt = 0;
2490     ushort myx;
2491     int kmsg_console;
2492     
2493     /* console busy or not yet initialized */
2494     if (!printable)
2495         return;
2496     if (!spin_trylock(&printing_lock))
2497         return;

2496行做spin_trylock的動作,但是,在msm_fb_pan_idle()卻做了sleep的動作,導致crash

Workaround:

DEFINE_SEMAPHORE(msm_fb_pan_sem);
static int msm_fb_pan_idle(struct msm_fb_data_type *mfd)
{
    return 0;
}

P.S. 由於fbcon有太多地方需要修改,司徒最後決定直接修改msm_fb_pan_idle(),VSYNC部份,之後可以添加FBIO_WAITFORVSYNC支援