OK6410A 开发板 (八) 63 linux-5.11 OK6410A linux内核空间常见的异常情景及分析 kernel exception
2022-08-22 来源:csdn
异常情景的level1
异常情景的level1 是最底层 show 当前状况的 api
其他具体的异常情景会根据 自身情景 调用 这些api
oops
打印
Unable to ... 到 ---[ end trace
行为
如果调用panic,就会做panic的行为,否则只是打印
是什么时候会调用panic
1. panic_on_oops 为 1
2. in_interrupt
2.1 硬中断
2.2 软中断
2.3 NMI
panic
打印
Kernel panic ...
行为
通知感兴趣模块,死机或重启
被谁调用的
只有oops会调用panic
BUG
!CONFIG_BUG #define BUG() do {} while (1)
CONFIG_BUG && !HAVE_ARCH_BUG #define BUG() do {
printk('BUG: failure at %s:%d/%s()!n', __FILE__, __LINE__, __func__);
barrier_before_unreachable();
panic('BUG!');
} while (0)
CONFIG_BUG && HAVE_ARCH_BUG #define BUG() _BUG(__FILE__, __LINE__, BUG_INSTR_VALUE)
#define BUG() _BUG(__FILE__, __LINE__, BUG_INSTR_VALUE) // #define BUG_INSTR_VALUE 0xe7f001f2 // 以这个值为arm的二进制代码执行,会产生未定义指令异常
#define _BUG(file, line, value) __BUG(file, line, value)
#define __BUG(__file, __line, __value)
do {
asm volatile('1:t' BUG_INSTR(__value) 'n'
'.pushsection .rodata.str, 'aMS', %progbits, 1n'
'2:t.asciz ' #__file 'n'
'.popsectionn'
'.pushsection __bug_table,'aw'n'
'.align 2n'
'3:t.word 1b, 2bn'
't.hword ' #__line ', 0n'
'.popsection');
unreachable();
} while (0)
BUG_ON
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
level2
level2 的话 有很多,level 2 对应了具体的异常情景
比如 除0 的函数路径
比如 缺页 的函数路径
1. 踩内存、硬件Bit位翻转导致的数据异常
一般需要同时编译出来的符号表(vmlinux)进行反汇编分析
Unable to handle kernel paging request at virtual address XXXXXXXXX
2. 调用BUG // arm64 BUG 直接调用 panic
代码中出现异常导致调用到BUG()触发的主动重启
Kernel BUG at ffffff8008311ac8 [verbose debug info unavailable]
3. oom
Out of memory意味着已无可用的memory,这样的问题必然存在一些耗费资源的进程耗尽了memory的资源触发的KE
Kernel panic - not syncing: Out of memory and no killable processes...
4. 未定义指令异常
一般是CPU/DRAM不稳定导致的问题
Internal error: Oops - undefined instruction
5. 卡死导致硬件看门狗超时
多见于底层频繁irq/bus卡死,导致kicker无法被schedule,从而引起watch dog触发中断
引导系统进入FIQ处理流程,最终call到BUG触发重启。 // wathchdog 是 fiq ???
(表现为HWT和Hardware Reboot)
6. 软件看门狗超时
MTK平台有hang_detect的机制,system_server进程每30S回去软件喂狗
如果系统卡在超过10min/11min/12min/14min时,会dump出不同的信息用于debug。
level2 实例
clcdfb_probe
825 printk('xxxxxxxxxxxxxxxxxxxxxxxxxxxx1n');
826 int *p = 0;
827 int a = 0;
828 a = *p;
829 printk('xxxxxxxxxxxxxxxxxxxxxxxxxxxx2n');
#0 __loop_delay () at arch/arm/lib/delay-loop.S:47
#1 0xc0045544 in panic (fmt=0xc0b1a010 'Attempted to kill init! exitcode=0x%08xn') at kernel/panic.c:200
#2 0xc00486cc in find_child_reaper (father=0xee8a8000) at kernel/exit.c:471
#3 0xc0048998 in forget_original_parent (father=0xee8a8000, dead=0xee8977a0) at kernel/exit.c:560
#4 0xc0048cd4 in exit_notify (tsk=0xee8a8000, group_dead=1) at kernel/exit.c:596
#5 0xc0049878 in do_exit (code=11) at kernel/exit.c:767
#6 0xc001dacc in oops_end (flags=1610613011, regs=0xee897b88, signr=11) at arch/arm/kernel/traps.c:313
#7 0xc001db7c in die (str=0xc0b17148 'Oops', regs=0xee897b88, err=23) at arch/arm/kernel/traps.c:333
#8 0xc002f960 in __do_kernel_fault (mm=0x0 <__vectors_start>, addr=0, fsr=23, regs=0xee897b88) at arch/arm/mm/fault.c:150
#9 0xc0b0dc00 in do_page_fault (addr=0, fsr=23, regs=0xee897b88) at arch/arm/mm/fault.c:392
#10 0xc0008798 in do_DataAbort (addr=0, fsr=23, regs=0xee897b88) at arch/arm/mm/fault.c:550
#11 0xc0b0c9d8 in __dabt_svc () at arch/arm/kernel/entry-armv.S:197
#12 0xc0b0c9d8 in __dabt_svc () at arch/arm/kernel/entry-armv.S:197
#13 0xc0b0c9d8 in __dabt_svc () at arch/arm/kernel/entry-armv.S:197
xxxxxxxxxxxxxxxxxxxxxxxxxxxx1
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 17 [#1] SMP ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.0.0 #10
Hardware name: ARM-Versatile Express
task: ee8a8000 ti: ee896000 task.ti: ee896000
PC is at clcdfb_probe+0x44/0x2f0
LR is at clcdfb_probe+0x30/0x2f0
pc : [ sp : ee897bd0 ip : 00000004 fp : 00000000 r10: 00000000 r9 : 00000000 r8 : 00000000 r7 : 00000000 r6 : 00000000 r5 : c0affb44 r4 : 00000000 r3 : 00000000 r2 : c10b37a8 r1 : 60000013 r0 : 0000001d Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 10c5387d Table: 8ebcc059 DAC: 00000015 Process swapper/0 (pid: 1, stack limit = 0xee896210) Stack: (0xee897bd0 to 0xee898000) 7bc0: 60000013 c10c8afc c10c37ac eea0ec00 7be0: 60000013 eea0ec64 c10c8b60 c10c8b60 60000013 00030003 60000013 00000000 7c00: 00000000 60000013 eea0ec64 60000013 eea0ec64 eea0ec64 60000013 eea0ec64 7c20: eea0ec64 eea0ec00 00000001 60000013 c10fb134 00000000 00000000 eea0ec64 7c40: 60000013 00000000 c0affb44 c0615614 c10fb134 eea0ec00 eebe7144 80000001 7c60: eebe71e0 eebe71e0 c10fb134 eebe7140 00000004 c0314138 00000001 c0b95370 7c80: 00000000 00000001 eea0ecc4 eea0ecc4 00000001 eea0ec00 00000000 c0b95370 7ca0: eea0ec00 eea0ec08 c10c37ac c10c37c4 c10c37c4 eea0ec00 eea0ec00 00000000 7cc0: 00000000 00000000 c0affb44 c068a554 c10c37c4 eea0ec00 eea0ec64 eea0ec64 7ce0: eea0ec64 c069d468 ffffffff eea0ec00 00000000 eea0ec64 eea0ec64 00000000 7d00: 00000001 c1107f6c c1107f6c eea0ec08 eea0ed3c ffffffff eea0ecc4 00000000 7d20: ffffffff eea0ecc4 00000000 00000001 eea0ecc4 eea0ecc4 00000000 c0b95378 7d40: eea0ec00 00000001 eea0ec00 00000000 00000000 00000000 c0affb44 c068a90c 7d60: eea0ec00 c10c37c4 eea0ec08 eea0ec00 c0b95488 eea0ec00 eea0ec34 00000000 7d80: ee95f9c0 c068ab90 c10c37c4 eea0ec00 00000000 eea0ec00 c10c37c4 ee897dc8 7da0: ee95f980 eea0ec00 c10c8a98 c10c37c4 ee95e774 c0687aa8 c068aac0 c10c37c4 7dc0: 00000000 c10c3aa8 ee95e75c ee95f9b4 eea0ec00 00000000 c10c8994 c068ac0c 7de0: ee95e770 c10c37c4 c0688858 c06888b0 c0b8e7f0 ee93ef80 00000000 c10c37c4 7e00: 000080d0 00000050 000000d0 00000050 eea7f180 c0b951c4 c10c3aa8 00000000 7e20: ef5d0620 c068bec4 00000000 c10c37c4 00000000 00000000 00000006 c0615a04 7e40: 00000000 c10c37c4 eeb31380 c0d57280 00000000 c0008dc8 ee891130 c007dc78 7e60: 000000a2 c0d5724c 00000006 c0d0eb30 000000a2 c0cd69f8 eefeb32a c0b12200 7e80: 000000d0 c10fa0ec 60000153 c10b1eec c10fa0ec c10fa0ec 00000000 00000001 7ea0: eefeb329 eefeb320 c0b1bb10 60000153 c10b1ef0 60000153 c10b1eec 00000000 7ec0: 60000013 60000013 60000013 a0000113 00000000 00000000 00000000 c0d0f40c 7ee0: 00000006 00000006 c0d0eb30 c10b1dc4 c10b1dc4 00000006 c10b1dc4 c0d901bc 7f00: ee8af6c0 c0d0f460 00000000 00000006 00000000 c0d0f4ac 00000000 c0d0f724 7f20: 2df17000 ee8a84c0 00000000 c10ac7e4 c10ac7e4 ee8a8000 eefc05c0 eefc05c0 7f40: 00000001 ee8a83f4 ee8a83f4 ee8a83f4 ee8a83f4 ee8a8000 60000153 c10b8e98 7f60: 60000153 ee8a842c ee8a842c ee8a842c 00000000 ee8a842c ee8a842c 60000153 7f80: 60000153 ee8a83f4 ee8a8000 ee8a8000 00000000 c0affb54 00000000 00000000 7fa0: 00000000 eefc05c0 00000000 c0014de0 00000000 00000000 00000000 00000000 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000 [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ Code: e58d3068 e3a03000 e58d3064 e59d3068 (e5933000) ---[ end trace 3d127599db201418 ]--- Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b xxxxxxxxxxxxxxxxxxxxxxxxxxxx1 --- // __do_kernel_fault Unable to handle kernel NULL pointer dereference at virtual address 00000000 // __do_kernel_fault->show_pte pgd = c0004000 [00000000] *pgd=00000000 --- // __do_kernel_fault->die->__die Internal error: Oops: 17 [#1] SMP ARM --- // __do_kernel_fault->die->__die->print_modules Modules linked in: --- // __do_kernel_fault->die->__die->__show_regs->show_regs_print_info->dump_stack_print_info CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.0.0 #10 Hardware name: ARM-Versatile Express task: ee8a8000 ti: ee896000 task.ti: ee896000 // __do_kernel_fault->die->__die->__show_regs PC is at clcdfb_probe+0x44/0x2f0 LR is at clcdfb_probe+0x30/0x2f0 pc : [ sp : ee897bd0 ip : 00000004 fp : 00000000 r10: 00000000 r9 : 00000000 r8 : 00000000 r7 : 00000000 r6 : 00000000 r5 : c0affb44 r4 : 00000000 r3 : 00000000 r2 : c10b37a8 r1 : 60000013 r0 : 0000001d Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 10c5387d Table: 8ebcc059 DAC: 00000015 --- // __do_kernel_fault->die->__die Process swapper/0 (pid: 1, stack limit = 0xee896210) // __do_kernel_fault->die->__die->dump_mem Stack: (0xee897bd0 to 0xee898000) 7bc0: 60000013 c10c8afc c10c37ac eea0ec00 7be0: 60000013 eea0ec64 c10c8b60 c10c8b60 60000013 00030003 60000013 00000000 7c00: 00000000 60000013 eea0ec64 60000013 eea0ec64 eea0ec64 60000013 eea0ec64 7c20: eea0ec64 eea0ec00 00000001 60000013 c10fb134 00000000 00000000 eea0ec64 7c40: 60000013 00000000 c0affb44 c0615614 c10fb134 eea0ec00 eebe7144 80000001 7c60: eebe71e0 eebe71e0 c10fb134 eebe7140 00000004 c0314138 00000001 c0b95370 7c80: 00000000 00000001 eea0ecc4 eea0ecc4 00000001 eea0ec00 00000000 c0b95370 7ca0: eea0ec00 eea0ec08 c10c37ac c10c37c4 c10c37c4 eea0ec00 eea0ec00 00000000 7cc0: 00000000 00000000 c0affb44 c068a554 c10c37c4 eea0ec00 eea0ec64 eea0ec64 7ce0: eea0ec64 c069d468 ffffffff eea0ec00 00000000 eea0ec64 eea0ec64 00000000 7d00: 00000001 c1107f6c c1107f6c eea0ec08 eea0ed3c ffffffff eea0ecc4 00000000 7d20: ffffffff eea0ecc4 00000000 00000001 eea0ecc4 eea0ecc4 00000000 c0b95378 7d40: eea0ec00 00000001 eea0ec00 00000000 00000000 00000000 c0affb44 c068a90c 7d60: eea0ec00 c10c37c4 eea0ec08 eea0ec00 c0b95488 eea0ec00 eea0ec34 00000000 7d80: ee95f9c0 c068ab90 c10c37c4 eea0ec00 00000000 eea0ec00 c10c37c4 ee897dc8 7da0: ee95f980 eea0ec00 c10c8a98 c10c37c4 ee95e774 c0687aa8 c068aac0 c10c37c4 7dc0: 00000000 c10c3aa8 ee95e75c ee95f9b4 eea0ec00 00000000 c10c8994 c068ac0c 7de0: ee95e770 c10c37c4 c0688858 c06888b0 c0b8e7f0 ee93ef80 00000000 c10c37c4 7e00: 000080d0 00000050 000000d0 00000050 eea7f180 c0b951c4 c10c3aa8 00000000 7e20: ef5d0620 c068bec4 00000000 c10c37c4 00000000 00000000 00000006 c0615a04 7e40: 00000000 c10c37c4 eeb31380 c0d57280 00000000 c0008dc8 ee891130 c007dc78 7e60: 000000a2 c0d5724c 00000006 c0d0eb30 000000a2 c0cd69f8 eefeb32a c0b12200 7e80: 000000d0 c10fa0ec 60000153 c10b1eec c10fa0ec c10fa0ec 00000000 00000001 7ea0: eefeb329 eefeb320 c0b1bb10 60000153 c10b1ef0 60000153 c10b1eec 00000000 7ec0: 60000013 60000013 60000013 a0000113 00000000 00000000 00000000 c0d0f40c 7ee0: 00000006 00000006 c0d0eb30 c10b1dc4 c10b1dc4 00000006 c10b1dc4 c0d901bc 7f00: ee8af6c0 c0d0f460 00000000 00000006 00000000 c0d0f4ac 00000000 c0d0f724 7f20: 2df17000 ee8a84c0 00000000 c10ac7e4 c10ac7e4 ee8a8000 eefc05c0 eefc05c0 7f40: 00000001 ee8a83f4 ee8a83f4 ee8a83f4 ee8a83f4 ee8a8000 60000153 c10b8e98 7f60: 60000153 ee8a842c ee8a842c ee8a842c 00000000 ee8a842c ee8a842c 60000153 7f80: 60000153 ee8a83f4 ee8a8000 ee8a8000 00000000 c0affb54 00000000 00000000 7fa0: 00000000 eefc05c0 00000000 c0014de0 00000000 00000000 00000000 00000000 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000 --- // __do_kernel_fault->die->__die->dump_backtrace [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ --- // __do_kernel_fault->die->__die->dump_instr->__dump_instr-> Code: e58d3068 e3a03000 e58d3064 e59d3068 (e5933000) --- // __do_kernel_fault->die->oops_end->oops_exit->print_oops_end_marker ---[ end trace 3d127599db201418 ]--- --- // __do_kernel_fault->die->oops_end->panic Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b --- // __do_kernel_fault->die->oops_end->panic ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b xxxxxxxxxxxxxxxxxxxxxxxxxxxx1 Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = c0004000 [00000000] *pgd=00000000 Internal error: Oops: 17 [#1] SMP ARM Modules linked in: CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.0.0 #10 Hardware name: ARM-Versatile Express task: ee8a8000 ti: ee896000 task.ti: ee896000 PC is at clcdfb_probe+0x44/0x2f0 LR is at clcdfb_probe+0x30/0x2f0 pc : [ sp : ee897bd0 ip : 00000004 fp : 00000000 r10: 00000000 r9 : 00000000 r8 : 00000000 r7 : 00000000 r6 : 00000000 r5 : c0affb44 r4 : 00000000 r3 : 00000000 r2 : c10b37a8 r1 : 60000013 r0 : 0000001d Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 10c5387d Table: 8e07006a DAC: 00000015 Process swapper/0 (pid: 1, stack limit = 0xee896210) Stack: (0xee897bd0 to 0xee898000) 7bc0: 60000013 c10c8afc c10c37ac eea24c00 7be0: 60000013 eea24c64 c10c8b60 c10c8b60 60000013 00030003 60000013 00000000 7c00: 00000000 60000013 eea24c64 60000013 eea24c64 eea24c64 60000013 eea24c64 7c20: eea24c64 eea24c00 00000001 60000013 c10fb134 00000000 00000000 eea24c64 7c40: 60000013 00000000 c0affb44 c0615614 c10fb134 eea24c00 ee118964 80000001 7c60: ee118a00 ee118a00 c10fb134 ee118960 00000004 c0314138 00000001 c0b95370 7c80: 00000000 00000001 eea24cc4 eea24cc4 00000001 eea24c00 00000000 c0b95370 7ca0: eea24c00 eea24c08 c10c37ac c10c37c4 c10c37c4 eea24c00 eea24c00 00000000 7cc0: 00000000 00000000 c0affb44 c068a554 c10c37c4 eea24c00 eea24c64 eea24c64 7ce0: eea24c64 c069d468 ffffffff eea24c00 00000000 eea24c64 eea24c64 00000000 7d00: 00000001 c1107f6c c1107f6c eea24c08 eea24d3c ffffffff eea24cc4 00000000 7d20: ffffffff eea24cc4 00000000 00000001 eea24cc4 eea24cc4 00000000 c0b95378 7d40: eea24c00 00000001 eea24c00 00000000 00000000 00000000 c0affb44 c068a90c 7d60: eea24c00 c10c37c4 eea24c08 eea24c00 c0b95488 eea24c00 eea24c34 00000000 7d80: eea304c0 c068ab90 c10c37c4 eea24c00 00000000 eea24c00 c10c37c4 ee897dc8 7da0: eea30480 eea24c00 c10c8a98 c10c37c4 ee9ce274 c0687aa8 c068aac0 c10c37c4 7dc0: 00000000 c10c3aa8 ee9ce25c eea304b4 eea24c00 00000000 c10c8994 c068ac0c 7de0: ee9ce270 c10c37c4 c0688858 c06888b0 c0b8e7f0 eea3d780 00000000 c10c37c4 7e00: 000080d0 00000050 000000d0 00000050 ee925400 c0b951c4 c10c3aa8 00000000 7e20: ef5bb760 c068bec4 00000000 c10c37c4 00000000 00000000 00000006 c0615a04 7e40: 00000000 c10c37c4 ee0bbc80 c0d57280 00000000 c0008dc8 ee891530 c007dc78 7e60: 000000a2 c0d5724c 00000006 c0d0eb30 000000a2 c0cd69f8 eefeb32a c0b12200 7e80: 000000d0 c10fa0ec 60000113 c10b1eec c10fa0ec c10fa0ec 00000000 00000001 7ea0: eefeb329 eefeb320 c0b1bb10 60000113 c10b1ef0 60000113 c10b1eec 00000000 7ec0: 60000013 60000013 60000013 a0000113 00000000 00000000 00000000 c0d0f40c 7ee0: 00000006 00000006 c0d0eb30 c10b1dc4 c10b1dc4 00000006 c10b1dc4 c0d901bc 7f00: ee8af6c0 c0d0f460 00000000 00000006 00000000 c0d0f4ac 00000000 c0d0f724 7f20: 2df17000 ee8a84c0 00000000 c10ac7e4 c10ac7e4 ee8a8000 eefc05c0 eefc05c0 7f40: 00000001 ee8a83f4 ee8a83f4 ee8a83f4 ee8a83f4 ee8a8000 60000153 c10b8e98 7f60: 60000153 ee8a842c ee8a842c ee8a842c 00000000 ee8a842c ee8a842c 60000153 7f80: 60000153 ee8a83f4 ee8a8000 ee8a8000 00000000 c0affb54 00000000 00000000 7fa0: 00000000 eefc05c0 00000000 c0014de0 00000000 00000000 00000000 00000000 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000 [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ Code: e58d3068 e3a03000 e58d3064 e59d3068 (e5933000) ---[ end trace ab8363fed3099d3a ]--- Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b gic_handle_irq handle_IPI ipi_cpu_stop cpu_relax
上一篇:OK6410A 开发板 (八) 64 linux-5.11 OK6410A linux异常解析
下一篇:OK6410A 开发板 (八) 62 linux-5.11 OK6410A linux应用空间常见的异常情景及分析
- 〖Linux〗OK6410a蜂鸣器的驱动程序编写全程实录
- 开发环境搭建 (一) OK6410A 开发环境 1官方环境 OK
- 开发环境搭建 (一) OK6410A 开发环境 2 更改环境 OK
- 开发环境搭建 (一) OK6410A 开发环境 3 更改环境 FAIL
- 开发环境搭建 (二) OK6410A 开发环境 其他
- 开发环境搭建 (一) OK6410A 开发环境 4 更改环境 OK
- OK6410A 开发板 (二) 环境熟悉
- OK6410A 开发板 (三) u-boot-1.1.6 boot 解析
- OK6410A 开发板 (四) OK6410A 裸机代码
- OK6410A 开发板 (五) u-boot-2021.01 移植 到 ok6410a