Ubuntu 16.04.1 LTS 内核 4.10.0-38-generic MB:ASRock X299 Taichi CPU:Intel i7-7820X,无超频
此示例应产生连续 10 秒的声音,但它断断续续了几次。
编译:
g++ pulsefail.cpp -std=c++11 -lpulse-simple -lpulse
./a.out
添加以下内核命令行选项后:
clocksource=hpet lapic=notscdeadline
示例按预期运行。并且整体系统性能和响应能力要好得多。
我还尝试使用 __rdtsc 指令测量此示例中的 TSC 频率。在添加内核选项之前,计算结果为 ~3,75 GHz,但应用解决方法后,结果变为 ~3,60 GHz。
更改内核选项后,‘dmesg | grep TSC’ 的显著结果:
[ 0.000000] [Firmware Bug]: TSC ADJUST: CPU0: -2477218568993634 force to 0
[ 0.183572] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU1: 0
[ 0.184601] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU2: 0
[ 0.185638] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU3: 0
[ 0.186669] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU4: 0
[ 0.187698] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU5: 0
[ 0.188724] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU6: 0
[ 0.189807] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU7: 0
[ 0.190802] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU8: 0
[ 0.191845] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU9: 0
[ 0.192869] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU10: 0
[ 0.193901] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU11: 0
[ 0.194928] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU12: 0
[ 0.195960] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU13: 0
[ 0.196986] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU14: 0
[ 0.198070] [Firmware Bug]: TSC ADJUST differs: Reference CPU0: -2477218568993634 CPU15: 0
[ 16.499107] vboxdrv: TSC mode is Invariant, tentative frequency 3600020432 Hz
没有它们,除了改变时钟源外,就没什么了。没有错误或任何东西,但 TSC 频率计算接近 3,75 GHz。
答案1
更新:针对不正确的 TSC 频率问题的内核补丁已合并。使用此补丁构建内核可修复此问题。
https://patchwork.kernel.org/patch/10177619/ https://github.com/torvalds/linux/commit/b511203093489eb1829cb4de86e8214752205ac6#diff-96989d5a06fa45e5014d1613838a4f86