在系统运行的时候经常会看到
<4>[ 4758.075985] (2)[195:allocator@2.0-s]Normal free:15012kB min:3352kB low:9492kB high:10332kB active_anon:78804kB inactive_anon:102432kB active_file:104580kB inactive_file:85616kB unevictable:256kB isolated(anon):1116kB isolated(file):0kB present:734208kB managed:706936kB mlocked:256kB dirty:1156kB writeback:20kB mapped:132460kB shmem:4888kB slab_reclaimable:23304kB slab_unreclaimable:41824kB kernel_stack:16072kB pagetables:36232kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:772 all_unreclaimable? no
<4>[ 4758.081783] (2)[195:allocator@2.0-s]lowmem_reserve[]: 0 2072 2072
<4>[ 4758.082367] (2)[195:allocator@2.0-s]HighMem free:112kB min:256kB low:2556kB high:2872kB active_anon:40160kB inactive_anon:64336kB active_file:50052kB inactive_file:40808kB unevictable:1676kB isolated(anon):0kB isolated(file):0kB present:265216kB managed:265216kB mlocked:0kB dirty:480kB writeback:0kB mapped:71488kB shmem:2156kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:432 all_unreclaimable? no
<4>[ 4758.087847] (2)[195:allocator@2.0-s]lowmem_reserve[]: 0 0 0
<4>[ 4758.088281] (2)[195:allocator@2.0-s]Normal: 1930*4kB (UEM) 429*8kB (UEM) 237*16kB (UEM) 8*32kB (UEMR) 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 15200kB
<4>[ 4758.089908] (2)[195:allocator@2.0-s]HighMem: 20*4kB (R) 4*8kB (R) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 112kB
<4>[ 4758.091280] (2)[195:allocator@2.0-s]85259 total pagecache pages
<4>[ 4758.092339] (2)[195:allocator@2.0-s]12825 pages in swap cache
<4>[ 4758.093087] (2)[195:allocator@2.0-s]Swap cache stats: add 2445683, delete 2432859, find 14033/1361885
<4>[ 4758.094260] (2)[195:allocator@2.0-s]Free swap = 376248kB
<4>[ 4758.094953] (2)[195:allocator@2.0-s]Total swap = 726036kB
<1>[ 4758.099018] (2)[195:allocator@2.0-s]Unable to handle kernel paging request at virtual address aefb700c
<1>[ 4758.100206] (2)[195:allocator@2.0-s]pgd = ed164000
<1>[ 4758.100813] (2)[195:allocator@2.0-s][aefb700c] *pgd=acaac835, *pte=00000000, *ppte=00000000
<0>[ 4758.101601]-(2)[195:allocator@2.0-s]Internal error: Oops: 817 [#1] PREEMPT SMP ARM
<4>[ 4758.102555]-(2)[195:allocator@2.0-s]Modules linked in: wlan_drv_gen2 bf13a000 (null) 1002990 0 (O) wmt_chrdev_wifi bf135000 (null) 6008 0 (O) gps_drv bf12b000 (null) 21954 0 (O) fmradio_drv bf102000 (null) 132230 0 (O) bt_drv bf0fb000 (null) 12055 0 (O) wmt_drv bf000000 (null) 853192 0 (O)
<5>[ 4758.105624]-(2)[195:allocator@2.0-s]disable aee kernel api
<4>[ 4759.106120]-(2)[195:allocator@2.0-s]Non-crashing CPUs did not react to IPI
<4>[ 4759.107015]-(2)[195:allocator@2.0-s]CPU: 2 PID: 195 Comm: allocator@2.0-s Tainted: G O 3.18.79+ #5
<4>[ 4759.108279]-(2)[195:allocator@2.0-s]task: ed5c7500 ti: ed158000 task.ti: ed158000
<4>[ 4759.109227]-(2)[195:allocator@2.0-s]PC is at 0xaed03b0c
<4>[ 4759.109892]-(2)[195:allocator@2.0-s]LR is at 0xaf19d133
<4>[ 4759.110559]-(2)[195:allocator@2.0-s]pc : [<aed03b0c>] lr : [<af19d133>] psr: a0070030
<4>[ 4759.110559]sp : bee953e0 ip : af1d263c fp : 00000001
<4>[ 4759.112268]-(2)[195:allocator@2.0-s]r10: 00264000 r9 : bee954fc r8 : ae5b6000
<4>[ 4759.113193]-(2)[195:allocator@2.0-s]r7 : aefb7000 r6 : 00000f02 r5 : 00000004 r4 : 00000000
<4>[ 4759.114281]-(2)[195:allocator@2.0-s]r3 : 00000000 r2 : 17ca855a r1 : 00000000 r0 : ffffffff
<4>[ 4759.115371]-(2)[195:allocator@2.0-s]Flags: NzCv IRQs on FIQs on Mode USER_32 ISA Thumb Segment user
<4>[ 4759.116567]-(2)[195:allocator@2.0-s]Control: 10c5387d Table: ad16406a DAC: 00000051
<4>[ 4759.117562]-(2)[195:allocator@2.0-s]CPU: 2 PID: 195 Comm: allocator@2.0-s Tainted: G O 3.18.79+ #5
<4>[ 4759.118816]-(2)[195:allocator@2.0-s]Backtrace:
<4>[ 4759.119146]-(2)[195:allocator@2.0-s][<c010b940>] (dump_backtrace) from [<c010bb60>] (show_stack+0x18/0x1c)
<4>[ 4759.120359]-(2)[195:allocator@2.0-s] r7:00000080 r6:00000000 r5:20070193 r4:c0e2a4e0
<4>[ 4759.121084]-(2)[195:allocator@2.0-s][<c010bb48>] (show_stack) from [<c09843ec>] (dump_stack+0x90/0xa4)
<4>[ 4759.122272]-(2)[195:allocator@2.0-s][<c098435c>] (dump_stack) from [<c05c4730>] (ipanic_die+0x58/0x13c)
<4>[ 4759.123451]-(2)[195:allocator@2.0-s] r7:00000000 r6:00000000 r5:fffffffd r4:ed159ddc
<4>[ 4759.124173]-(2)[195:allocator@2.0-s][<c05c46d8>] (ipanic_die) from [<c0145af8>] (notifier_call_chain+0x9c/0x338)
<4>[ 4759.125451]-(2)[195:allocator@2.0-s] r4:00000001
<4>[ 4759.125780]-(2)[195:allocator@2.0-s][<c0145a5c>] (notifier_call_chain) from [<c0145e70>] (atomic_notifier_call_chain+0x3c/0x50)
<4>[ 4759.127220]-(2)[195:allocator@2.0-s] r10:ed5c7500 r9:c0e12ea4 r8:ffffe000 r7:c0b4ab68
<4>[ 4759.127951]-(2)[195:allocator@2.0-s][<c0145e34>] (atomic_notifier_call_chain) from [<c0146458>] (notify_die+0x40/0x48)
<4>[ 4759.129293]-(2)[195:allocator@2.0-s] r6:ed159fb0 r5:00000817 r4:c0e7b29c
<4>[ 4759.129882]-(2)[195:allocator@2.0-s][<c0146418>] (notify_die) from [<c010bc74>] (die+0x110/0x458)
<4>[ 4759.131014]-(2)[195:allocator@2.0-s][<c010bb64>] (die) from [<c0982f08>] (__do_kernel_fault.part.1+0x6c/0x7c)
<4>[ 4759.132258]-(2)[195:allocator@2.0-s] r10:c0e13c2c r9:aefb700c r8:aefb700c r7:ed535180
<4>[ 4759.132990]-(2)[195:allocator@2.0-s][<c0982e9c>] (__do_kernel_fault.part.1) from [<c01152c0>] (do_page_fault+0x3b0/0x3c4)
<4>[ 4759.134365]-(2)[195:allocator@2.0-s] r7:00000817 r4:ed159fb0
<4>[ 4759.134822]-(2)[195:allocator@2.0-s][<c0114f10>] (do_page_fault) from [<c01003ac>] (do_DataAbort+0x80/0x114)
<4>[ 4759.136056]-(2)[195:allocator@2.0-s] r10:c0e13c2c r9:aefb700c r8:00000817 r7:ed159fb0
<4>[ 4759.136784]-(2)[195:allocator@2.0-s][<c010032c>] (do_DataAbort) from [<c010ca00>] (__dabt_usr+0x40/0x60)
<4>[ 4759.137980]-(2)[195:allocator@2.0-s]Exception stack(0xed159fb0 to 0xed159ff8)
<4>[ 4759.138888]-(2)[195:allocator@2.0-s]9fa0: ffffffff 00000000 17ca855a 00000000
<4>[ 4759.140189]-(2)[195:allocator@2.0-s]9fc0: 00000000 00000004 00000f02 aefb7000 ae5b6000 bee954fc 00264000 00000001
<4>[ 4759.141489]-(2)[195:allocator@2.0-s]9fe0: af1d263c bee953e0 af19d133 aed03b0c a0070030 ffffffff
<4>[ 4759.142581]-(2)[195:allocator@2.0-s] r10:00264000 r9:bee954fc r8:10c5387d r7:10c5387d
<5>[ 4759.143366]-(2)[195:allocator@2.0-s]mrdump: cpu[2] tsk:ed5c7500 ti:ed158000
<5>[ 4759.146200]-(2)[195:allocator@2.0-s]has_mt_dump_support: no mt_dump support!
<4>[ 4762.257137]-(2)[195:allocator@2.0-s]SMP: failed to stop secondary CPUs
<0>[ 4762.258124]-(2)[195:allocator@2.0-s]machine_restart, arm_pm_restart( (null))
<1>[ 4762.259179]-(2)[195:allocator@2.0-s]ARCH_RESET happen!!!
<1>[ 4762.260009]-(2)[195:allocator@2.0-s]arch_reset: cmd = NULL
<4>[ 4762.260924]-(2)[195:allocator@2.0-s]CPU: 2 PID: 195 Comm: allocator@2.0-s Tainted: G O 3.18.79+ #5
<4>[ 4762.262301]-(2)[195:allocator@2.0-s]Backtrace:
<4>[ 4762.262967]-(2)[195:allocator@2.0-s][<c010b940>] (dump_backtrace) from [<c010bb60>] (show_stack+0x18/0x1c)
<4>[ 4762.264321]-(2)[195:allocator@2.0-s] r7:00000080 r6:00000000 r5:a0070193 r4:c0e2a4e0
<4>[ 4762.265583]-(2)[195:allocator@2.0-s][<c010bb48>] (show_stack) from [<c09843ec>] (dump_stack+0x90/0xa4)
<4>[ 4762.267066]-(2)[195:allocator@2.0-s][<c098435c>] (dump_stack) from [<c06ecef4>] (arch_reset+0xc8/0xfc)
<4>[ 4762.268370]-(2)[195:allocator@2.0-s] r7:00000000 r6:00000000 r5:00000000 r4:c0e56950
<4>[ 4762.269625]-(2)[195:allocator@2.0-s][<c06ece2c>] (arch_reset) from [<c06ecf54>] (mtk_arch_reset_handle+0x2c/0x40)
<4>[ 4762.271048]-(2)[195:allocator@2.0-s] r7:00000000 r6:00000000 r5:00000000 r4:00000000
<4>[ 4762.272294]-(2)[195:allocator@2.0-s][<c06ecf28>] (mtk_arch_reset_handle) from [<c0145af8>] (notifier_call_chain+0x9c/0x338)
<4>[ 4762.273832]-(2)[195:allocator@2.0-s] r5:ffffffff r4:00000000
<4>[ 4762.274676]-(2)[195:allocator@2.0-s][<c0145a5c>] (notifier_call_chain) from [<c0145e70>] (atomic_notifier_call_chain+0x3c/0x50)
<4>[ 4762.276258]-(2)[195:allocator@2.0-s] r10:c0e7b948 r9:c0e7bf0c r8:c05c46d8 r7:00000000
<4>[ 4762.277511]-(2)[195:allocator@2.0-s][<c0145e34>] (atomic_notifier_call_chain) from [<c0147168>] (do_kernel_restart+0x28/0x2c)
<4>[ 4762.279069]-(2)[195:allocator@2.0-s] r6:00000000 r5:00000000 r4:c0e7b088
<4>[ 4762.280118]-(2)[195:allocator@2.0-s][<c0147140>] (do_kernel_restart) from [<c0107a84>] (machine_restart+0x94/0x98)
<4>[ 4762.281720]-(2)[195:allocator@2.0-s][<c01079f0>] (machine_restart) from [<c0146ff4>] (emergency_restart+0x1c/0x20)
<4>[ 4762.283156]-(2)[195:allocator@2.0-s] r7:00000000 r6:00000000 r5:fffffffd r4:ed159ddc
<4>[ 4762.284400]-(2)[195:allocator@2.0-s][<c0146fd8>] (emergency_restart) from [<c05c475c>] (ipanic_die+0x84/0x13c)
<4>[ 4762.285957]-(2)[195:allocator@2.0-s][<c05c46d8>] (ipanic_die) from [<c0145af8>] (notifier_call_chain+0x9c/0x338)
<4>[ 4762.287371]-(2)[195:allocator@2.0-s] r4:00000001
<4>[ 4762.288022]-(2)[195:allocator@2.0-s][<c0145a5c>] (notifier_call_chain) from [<c0145e70>] (atomic_notifier_call_chain+0x3c/0x50)
<4>[ 4762.289606]-(2)[195:allocator@2.0-s] r10:ed5c7500 r9:c0e12ea4 r8:ffffe000 r7:c0b4ab68
<4>[ 4762.290853]-(2)[195:allocator@2.0-s][<c0145e34>] (atomic_notifier_call_chain) from [<c0146458>] (notify_die+0x40/0x48)
<4>[ 4762.292338]-(2)[195:allocator@2.0-s] r6:ed159fb0 r5:00000817 r4:c0e7b29c
<4>[ 4762.293386]-(2)[195:allocator@2.0-s][<c0146418>] (notify_die) from [<c010bc74>] (die+0x110/0x458)
<4>[ 4762.294820]-(2)[195:allocator@2.0-s][<c010bb64>] (die) from [<c0982f08>] (__do_kernel_fault.part.1+0x6c/0x7c)
<4>[ 4762.296204]-(2)[195:allocator@2.0-s] r10:c0e13c2c r9:aefb700c r8:aefb700c r7:ed535180
<4>[ 4762.297462]-(2)[195:allocator@2.0-s][<c0982e9c>] (__do_kernel_fault.part.1) from [<c01152c0>] (do_page_fault+0x3b0/0x3c4)
<4>[ 4762.298976]-(2)[195:allocator@2.0-s] r7:00000817 r4:ed159fb0
<4>[ 4762.299787]-(2)[195:allocator@2.0-s][<c0114f10>] (do_page_fault) from [<c01003ac>] (do_DataAbort+0x80/0x114)
<4>[ 4762.301160]-(2)[195:allocator@2.0-s] r10:c0e13c2c r9:aefb700c r8:00000817 r7:ed159fb0
<4>[ 4762.302369]-(2)[195:allocator@2.0-s][<c010032c>] (do_DataAbort) from [<c010ca00>] (__dabt_usr+0x40/0x60)
<4>[ 4762.303751]-(2)[195:allocator@2.0-s]Exception stack(0xed159fb0 to 0xed159ff8)
<4>[ 4762.304889]-(2)[195:allocator@2.0-s]9fa0: ffffffff 00000000 17ca855a 00000000
<4>[ 4762.306465]-(2)[195:allocator@2.0-s]9fc0: 00000000 00000004 00000f02 aefb7000 ae5b6000 bee954fc 00264000 00000001
<4>[ 4762.308022]-(2)[195:allocator@2.0-s]9fe0: af1d263c bee953e0 af19d133 aed03b0c a0070030 ffffffff
<4>[ 4762.309251]-(2)[195:allocator@2.0-s] r10:00264000 r9:bee954fc r8:10c5387d r7:10c5387d
<31>[ 4573.560242] (3)[9113:logd.reader.per]logd: logd.reader.per thread stop.
或上层在new内存的时候,内核就直接报Internal error: Oops: 817 [#1] PREEMPT SMP ARM错误等信息的时候,一般就是分配内存分配不到,由于硬件在画板布线以及多层电路板的地和电源没处理好的原因,DDR一般跑不到最高主频的。这个时候可以尝试将DDR主频降低点进行测试分析,看看是否是DDR本身的原因引起。
方法如下:
修改:
vendor\mediatek\proprietary\bootable\bootloader\preloader\platform\ac8227l\src\drivers\emi.c
vendor\mediatek\proprietary\bootable\bootloader\preloader\platform\ac8227l\src\drivers\emi.c
/*
* mt_set_emi: Set up EMI/DRAMC.
*/
#if CFG_FPGA_PLATFORM
void mt_set_emi (void)
{
}
#else
void mt_set_emi (void)
{
int index = 0;
unsigned int val1,val2/*, temp1, temp2*/;
EMI_SETTINGS *emi_set;
unsigned int manu_id;
*EMI_CONF = 0x004210000; // Enable EMI Address Scramble
....................................
#if COMBO_LPDDR2 > 0
#ifdef VCORE_VMEM_ADJUST_IN_PRELOADER
#if VcHV_VmHV
pmic_Vcore_adjust(Vcore_HV_LPDDR2);
pmic_Vmem_adjust(Vmem_HV_LPDDR2);
#elif VcLV_VmLV
pmic_Vcore_adjust(Vcore_LV_LPDDR2);
pmic_Vmem_adjust(Vmem_LV_LPDDR2);
#else
pmic_Vcore_adjust(Vcore_NV_LPDDR2);
pmic_Vmem_adjust(Vmem_NV_LPDDR2);
#endif
emi_pmic_voltage_read(0);
#endif //#ifdef VCORE_VMEM_ADJUST_IN_PRELOADER
#ifdef MEMPLL_INIT_V1_0
mt_mempll_init(DDR800, DDR_PLL_MODE); //DDR2的数据传输速率配置为DDR800
//mt_mempll_init(DDR1066, DDR_PLL_MODE); //DDR2的数据传输速率配置为DDR1033 DDR2最高只能到DDR1033
print("[EMI] LPDDR2 DRAM Clock = %d KHz, MEMPLL MODE = %d \r\n", 4*mt_get_mem_freq(), DDR_PLL_MODE);
#else
print("[EMI] LPDDR2 DRAM Clock = %d MHz, MEMPLL MODE = %d \r\n", DDR_MEMPLL, DDR_PLL_MODE);
#endif
.........................
#if COMBO_LPDDR3 > 0
#ifdef VCORE_VMEM_ADJUST_IN_PRELOADER
#if VcHV_VmHV
pmic_Vcore_adjust(Vcore_HV_LPDDR3);
pmic_Vmem_adjust(Vmem_HV_LPDDR3);
#elif VcLV_VmLV
pmic_Vcore_adjust(Vcore_LV_LPDDR3);
pmic_Vmem_adjust(Vmem_LV_LPDDR3);
#else
pmic_Vcore_adjust(Vcore_NV_LPDDR3);
pmic_Vmem_adjust(Vmem_NV_LPDDR3);
#endif
emi_pmic_voltage_read(0);
#endif //#ifdef VCORE_VMEM_ADJUST_IN_PRELOADER
#ifdef MEMPLL_INIT_V1_0
//mt_mempll_init(DDR1333, DDR_PLL_MODE); //DDR3的数据总线速率配置DDR1333
//mt_mempll_init(DDR800, DDR_PLL_MODE); //DDR3的数据总线速率配置DDR800
mt_mempll_init(DDR1066, DDR_PLL_MODE); //DDR3的数据总线速率配置DDR1066
//mt_mempll_init(533, DDR_PLL_MODE); //only for lp3 bring up use
print("[EMI] LPDDR3 DRAM Clock = %d KHz, MEMPLL MODE = %d \r\n", 4*mt_get_mem_freq(), DDR_PLL_MODE);
#else
print("[EMI] LPDDR3 DRAM Clock = %d MHz, MEMPLL MODE = %d \r\n", DDR_MEMPLL, DDR_PLL_MODE);
#endif
#ifdef REXTDN_ENABLE
print("[EMI] PCDDR3 RXTDN Calibration:\r\n");
ett_rextdn_sw_calibration();
#endif
init_lpddr3(emi_set);
#else
print("[EMI]donot support LPDDR3!!!!!!!!\r\n");
ASSERT(0);
#endif
}
else if ((emi_set->type & 0xF) == TYPE_PCDDR3)
{
#if COMBO_PCDDR3 > 0
//----------------------------------------
//1.default Vcore 1.125V , Vmem 1.350V, HV/LV only for HQA stress test
#ifdef VCORE_VMEM_ADJUST_IN_PRELOADER
#if VcHV_VmHV
pmic_Vcore_adjust(Vcore_HV_PCDDR3);
pmic_Vmem_adjust(Vmem_HV_PCDDR3);
#elif VcLV_VmLV
pmic_Vcore_adjust(Vcore_LV_PCDDR3);
pmic_Vmem_adjust(Vmem_LV_PCDDR3);
#else
pmic_Vcore_adjust(Vcore_NV_PCDDR3);
pmic_Vmem_adjust(Vmem_NV_PCDDR3);
#endif
emi_pmic_voltage_read(0);
#endif //#ifdef VCORE_VMEM_ADJUST_IN_PRELOADER
//2.mempll init
#ifdef MEMPLL_INIT_V1_0
//mt_mempll_init(DDR1333, DDR_PLL_MODE);//DDR3的数据总线速率配置DDR1333
//mt_mempll_init(DDR800, DDR_PLL_MODE); //DDR3的数据总线速率配置DDR800
mt_mempll_init(DDR1066, DDR_PLL_MODE); //DDR3的数据总线速率配置DDR1066
print("[EMI] PCDDR3 DRAM Clock = %d KHz, MEMPLL MODE = %d \r\n", 4*mt_get_mem_freq(), DDR_PLL_MODE);
#else
print("[EMI] PCDDR3 DRAM Clock = %d MHz, MEMPLL MODE = %d \r\n", DDR_MEMPLL, DDR_PLL_MODE);
#endif
.....................................
修改好之后编译preloader.bin下载进行测试即可,DDR压力测试可以使用以下脚本进行测试,如下:
linux环境monkey.sh:
#!/bin/bash
while true
do
adb shell svc wifi enable
adb shell monkey 100000 --throttle 3000 --ignore-crashes --kill-process-after-error
sleep 3
done
windows环境monkey.bat:
:one
::adb shell monkey 100000 --ignore-crashes --ignore-native-carshes --monitor-native-crashes --ignore-security-exceptions --ignore-security-exceptions
adb shell svc wifi enable
adb shell monkey 100000 --throttle 3500 --ignore-crashes --kill-process-after-error
::sleep 3
goto two
:two
adb shell svc wifi enable
adb shell monkey 100000 --throttle 3500 --ignore-crashes --kill-process-after-error
::sleep 3
goto one
事件延迟为3秒,忽略掉本地崩溃进程,系统出现错误之后杀掉错误进程继续跑monkey,因为不杀掉一般针对平台代码来讲APP很多异常没法测试,这个可以测试内核的稳定性。测试时,先打开mtklog,打开异常时打印到屏幕,然后将mtklog工具退到后台。之后开始跑以上monkey脚本。当出现系统重启之后屏幕打印/data/vendor/mtklog/aee_exp/db.fatal.00.KE的打印就是内核出现错误时收集的日志信息,我们可以解开这个文件进行分析。如果没出现系统重启,而屏幕也没打印db.fatal.XX.KE的打印,说明是硬件或DDR跟主芯片不匹配(跑不到正常的速率)的问题,降频可以解决(牺牲系统的性能)。