[DESCRIPTION]
SYS_LAST_KMSG这支文件是记录上次重启前最后的kernel console log,不过除了kernel console log还有hw_status和fiq step两个值。
这两个值很重要,可以看出异常的类型和可能的卡死的范围。以下一一介绍这两个值:
hw_status:
这个值的意义是:
表示重启的原因。
是在preloader阶段从看门狗状态寄存器转换赋值给hw_status,然后传到lk,再传到kernel的。
值定义所在文件:
- 非AOSP project(KK/JB/ICS/GB),在:mediatek/platform/$platform/preloader/src/drivers/inc/wdt.h
- AOSP project(KK.AOSP/L0/L1及之后),在bootable/bootloader/preloader/platform/$platform/src/drivers/inc/wdt.h
/* Reboot reason */
#define RE_BOOT_REASON_UNKNOW (0x00)
#define RE_BOOT_BY_WDT_HW (0x01)
#define RE_BOOT_BY_WDT_SW (0x02)
#define RE_BOOT_WITH_INTTERUPT (0x04)
#define RE_BOOT_BY_SPM_THERMAL (0x08)
#define RE_BOOT_BY_SPM (0x10)
#define RE_BOOT_BY_THERMAL_DIRECT (0x20)
#define RE_BOOT_BY_DEBUG (0x40)
#define RE_BOOT_BY_SECURITY (0x80)
#define RE_BOOT_REASON_UNKNOW (0x00)
#define RE_BOOT_BY_WDT_HW (0x01)
#define RE_BOOT_BY_WDT_SW (0x02)
#define RE_BOOT_WITH_INTTERUPT (0x04)
#define RE_BOOT_BY_SPM_THERMAL (0x08)
#define RE_BOOT_BY_SPM (0x10)
#define RE_BOOT_BY_THERMAL_DIRECT (0x20)
#define RE_BOOT_BY_DEBUG (0x40)
#define RE_BOOT_BY_SECURITY (0x80)
以上的宏可以相或,比如hw_status = 5 = RE_BOOT_WITH_INTTERUPT|RE_BOOT_BY_WDT_HW
常见的定义
- 0:正常开机是这个值,因为不是重启,所以看门狗状态为0
- 1/5:表示HW reboot(如果fiq step不为0则是有发生panic然后再发生的HW reboot,此时应该先看panic),看门狗发出FIQ还是无法得到响应,只能硬件复位。
- 2:软件复位,比如adb reboot或菜单选择重启
- 8:thermal复位,比如温度过高。
- 16/17:SPM复位。
fiq step:
这个值的意义是:表示是否有跑到panic相关的函数,已经大致在哪些panic函数。设计fiq step目的是当系统发生异常时,不能保证panic相关的函数也能正常执行,所以每执行一些函数后,就更新fiq step,表示已跑到这里了。
具体请在代码里搜索aee_rr_rec_fiq_step()函数被调用的位置就清楚了。
值定义所在文件:
- 非AOSP project(KK/JB/ICS/GB),在:mediatek/kernel/include/linux/mtk_ram_console.h
- AOSP project(KK.AOSP/L0/L1及之后),在kernel-3.10/include/linux/mtk_ram_console.h
typedef enum {
AEE_FIQ_STEP_FIQ_ISR_BASE = 1,
AEE_FIQ_STEP_WDT_FIQ_INFO = 4,
AEE_FIQ_STEP_WDT_FIQ_STACK,
AEE_FIQ_STEP_WDT_FIQ_LOOP,
AEE_FIQ_STEP_WDT_FIQ_DONE,
AEE_FIQ_STEP_WDT_IRQ_INFO = 8,
AEE_FIQ_STEP_WDT_IRQ_KICK,
AEE_FIQ_STEP_WDT_IRQ_SMP_STOP,
AEE_FIQ_STEP_WDT_IRQ_STACK,
AEE_FIQ_STEP_WDT_IRQ_TIME,
AEE_FIQ_STEP_WDT_IRQ_GIC,
AEE_FIQ_STEP_WDT_IRQ_LOCALTIMER,
AEE_FIQ_STEP_WDT_IRQ_IDLE,
AEE_FIQ_STEP_WDT_IRQ_SCHED,
AEE_FIQ_STEP_WDT_IRQ_DONE,
AEE_FIQ_STEP_KE_WDT_INFO = 20,
AEE_FIQ_STEP_KE_WDT_PERCPU,
AEE_FIQ_STEP_KE_WDT_LOG,
AEE_FIQ_STEP_KE_SCHED_DEBUG,
AEE_FIQ_STEP_KE_WDT_DONE,
AEE_FIQ_STEP_KE_IPANIC_START = 32,
AEE_FIQ_STEP_KE_IPANIC_OOP_HEADER,
AEE_FIQ_STEP_KE_IPANIC_DETAIL,
AEE_FIQ_STEP_KE_IPANIC_CONSOLE,
AEE_FIQ_STEP_KE_IPANIC_USERSPACE,
AEE_FIQ_STEP_KE_IPANIC_ANDROID,
AEE_FIQ_STEP_KE_IPANIC_MMPROFILE,
AEE_FIQ_STEP_KE_IPANIC_HEADER,
AEE_FIQ_STEP_KE_IPANIC_DONE,
AEE_FIQ_STEP_KE_NESTED_PANIC = 64,
} AEE_FIQ_STEP_NUM;
AEE_FIQ_STEP_FIQ_ISR_BASE = 1,
AEE_FIQ_STEP_WDT_FIQ_INFO = 4,
AEE_FIQ_STEP_WDT_FIQ_STACK,
AEE_FIQ_STEP_WDT_FIQ_LOOP,
AEE_FIQ_STEP_WDT_FIQ_DONE,
AEE_FIQ_STEP_WDT_IRQ_INFO = 8,
AEE_FIQ_STEP_WDT_IRQ_KICK,
AEE_FIQ_STEP_WDT_IRQ_SMP_STOP,
AEE_FIQ_STEP_WDT_IRQ_STACK,
AEE_FIQ_STEP_WDT_IRQ_TIME,
AEE_FIQ_STEP_WDT_IRQ_GIC,
AEE_FIQ_STEP_WDT_IRQ_LOCALTIMER,
AEE_FIQ_STEP_WDT_IRQ_IDLE,
AEE_FIQ_STEP_WDT_IRQ_SCHED,
AEE_FIQ_STEP_WDT_IRQ_DONE,
AEE_FIQ_STEP_KE_WDT_INFO = 20,
AEE_FIQ_STEP_KE_WDT_PERCPU,
AEE_FIQ_STEP_KE_WDT_LOG,
AEE_FIQ_STEP_KE_SCHED_DEBUG,
AEE_FIQ_STEP_KE_WDT_DONE,
AEE_FIQ_STEP_KE_IPANIC_START = 32,
AEE_FIQ_STEP_KE_IPANIC_OOP_HEADER,
AEE_FIQ_STEP_KE_IPANIC_DETAIL,
AEE_FIQ_STEP_KE_IPANIC_CONSOLE,
AEE_FIQ_STEP_KE_IPANIC_USERSPACE,
AEE_FIQ_STEP_KE_IPANIC_ANDROID,
AEE_FIQ_STEP_KE_IPANIC_MMPROFILE,
AEE_FIQ_STEP_KE_IPANIC_HEADER,
AEE_FIQ_STEP_KE_IPANIC_DONE,
AEE_FIQ_STEP_KE_NESTED_PANIC = 64,
} AEE_FIQ_STEP_NUM;
这样就可以通过该值大致知道是否有跑到哪个panic相关函数里了。
除了在SYS_LAST_KMSG可以找到这2个值外,还有以下文件可以找到:
SYS_VERSION_INFO
ZAEE_LOG