[Epic 4G Android Development] gzub:
I have been looking to try and turn off as much debugging as possible in the Kernel to increase performance. One area that I have looked at is CONFIG_DEBUG_MUTEXES which has been shown to increase performance on some benchmarks (non-android) by 40%. Every time I have done a build with this turned off the build fails to boot. Looking at the dmesg log, I noticed this section:

03/25/2011 13:42:26	[ERROR]	BUG: sleeping function called from invalid context at kernel/mutex.c:94
03/25/2011 13:42:26	[ERROR]	in_atomic(): 1, irqs_disabled(): 0, pid: 2369, name: zygote
03/25/2011 13:42:26	[WARNING]	[] (unwind_backtrace+0x0/0x100) from [] (dump_stack+0x20/0x24)
03/25/2011 13:42:26	[WARNING]	[] (dump_stack+0x20/0x24) from [] (__might_sleep+0x128/0x130)
03/25/2011 13:42:26	[WARNING]	[] (__might_sleep+0x128/0x130) from [] (mutex_lock+0x2c/0x50)
03/25/2011 13:42:26	[WARNING]	[] (mutex_lock+0x2c/0x50) from [] (echo_char_raw+0x2c/0x230)
03/25/2011 13:42:26	[WARNING]	[] (echo_char_raw+0x2c/0x230) from [] (n_tty_receive_buf+0xfcc/0x2a90)
03/25/2011 13:42:26	[WARNING]	[] (n_tty_receive_buf+0xfcc/0x2a90) from [] (flush_to_ldisc+0x184/0x2a0)
03/25/2011 13:42:26	[WARNING]	[] (flush_to_ldisc+0x184/0x2a0) from [] (tty_flip_buffer_push+0x78/0x80)
03/25/2011 13:42:26	[WARNING]	[] (tty_flip_buffer_push+0x78/0x80) from [] (fmt_rcv_tasklet_handler+0x4f8/0xf50 [dpram])
03/25/2011 13:42:26	[WARNING]	[] (fmt_rcv_tasklet_handler+0x4f8/0xf50 [dpram]) from [] (tasklet_action+0x7c/0xe0)
03/25/2011 13:42:26	[WARNING]	[] (tasklet_action+0x7c/0xe0) from [] (__do_softirq+0xc4/0x2a0)
03/25/2011 13:42:26	[WARNING]	[] (__do_softirq+0xc4/0x2a0) from [] (irq_exit+0x94/0xb0)
03/25/2011 13:42:26	[WARNING]	[] (irq_exit+0x94/0xb0) from [] (asm_do_IRQ+0x58/0xa0)
03/25/2011 13:42:26	[WARNING]	[] (asm_do_IRQ+0x58/0xa0) from [] (__irq_svc+0x34/0xa0
03/25/2011 13:42:26	[WARNING]	Exception stack(0xdfa81a00 to 0xdfa81a48)
03/25/2011 13:42:26	[WARNING]	1a00: dfa81a30 00000000 ffffffff d01c7a62 00000000 000000a0 00010000 c0387000
03/25/2011 13:42:26	[WARNING]	1a20: c009da00 00000000 bf0a5cc8 dfa81a54 00000001 dfa81a48 c0b62148 c0b6214c
03/25/2011 13:42:26	[WARNING]	1a40: 60000113 ffffffff
03/25/2011 13:42:26	[WARNING]	[] (__irq_svc+0x34/0xa0) from [] (_spin_unlock_irq+0x1c/0x20)
03/25/2011 13:42:26	[WARNING]	[] (_spin_unlock_irq+0x1c/0x20) from [] (stl_request+0x1d4/0x3d4 [fsr_stl])
03/25/2011 13:42:26	[WARNING]	[] (stl_request+0x1d4/0x3d4 [fsr_stl]) from [] (__blk_run_queue+0x84/0xe0)
03/25/2011 13:42:26	[WARNING]	[] (__blk_run_queue+0x84/0xe0) from [] (cfq_insert_request+0x414/0x5e0)
03/25/2011 13:42:26	[WARNING]	[] (cfq_insert_request+0x414/0x5e0) from [] (elv_insert+0xfc/0x380)
03/25/2011 13:42:26	[WARNING]	[] (elv_insert+0xfc/0x380) from [] (__elv_add_request+0xd4/0xe0)
03/25/2011 13:42:26	[WARNING]	[] (__elv_add_request+0xd4/0xe0) from [] (__make_request+0xe8/0x560
03/25/2011 13:42:26	[WARNING]	[] (__make_request+0xe8/0x560) from [] (generic_make_request+0x384/0x560)
03/25/2011 13:42:26	[WARNING]	[] (generic_make_request+0x384/0x560) from [] (submit_bio+0x80/0x100)
03/25/2011 13:42:26	[WARNING]	[] (submit_bio+0x80/0x100) from [] (mpage_readpages+0x22c/0x2e0)
03/25/2011 13:42:26	[WARNING]	[] (mpage_readpages+0x22c/0x2e0) from [] (ext4_readpages+0x2c/0x30)
03/25/2011 13:42:26	[WARNING]	[] (ext4_readpages+0x2c/0x30) from [] (__do_page_cache_readahead+0x294/0x890)
03/25/2011 13:42:26	[WARNING]	[] (__do_page_cache_readahead+0x294/0x890) from [] (ra_submit+0x30/0x40)
03/25/2011 13:42:26	[WARNING]	[] (ra_submit+0x30/0x40) from [] (filemap_fault+0x478/0x4a0)
03/25/2011 13:42:26	[WARNING]	[] (filemap_fault+0x478/0x4a0) from [] (__do_fault+0x60/0x4a0)
03/25/2011 13:42:26	[WARNING]	[] (__do_fault+0x60/0x4a0) from [] (handle_mm_fault+0x108/0x740)
03/25/2011 13:42:26	[WARNING]	[] (handle_mm_fault+0x108/0x740) from [] (do_page_fault+0x19c/0x260)
03/25/2011 13:42:26	[WARNING]	[] (do_page_fault+0x19c/0x260) from [] (do_DataAbort+0x44/0xb0)
03/25/2011 13:42:26	[WARNING]	[] (do_DataAbort+0x44/0xb0) from [] (ret_from_exception+0x0/0x10)
03/25/2011 13:42:26	[WARNING]	Exception stack(0xdfa81fb0 to 0xdfa81ff8)
03/25/2011 13:42:26	[WARNING]	1fa0: 437f2028 438ba9ec 000c89c4 805a23f4
03/25/2011 13:42:26	[WARNING]	1fc0: 430cd140 00016dd0 40009360 beb0d554 00000000 00000000 00000000 00000000
03/25/2011 13:42:26	[WARNING]	1fe0: 430cd154 beb0d4f8 80566355 8056760c 00000030 ffffffff

The BUG line points to a section of mutex.c, but if you look at how it got there, there is reference to stl_request, which is part of fsr_stl.ko (also the section immediately prior to this is about OneDRAM. With CONFIG_DEBUG_MUTEXES turned on, the behavior is well defined and it will throw an error as shown, however if it is turned off it will result in a kernel panic.

The reason this error is shown is that something is blocking in an interrupt disabled area.

I have tried finding other versions (only found one newer) of the fsr_stl.ko from other samsung phones which do work on the epic, however they do not solve the issue.

Anyone with more expertise want to help me shed some more light on this, or confirm my suspicion?

Geoff