当前位置: 技术问答>linux和unix
请教 linux程序运行出错 附Oops信息
来源: 互联网 发布时间:2016-05-11
本文导语: 各位高手: 小弟所在项目编写了一个网络数据的过滤程序,在运行时出现如下Oops Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = c0004000 [00000000] *pgd=00000000 Internal error: Oops: 7 [#2] Mo...
各位高手:
小弟所在项目编写了一个网络数据的过滤程序,在运行时出现如下Oops
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 7 [#2]
Modules linked in: cirrus
CPU: 0
PC is at dequeue_task+0xc/0x78
LR is at deactivate_task+0x38/0x44
pc : [] lr : [] Not tainted
sp : c0205cc4 ip : c0205cd4 fp : c0205cd0
r10: 0000038d r9 : 72b90480 r8 : c020719c
r7 : c0206998 r6 : 0000000a r5 : c0204000 r4 : c0206998
r3 : 00000001 r2 : 00000000 r1 : 00000000 r0 : c0206998
Flags: nZCv IRQs off FIQs on Mode SVC_32 Segment kernel
Control: C000717F Table: 33B84000 DAC: 0000001D
Process swapper (pid: 0, stack limit = 0xc0204190)
Stack: (0xc0205cc4 to 0xc0206000)
5cc0: c0205ce4 c0205cd4 c003a02c c0039c48 0000038d c0205d20 c0205ce8
5ce0: c01d52c4 c003a004 c0205d84 c02069cc 01312d00 c0206b40 0005f5d6 c0204000
5d00: 0000000a c0205d24 c020719c 00000048 00000000 c0205d60 c0205d24 c01d5b24
5d20: c01d5190 c024a048 c031d1f4 0005f5d6 4b87ad6e c0045c94 c0206998 c0249990
5d40: 00000924 c02444a8 00000001 0000000a 00000002 c0205d78 c0205d64 c01d5a64
5d60: c01d5a9c c02164cc c0205d90 c0205dc0 c0205d7c c0139190 c01d5a40 00000000
5d80: c0206998 c003bb5c c0205d9c c0205d9c 00000000 c0206998 c003bb5c c02164cc
5da0: c02164cc c02098e8 00000000 000000d0 c0205e20 c0205e10 c0205dc4 c0062154
5dc0: c0139118 0000056f 00000010 00000048 00000018 00000557 00000008 00000002
5de0: 000000d0 00000001 00000000 c020957c c02098e8 00000001 000000d0 c0206998
5e00: 00000000 c0205e4c c0205e14 c0059e08 c0062000 00000000 c0204000 00000010
5e20: 00000000 c02658a0 c02658a0 c02658ac 00000000 000000d0 00000001 00000010
5e40: c0205e5c c0205e50 c0059f48 c0059be0 c0205e70 c0205e60 c005d6c8 c0059f30
5e60: 000000d0 c0205e9c c0205e74 c005e410 c005d6b0 c3fff3c0 c3ff10a0 c02658ac
5e80: c02658a0 000000d0 ffffffff 30019adc c0205ec0 c0205ea0 c005e69c c005e390
5ea0: 40000013 bf003b88 000005ee bf003c14 bf003b6c c0205ed4 c0205ec4 c005eb28
5ec0: c005e4dc 00000504 c0205ef4 c0205ed8 bf000e70 c005eac8 00000504 bf003b88
5ee0: bf003c14 00000001 c0205f18 c0205ef8 bf001160 bf000dc4 c24b3240 00000000
5f00: 00000000 00000035 c0205f78 c0205f3c c0205f1c c002af60 bf001090 c0243888
5f20: 00000035 c24b3240 c0205f78 60000013 c0205f5c c0205f40 c002b0b0 c002af1c
5f40: c0204000 c0205f78 00000000 c002bc60 c0205f74 c0205f60 c002b320 c002b010
5f60: c0205fac c0205fc0 c0205fd8 c0205f78 c0029f00 c002b2e8 00000000 c0023400
5f80: f0e00014 00000000 c002bbcc c0204000 c02071a8 c0243dfc c0206ed8 41129200
5fa0: 30019adc c0205fd8 c0205fb0 c0205fc0 c002bc08 c002bc60 60000013 ffffffff
5fc0: c0264b80 c02429d8 c024c1ec c0205ffc c0205fdc c0008768 c002bc2c c0008364
5fe0: c0243e38 c0264b80 c0264b80 c0243e28 00000000 c0206000 c0008080 c00085ec
Backtrace:
[] (dequeue_task+0x0/0x78) from [] (deactivate_task+0x38/0x44)
[] (deactivate_task+0x0/0x44) from [] (schedule+0x144/0x468)
r4 = 0000038D
[] (schedule+0x0/0x468) from [] (schedule_timeout+0x98/0xc8)
[] (schedule_timeout+0x0/0xc8) from [] (io_schedule_timeout+0x34/0x5c)
r8 = 00000002 r7 = 0000000A r6 = 00000001 r5 = C02444A8
r4 = 00000924
[] (io_schedule_timeout+0x0/0x5c) from [] (blk_congestion_wait+0x88/0xa8)
r5 = C0205D90 r4 = C02164CC
[] (blk_congestion_wait+0x0/0xa8) from [] (try_to_free_pages+0x164/0x1b8)
r7 = C0205E20 r6 = 000000D0 r5 = 00000000 r4 = C02098E8
[] (try_to_free_pages+0x0/0x1b8) from [] (__alloc_pages+0x238/0x350)
[] (__alloc_pages+0x0/0x350) from [] (__get_free_pages+0x28/0x5c)
[] (__get_free_pages+0x0/0x5c) from [] (kmem_getpages+0x28/0x130)
[] (kmem_getpages+0x0/0x130) from [] (cache_grow+0x90/0x14c)
r4 = 000000D0
[] (cache_grow+0x0/0x14c) from [] (cache_alloc_refill+0x1d0/0x220)
[] (cache_alloc_refill+0x0/0x220) from [] (__kmalloc+0x70/0x90)
r8 = BF003B6C r7 = BF003C14 r6 = 000005EE r5 = BF003B88
r4 = 40000013
[] (__kmalloc+0x0/0x90) from [] (cirrus_receive+0xbc/0x148 [cirrus])
r4 = 00000504
[] (cirrus_receive+0x0/0x148 [cirrus]) from [] (cirrus_interrupt+0xe0/0x2d4 [cirrus])
r7 = 00000001 r6 = BF003C14 r5 = BF003B88 r4 = 00000504
[] (cirrus_interrupt+0x0/0x2d4 [cirrus]) from [] (__do_irq+0x54/0x84)
r8 = C0205F78 r7 = 00000035 r6 = 00000000 r5 = 00000000
r4 = C24B3240
[] (__do_irq+0x0/0x84) from [] (do_edge_IRQ+0xb0/0x144)
r8 = 60000013 r7 = C0205F78 r6 = C24B3240 r5 = 00000035
r4 = C0243888
[] (do_edge_IRQ+0x0/0x144) from [] (asm_do_IRQ+0x48/0xa0)
r7 = C002BC60 r6 = 00000000 r5 = C0205F78 r4 = C0204000
[] (asm_do_IRQ+0x0/0xa0) from [] (__irq_svc+0x20/0x180)
r5 = C0205FC0 r4 = C0205FAC
[] (cpu_idle+0x0/0x78) from [] (start_kernel+0x18c/0x1cc)
r6 = C024C1EC r5 = C02429D8 r4 = C0264B80
[] (start_kernel+0x0/0x1cc) from [] (__mmap_switched+0x0/0x2c)
Code: c02444a8 e1a0c00d e92dd800 e24cb004 (e5913000)
Kernel panic: Aiee, killing interrupt handler!
In interrupt handler - not syncing
其中cirrus_receive函数代码如下:
static void cirrus_receive (struct net_device *dev)
{
cirrus_t *priv = (cirrus_t *) dev->priv;
struct sk_buff *skb;
u16 status,length;
status = cirrus_read (dev,PP_RxStatus);
length = cirrus_read (dev,PP_RxLength);
if (!(status & RxOK)) {
priv->stats.rx_errors++;
if ((status & (Runt | Extradata))) priv->stats.rx_length_errors++;
if ((status & CRCerror)) priv->stats.rx_crc_errors++;
return;
}
if ((skb = dev_alloc_skb (length + 4)) == NULL) {
priv->stats.rx_dropped++;
return;
}
skb->dev = dev;
skb_reserve (skb,2);
char *ppacketdata=kmalloc(length, GFP_KERNEL);
if(ppacketdata==NULL){
printk("nnmalloc failed!");
return;
}
CIRRUS_insw (dev->base_addr, 0, ppacketdata, (length + 1) / 2);
unsigned char readCmd=read_dpsram_msg(1,ADD_Cmdto_CS8900);
if(readCmd==COMMAND_CON_END)
connection_end();
send_ch365_packet(ppacketdata,length-4); //ppacketdata在此调用内被释放
dev->last_rx = jiffies;
priv->stats.rx_packets++;
priv->stats.rx_bytes += length;
}
出错前会多次出现这条语句: bad: scheduling while atomic!
上网查了是关于linux内核调度的
麻烦各位高手给看看是什么问题,谢谢了!
由于这是小弟我第一次发帖提问,不清楚还要提供些什么信息,如果需要更详细的代码或其它信息请留言
小弟所在项目编写了一个网络数据的过滤程序,在运行时出现如下Oops
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 7 [#2]
Modules linked in: cirrus
CPU: 0
PC is at dequeue_task+0xc/0x78
LR is at deactivate_task+0x38/0x44
pc : [] lr : [] Not tainted
sp : c0205cc4 ip : c0205cd4 fp : c0205cd0
r10: 0000038d r9 : 72b90480 r8 : c020719c
r7 : c0206998 r6 : 0000000a r5 : c0204000 r4 : c0206998
r3 : 00000001 r2 : 00000000 r1 : 00000000 r0 : c0206998
Flags: nZCv IRQs off FIQs on Mode SVC_32 Segment kernel
Control: C000717F Table: 33B84000 DAC: 0000001D
Process swapper (pid: 0, stack limit = 0xc0204190)
Stack: (0xc0205cc4 to 0xc0206000)
5cc0: c0205ce4 c0205cd4 c003a02c c0039c48 0000038d c0205d20 c0205ce8
5ce0: c01d52c4 c003a004 c0205d84 c02069cc 01312d00 c0206b40 0005f5d6 c0204000
5d00: 0000000a c0205d24 c020719c 00000048 00000000 c0205d60 c0205d24 c01d5b24
5d20: c01d5190 c024a048 c031d1f4 0005f5d6 4b87ad6e c0045c94 c0206998 c0249990
5d40: 00000924 c02444a8 00000001 0000000a 00000002 c0205d78 c0205d64 c01d5a64
5d60: c01d5a9c c02164cc c0205d90 c0205dc0 c0205d7c c0139190 c01d5a40 00000000
5d80: c0206998 c003bb5c c0205d9c c0205d9c 00000000 c0206998 c003bb5c c02164cc
5da0: c02164cc c02098e8 00000000 000000d0 c0205e20 c0205e10 c0205dc4 c0062154
5dc0: c0139118 0000056f 00000010 00000048 00000018 00000557 00000008 00000002
5de0: 000000d0 00000001 00000000 c020957c c02098e8 00000001 000000d0 c0206998
5e00: 00000000 c0205e4c c0205e14 c0059e08 c0062000 00000000 c0204000 00000010
5e20: 00000000 c02658a0 c02658a0 c02658ac 00000000 000000d0 00000001 00000010
5e40: c0205e5c c0205e50 c0059f48 c0059be0 c0205e70 c0205e60 c005d6c8 c0059f30
5e60: 000000d0 c0205e9c c0205e74 c005e410 c005d6b0 c3fff3c0 c3ff10a0 c02658ac
5e80: c02658a0 000000d0 ffffffff 30019adc c0205ec0 c0205ea0 c005e69c c005e390
5ea0: 40000013 bf003b88 000005ee bf003c14 bf003b6c c0205ed4 c0205ec4 c005eb28
5ec0: c005e4dc 00000504 c0205ef4 c0205ed8 bf000e70 c005eac8 00000504 bf003b88
5ee0: bf003c14 00000001 c0205f18 c0205ef8 bf001160 bf000dc4 c24b3240 00000000
5f00: 00000000 00000035 c0205f78 c0205f3c c0205f1c c002af60 bf001090 c0243888
5f20: 00000035 c24b3240 c0205f78 60000013 c0205f5c c0205f40 c002b0b0 c002af1c
5f40: c0204000 c0205f78 00000000 c002bc60 c0205f74 c0205f60 c002b320 c002b010
5f60: c0205fac c0205fc0 c0205fd8 c0205f78 c0029f00 c002b2e8 00000000 c0023400
5f80: f0e00014 00000000 c002bbcc c0204000 c02071a8 c0243dfc c0206ed8 41129200
5fa0: 30019adc c0205fd8 c0205fb0 c0205fc0 c002bc08 c002bc60 60000013 ffffffff
5fc0: c0264b80 c02429d8 c024c1ec c0205ffc c0205fdc c0008768 c002bc2c c0008364
5fe0: c0243e38 c0264b80 c0264b80 c0243e28 00000000 c0206000 c0008080 c00085ec
Backtrace:
[] (dequeue_task+0x0/0x78) from [] (deactivate_task+0x38/0x44)
[] (deactivate_task+0x0/0x44) from [] (schedule+0x144/0x468)
r4 = 0000038D
[] (schedule+0x0/0x468) from [] (schedule_timeout+0x98/0xc8)
[] (schedule_timeout+0x0/0xc8) from [] (io_schedule_timeout+0x34/0x5c)
r8 = 00000002 r7 = 0000000A r6 = 00000001 r5 = C02444A8
r4 = 00000924
[] (io_schedule_timeout+0x0/0x5c) from [] (blk_congestion_wait+0x88/0xa8)
r5 = C0205D90 r4 = C02164CC
[] (blk_congestion_wait+0x0/0xa8) from [] (try_to_free_pages+0x164/0x1b8)
r7 = C0205E20 r6 = 000000D0 r5 = 00000000 r4 = C02098E8
[] (try_to_free_pages+0x0/0x1b8) from [] (__alloc_pages+0x238/0x350)
[] (__alloc_pages+0x0/0x350) from [] (__get_free_pages+0x28/0x5c)
[] (__get_free_pages+0x0/0x5c) from [] (kmem_getpages+0x28/0x130)
[] (kmem_getpages+0x0/0x130) from [] (cache_grow+0x90/0x14c)
r4 = 000000D0
[] (cache_grow+0x0/0x14c) from [] (cache_alloc_refill+0x1d0/0x220)
[] (cache_alloc_refill+0x0/0x220) from [] (__kmalloc+0x70/0x90)
r8 = BF003B6C r7 = BF003C14 r6 = 000005EE r5 = BF003B88
r4 = 40000013
[] (__kmalloc+0x0/0x90) from [] (cirrus_receive+0xbc/0x148 [cirrus])
r4 = 00000504
[] (cirrus_receive+0x0/0x148 [cirrus]) from [] (cirrus_interrupt+0xe0/0x2d4 [cirrus])
r7 = 00000001 r6 = BF003C14 r5 = BF003B88 r4 = 00000504
[] (cirrus_interrupt+0x0/0x2d4 [cirrus]) from [] (__do_irq+0x54/0x84)
r8 = C0205F78 r7 = 00000035 r6 = 00000000 r5 = 00000000
r4 = C24B3240
[] (__do_irq+0x0/0x84) from [] (do_edge_IRQ+0xb0/0x144)
r8 = 60000013 r7 = C0205F78 r6 = C24B3240 r5 = 00000035
r4 = C0243888
[] (do_edge_IRQ+0x0/0x144) from [] (asm_do_IRQ+0x48/0xa0)
r7 = C002BC60 r6 = 00000000 r5 = C0205F78 r4 = C0204000
[] (asm_do_IRQ+0x0/0xa0) from [] (__irq_svc+0x20/0x180)
r5 = C0205FC0 r4 = C0205FAC
[] (cpu_idle+0x0/0x78) from [] (start_kernel+0x18c/0x1cc)
r6 = C024C1EC r5 = C02429D8 r4 = C0264B80
[] (start_kernel+0x0/0x1cc) from [] (__mmap_switched+0x0/0x2c)
Code: c02444a8 e1a0c00d e92dd800 e24cb004 (e5913000)
Kernel panic: Aiee, killing interrupt handler!
In interrupt handler - not syncing
其中cirrus_receive函数代码如下:
static void cirrus_receive (struct net_device *dev)
{
cirrus_t *priv = (cirrus_t *) dev->priv;
struct sk_buff *skb;
u16 status,length;
status = cirrus_read (dev,PP_RxStatus);
length = cirrus_read (dev,PP_RxLength);
if (!(status & RxOK)) {
priv->stats.rx_errors++;
if ((status & (Runt | Extradata))) priv->stats.rx_length_errors++;
if ((status & CRCerror)) priv->stats.rx_crc_errors++;
return;
}
if ((skb = dev_alloc_skb (length + 4)) == NULL) {
priv->stats.rx_dropped++;
return;
}
skb->dev = dev;
skb_reserve (skb,2);
char *ppacketdata=kmalloc(length, GFP_KERNEL);
if(ppacketdata==NULL){
printk("nnmalloc failed!");
return;
}
CIRRUS_insw (dev->base_addr, 0, ppacketdata, (length + 1) / 2);
unsigned char readCmd=read_dpsram_msg(1,ADD_Cmdto_CS8900);
if(readCmd==COMMAND_CON_END)
connection_end();
send_ch365_packet(ppacketdata,length-4); //ppacketdata在此调用内被释放
dev->last_rx = jiffies;
priv->stats.rx_packets++;
priv->stats.rx_bytes += length;
}
出错前会多次出现这条语句: bad: scheduling while atomic!
上网查了是关于linux内核调度的
麻烦各位高手给看看是什么问题,谢谢了!
由于这是小弟我第一次发帖提问,不清楚还要提供些什么信息,如果需要更详细的代码或其它信息请留言
|
GFP_KERNEL 不一直是使用的正确分配标志; 有时 kmalloc 从一个进程的上下文的外部调用. 例如, 这类的调用可能发生在中断处理, tasklet, 和内核定时器中. 在这个情况下, 当前进程不应当被置为睡眠, 并且驱动应当使用一个 GFP_ATOMIC 标志来代替. 内核正常地试图保持一些空闲页以便来满足原子的分配. 当使用 GFP_ATOMIC 时, kmalloc 能够使用甚至最后一个空闲页. 如果这最后一个空闲页不存在, 但是, 分配失败.
其他用来代替或者增添 GFP_KERNEL 和 GFP_ATOMIC 的标志, 尽管它们 2 个涵盖大部分设备驱动的需要. 所有的标志定义在 , 并且每个标志用一个双下划线做前缀, 例如 __GFP_DMA. 另外, 有符号代表常常使用的标志组合; 这些缺乏前缀并且有时被称为分配优先级. 后者包括:
GFP_ATOMIC
用来从中断处理和进程上下文之外的其他代码中分配内存. 从不睡眠.
GFP_KERNEL
内核内存的正常分配. 可能睡眠.
GFP_USER
用来为用户空间页来分配内存; 它可能睡眠.
GFP_HIGHUSER
如同 GFP_USER, 但是从高端内存分配, 如果有. 高端内存在下一个子节描述.
其他用来代替或者增添 GFP_KERNEL 和 GFP_ATOMIC 的标志, 尽管它们 2 个涵盖大部分设备驱动的需要. 所有的标志定义在 , 并且每个标志用一个双下划线做前缀, 例如 __GFP_DMA. 另外, 有符号代表常常使用的标志组合; 这些缺乏前缀并且有时被称为分配优先级. 后者包括:
GFP_ATOMIC
用来从中断处理和进程上下文之外的其他代码中分配内存. 从不睡眠.
GFP_KERNEL
内核内存的正常分配. 可能睡眠.
GFP_USER
用来为用户空间页来分配内存; 它可能睡眠.
GFP_HIGHUSER
如同 GFP_USER, 但是从高端内存分配, 如果有. 高端内存在下一个子节描述.
|
从 错误信息来看,极有可能是因为
char *ppacketdata=kmalloc(length, GFP_KERNEL);
kmalloc 调用导致休眠所产生的。 把 GFP_KERNEL 改成 GFP_ATOMIC 就可以了。
char *ppacketdata=kmalloc(length, GFP_KERNEL);
kmalloc 调用导致休眠所产生的。 把 GFP_KERNEL 改成 GFP_ATOMIC 就可以了。