2
我在Raspberry Pi上進行性能測量,並希望獲得更高的分辨率,然後只是clock_gettime()。如何使用樹莓派時鐘計數進行性能測量
因此,我需要啓用CPU寄存器PMUSERENR。
根據我的Raspberry Pi上的/ proc/cpuinfo,我有一個「ARMv7處理器rev 5(v7l)」。所以,我下載的架構參考手冊,發現我必須使用:
CRn的= C9,OPC1 = 0,CRM = C14,OPC2 = 0
asm ("MCR p15, 0, %0, C9, C14, 0\n\t" :: "r"(1));
但一個內核模塊中使用此代碼時,我得到以下哎呀:
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.604846] Internal error: Oops: 5 [#1] SMP ARM
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.715199] Process insmod (pid: 2944, stack limit = 0xac80e210)
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.722399] Stack: (0xac80fe90 to 0xac810000)
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.727920] fe80: 7f1ba0f8 00007fff 80098128 ac80fea8
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.738472] fea0: 80578128 0000002d 00000000 7f1ba0f8 7f1ba0f8 7f1ba26c 7f1ba264 7f1ba134
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.749092] fec0: ac80e000 8057608c ac80feec ac80fed8 8057608c 00000000 00000000 00000000
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.759724] fee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[email protected] ~/projects/timer $
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.770389] ff00: 00000000 00000000 00000000 00000000 76f5e948 00007390 00000000 76f7b390
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.781147] ff20: 76f5e948 b91a2390 ac80e000 00000000 ac80ffa4 ac80ff40 8009b6c4 80099714
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.792000] ff40: b919b000 00007390 b91a0598 b91a0457 b91a22c8 0000026c 000002ac 00000000
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.802930] ff60: 00000000 00000000 0000001f 00000020 0000000c 0000000a 00000009 00000000
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.813947] ff80: 7ea4371c 00000000 55afc028 00000080 8000fc28 ac80e000 00000000 ac80ffa8
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.825056] ffa0: 8000fa20 8009b5f0 7ea4371c 00000000 76f74000 00007390 76f5e948 76f74000
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.836170] ffc0: 7ea4371c 00000000 55afc028 00000080 55afbf78 00007390 76f5e948 00000000
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.847338] ffe0: 00000000 7ea436c4 76f55fb4 76ec0534 60000010 76f74000 00000000 00000000
Message from [email protected] at Apr 29 20:58:12 ...
kernel:[ 84.880715] Code: e51b3084 e1530005 e2455008 0a000009 (e5953014)
我是新內核模塊,所以我不知道我應該去哪個方向。有沒有一種好的方法來調試這些東西?
很酷,我會試試。但是你知道什麼可能會導致我的哎呀?或者這樣的錯誤可能來自哪裏? – arm712
好像你在insmod進程中崩潰了,而不是實際的內核模塊。如果刪除mcr語句並重新編譯該模塊,insmod是否仍會崩潰?如果是,那麼用於編譯模塊的內核頭文件與您實際運行的內核不兼容。你能分享「uname -a」和你的makefile的輸出嗎? – Jitesh