我正在使用hwlat_detector跟踪器来测量在Linux外部引起的系统延迟。
用于测量的机器是Asus Zenbook ux331un。我确实使用idle = poll kernel cmd-line参数禁用了处理器电源状态,禁用了超线程,禁用了turbo boost。 这是hwlat跟踪程序的示例输出。
<...>-4976 [002] d...... 3258.677286: #81 inner/outer(us): 31/33 ts:1572267806.608681762
<...>-4976 [003] dn..... 3276.085073: #82 inner/outer(us): 32/34 ts:1572267824.016656104
<...>-4976 [000] d.L.... 3277.113063: #83 inner/outer(us): 32/0 ts:1572267825.044656725
<...>-4976 [003] dn..... 3280.181030: #84 inner/outer(us): 32/32 ts:1572267828.112657027
<...>-4976 [000] dnL.... 3281.205020: #85 inner/outer(us): 32/32 ts:1572267829.136657127
<...>-4976 [002] dn..... 3283.252999: #86 inner/outer(us): 456/33 ts:1572267831.184659048
<...>-4976 [003] dn..... 3284.276986: #87 inner/outer(us): 16/32 ts:1572267832.208656275
<...>-4976 [000] dnL.... 3285.300975: #88 inner/outer(us): 16/33 ts:1572267833.232656714
<...>-4976 [002] dn..... 3287.348959: #89 inner/outer(us): 20/33 ts:1572267835.280662760
<...>-4976 [003] dn..... 3288.372943: #90 inner/outer(us): 33/34 ts:1572267836.304657092
<...>-4976 [000] dnL.... 3289.396938: #91 inner/outer(us): 32/32 ts:1572267837.328663631
<...>-4976 [002] dn..... 3291.444912: #92 inner/outer(us): 20/33 ts:1572267839.376659443
从输出中可以看到,发生了超过400us的延迟。我也在30us范围内获得了很多延迟。起初,我认为延迟是由SMI引起的,因此我开始读取MSR寄存器0x34,该寄存器对自系统启动以来发生的SMI进行计数。测试运行时,它不会增加。造成这种延迟的原因还有哪些?