Linux驱动常见BUG: scheduling while atomic: swapper/0/0x00000100

BUG: scheduling while atomic: swapper/0/0x00000100                             
Modules linked in: iqs316                                                       
                                                                                
Pid: 0, comm:              swapper                                              
CPU: 0    Not tainted  (2.6.37 #111)                                            
PC is at default_idle+0x48/0x50                                                 
LR is at default_idle+0x3c/0x50                                                 
pc : [<c00317c0>]    lr : [<c00317b4>]    psr: 60000013                         
sp : c0383fc8  ip : 00000000  fp : 00000000                                     
r10: 3001f784  r9 : 41129200  r8 : 3001f7b8                                     
r7 : c0385ba8  r6 : c0020f0c  r5 : c03a37cc  r4 : c0382000                      
r3 : 60000013  r2 : f6100000  r1 : 00000032  r0 : c0389b78                      
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel             
Control: c000717f  Table: 339f0000  DAC: 00000017                               
bad: scheduling from the idle thread!                                           
[<c0035d38>] (unwind_backtrace+0x0/0xec) from [<c003fd8c>] (dequeue_task_idle+0x
20/0x34)                                                                        
[<c003fd8c>] (dequeue_task_idle+0x20/0x34) from [<c003f214>] (dequeue_task+0x30/
0x3c)                                                                           
[<c003f214>] (dequeue_task+0x30/0x3c) from [<c003f254>] (deactivate_task+0x34/0x
44)                                                                             
[<c003f254>] (deactivate_task+0x34/0x44) from [<c028c150>] (schedule+0x13c/0x324
)                                                                               
[<c028c150>] (schedule+0x13c/0x324) from [<c028c5dc>] (schedule_timeout+0x148/0x
184)                                                                            
[<c028c5dc>] (schedule_timeout+0x148/0x184) from [<c004eb30>] (msleep+0x14/0x24)
[<c004eb30>] (msleep+0x14/0x24) from [<bf000378>] (CommsIQS316_send+0x58/0x1fc [
iqs316])                                                                        
[<bf000378>] (CommsIQS316_send+0x58/0x1fc [iqs316]) from [<bf0005c4>] (CommsIQS3
16_Read+0x18/0x28 [iqs316])                                                     
[<bf0005c4>] (CommsIQS316_Read+0x18/0x28 [iqs316]) from [<bf000614>] (IQS316_New
_Conversion+0x40/0x170 [iqs316])                                                
[<bf000614>] (IQS316_New_Conversion+0x40/0x170 [iqs316]) from [<bf0000a4>] (iqs3
16_timer_func+0x20/0x58 [iqs316])                                               
[<bf0000a4>] (iqs316_timer_func+0x20/0x58 [iqs316]) from [<c004e8d4>] (run_timer
_softirq+0x158/0x208)                                                           
[<c004e8d4>] (run_timer_softirq+0x158/0x208) from [<c00497a4>] (__do_softirq+0x7
c/0x10c)                                                                        
[<c00497a4>] (__do_softirq+0x7c/0x10c) from [<c0025074>] (asm_do_IRQ+0x74/0x94) 
[<c0025074>] (asm_do_IRQ+0x74/0x94) from [<c00302e4>] (__irq_svc+0x24/0xa0)     
Exception stack(0xc0383f80 to 0xc0383fc8)                                       
3f80: c0389b78 00000032 f6100000 60000013 c0382000 c03a37cc c0020f0c c0385ba8   
3fa0: 3001f7b8 41129200 3001f784 00000000 00000000 c0383fc8 c00317b4 c00317c0   
3fc0: 60000013 ffffffff                                                         
[<c00302e4>] (__irq_svc+0x24/0xa0) from [<c00317c0>] (default_idle+0x48/0x50)   
[<c00317c0>] (default_idle+0x48/0x50) from [<c0031d8c>] (cpu_idle+0x58/0x98)    
[<c0031d8c>] (cpu_idle+0x58/0x98) from [<c0008a5c>] (start_kernel+0x254/0x2a8)  
[<c0008a5c>] (start_kernel+0x254/0x2a8) from [<30008034>] (0x30008034)          
BUG: scheduling while atomic: swapper/0/0x00000100                              
Modules linked in: iqs316

 

从出错信息的[<c004eb30>] (msleep+0x14/0x24) from [<bf000378>] (CommsIQS316_send+0x58/0x1fc [iqs316]) 来看,

可以发现是因为中断处理函数中的CommsIQS316_send函数调用了msleep()函数所致。

 

linux内核打印"BUG: scheduling while atomic"和"bad: scheduling from the idle thread"错误的时候,通常是在中断处理函数(包括定时器中断处理函数)中调用了导致休眠的函数,如sleep,kmalloc,ioremap,semaphore,mutex之类的函数,而 linux内核要求在中断处理的时候,不允许抢占,不允许休眠,要等到中断处理完成才能做其他事情


你可能感兴趣的:(linux内核,linux驱动)