Linux内核实时机制x - 实时性之中断响应优化
Linux内核实时机制x - 中断响应优化
日志
1 非实时内核中断响应测试
0-code/5.15/rt-tests# ./cyclictest -p 90 -m -c 0 -i 1000 -l 1000 -h 100 -t 4
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 1.04 4.48 6.57 2/1628 385205T: 0 (385170) P:90 I:1000 C: 1000 Min: 3 Act: 3 Avg: 7 Max: 252
T: 1 (385171) P:90 I:1000 C: 999 Min: 3 Act: 5 Avg: 3 Max: 18
T: 2 (385172) P:90 I:1000 C: 999 Min: 3 Act: 4 Avg: 3 Max: 20
T: 3 (385173) P:90 I:1000 C: 999 Min: 3 Act: 4 Avg: 6 Max: 363
2 实时内核中断响应测试
0-code/5.15/rt-tests# trace-cmd start -e all;./cyclictest -p 90 -m -n -c 0 -t 4 -D5m -b 50 --tracemark
# /dev/cpu_dma_latency set to 0us
INFO: debugfs mountpoint: /sys/kernel/debug/tracing/
policy: fifo: loadavg: 6.17 15.98 18.12 2/1152 1691773T: 0 (1691490) P:90 I:1000 C: 31633 Min: 7 Act: 14 Avg: 15 Max: 36
T: 1 (1691491) P:90 I:1500 C: 21049 Min: 10 Act: 15 Avg: 15 Max: 28
T: 2 (1691492) P:90 I:2000 C: 15757 Min: 7 Act: 14 Avg: 15 Max: 40
T: 3 (1691493) P:90 I:2500 C: 12582 Min: 7 Act: 25 Avg: 15 Max: 40
# Thread Ids: 1691490 1691491 1691492 1691493
# Break thread: 1691493
# Break value: 56
2.1 Ftrace抓取日志
0-code/5.15/rt-tests# trace-cmd extract
CPU 0: 1077425 events lost
CPU 1: 1512931 events lost
CPU 2: 764575 events lost
CPU 3: 600860 events lost
CPU 4: 992340 events lost
CPU 5: 1030188 events lost
CPU 6: 1340854 events lost
CPU 7: 781496 events lost
CPU0 data recorded at offset=0x75a0001449984 bytes in size
CPU1 data recorded at offset=0x8bc0001449984 bytes in size
CPU2 data recorded at offset=0xa1e0001449984 bytes in size
CPU3 data recorded at offset=0xb800001449984 bytes in size
CPU4 data recorded at offset=0xce20001449984 bytes in size
CPU5 data recorded at offset=0xe440001449984 bytes in size
CPU6 data recorded at offset=0xfa60001449984 bytes in size
CPU7 data recorded at offset=0x11080001449984 bytes in size0-code/5.15/rt-tests# trace-cmd report -l > log.txt
3 嵌入式板卡-小系统测试结果
~/rt-tests# ./cyclictest -p98 -m -n -D3m -t5
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 2.20 1.73 0.87 1/156 420T: 0 ( 414) P:98 I:1000 C: 179997 Min: 4 Act: 5 Avg: 5 Max: 9
T: 1 ( 415) P:98 I:1500 C: 119982 Min: 5 Act: 6 Avg: 5 Max: 10
T: 2 ( 416) P:98 I:2000 C: 89975 Min: 5 Act: 6 Avg: 5 Max: 8
T: 3 ( 417) P:98 I:2500 C: 71970 Min: 5 Act: 6 Avg: 5 Max: 7
T: 4 ( 418) P:98 I:3000 C: 59967 Min: 5 Act: 6 Avg: 5 Max: 8
4 实时内核优化参数
cat /proc/osinfo
OS Type: Desktop
Kernel Version: 5.4.18-87.76
Source Version: NA
Build Time: # SMP PREEMPT_RT Thu Oct 24 05:30:26 UTC 2024
Architecture: aarch64
Online CPUs: 4
MemTotal: 8062440 KB
PageSize: 4 KB
Uptime: 220.16 Sec
Cmdline: BOOT_IMAGE=/vmlinuz-5.4.18-87.76-rt root=UUID=62db6dc4-b0d2-4beb-9e9b-c2e19006d930 ro quiet splash loglevel=0 console=tty0 resume=UUID=9fb16b7c-2e59-41d3-8de5-146708b4a8ca audit=0 security=none efi=runtime selinux=0 numa_balancing=disable nohlt tsc=reliable rcu_nocb_poll skew_tick=1 isolcpus=2-3 intel_pstate=disable nosoftlockup nohz=on nohz_full=2-3 rcu_nocbs=2-3