TSC 不稳定,切换到 hpet

TSC 不稳定,切换到 hpet

当前时钟源是 hpet,它根本无法与我尝试运行的应用程序配合使用,acpi_pm 也给出了相同的错误。我需要 TSC 才能工作。我已经禁用了 intel_pstate 并将故障转移设置为 acpi_pm。我还能尝试什么来让 TSC 再次工作?

May  4 17:49:18 Ubuntu-1404-trusty-64-minimal kernel: [    0.083468] TSC deadline timer enabled
May  4 17:49:18 Ubuntu-1404-trusty-64-minimal kernel: [    0.083475] Performance Events: PEBS fmt1+, 16-deep LBR, SandyBridge events, full-width counters, Intel PMU driver.
May  4 17:49:18 Ubuntu-1404-trusty-64-minimal kernel: [    0.083778] ... version:                3
May  4 17:49:18 Ubuntu-1404-trusty-64-minimal kernel: [    0.083838] ... bit width:              48
May  4 17:49:18 Ubuntu-1404-trusty-64-minimal kernel: [    0.083900] ... generic registers:      4
May  4 17:49:18 Ubuntu-1404-trusty-64-minimal kernel: [    0.083961] ... value mask:             0000ffffffffffff
May  4 17:49:18 Ubuntu-1404-trusty-64-minimal kernel: [    0.084023] ... max period:             0000ffffffffffff
May  4 17:49:18 Ubuntu-1404-trusty-64-minimal kernel: [    0.084086] ... fixed-purpose events:   3
May  4 17:49:18 Ubuntu-1404-trusty-64-minimal kernel: [    0.084146] ... event mask:             000000070000000f
May  4 17:49:18 Ubuntu-1404-trusty-64-minimal kernel: [    0.085580] x86: Booting SMP configuration:
May  4 17:49:18 Ubuntu-1404-trusty-64-minimal kernel: [    0.085642] .... node  #0, CPUs:        #1
May  4 17:49:18 Ubuntu-1404-trusty-64-minimal kernel: [    0.099367] TSC synchronization [CPU#0 -> CPU#1]:
May  4 17:49:18 Ubuntu-1404-trusty-64-minimal kernel: [    0.099489] Measured 493618680 cycles TSC warp between CPUs, turning off TSC clock.
May  4 17:49:18 Ubuntu-1404-trusty-64-minimal kernel: [    0.008000] tsc: Marking TSC unstable due to check_tsc_sync_source failed

答案1

你的情况与我的情况有点不同,请谨慎行事。我说的是,我不知道强制使用 tsc 是否是个好主意。在尝试覆盖之前,你应该首先尝试了解为什么会收到不稳定的消息。

您可以在 grub 中使用命令行选项强制使用 tsc。首先,保存当前 grub 文件的副本:

sudo cp /etc/default/grub /etc/default/grub.original

然后在 sudo 模式下使用您喜欢的编辑器(我使用 nano):

sudo nano /etc/default/grub

并修改该GRUB_CMDLINE_LINUX_DEFAULT行:

GRUB_CMDLINE_LINUX_DEFAULT="clocksource=tsc"

保存文件然后:

sudo update-grub

重启。

示例,更改之前(/var/log/kern.log摘录):

May  5 07:06:36 test-smy kernel: [   11.222717] Clocksource tsc unstable (delta = 88022463 ns)
May  5 07:06:36 test-smy kernel: [   11.300602] Switched to clocksource pit
May  5 07:06:36 test-smy kernel: [   11.383987] 8139too: 8139too Fast Ethernet driver 0.9.28

更改后的示例:

May  5 07:27:02 test-smy kernel: [   11.672507] Clocksource tsc unstable (delta = 91987678 ns)
May  5 07:27:02 test-smy kernel: [   12.149995] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)

和:

$ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
tsc

参考

顺便说一句,这可能与 intel_pstate 驱动程序的启用或禁用无关。

答案2

tl.dr。“您是否尝试过将其关闭然后再打开?”;)

--

感谢@Dough Smythies 的见解和指导!

我在 Proxmox 中的 VM 中遇到了类似的问题。在 dmesg 抱怨时钟源不稳定后,VM 就关闭了。这台 VM 在 gpu 直通设置和安装 Ubuntu 22.04 近一年后运行良好,但在安装 20.04(安装稳定版本的 HTCondor)后,这种情况开始发生……所以我犹豫是否要更改 proxmox 和 vm 设置,更改 GRUB 似乎是最快的尝试方法。

grep "model name" /proc/cpuinfo是: model name : 11th Gen Intel(R) Core(TM) i5-11400 @ 2.60GHz

[  101.133995] clocksource: timekeeping watchdog on CPU0: hpet retried 2 times before success
[  103.453440] clocksource: timekeeping watchdog on CPU5: hpet read-back delay of 10086670ns, attempt 4, marking unstable
[  103.453459] tsc: Marking TSC unstable due to clocksource watchdog
[  103.453512] TSC found unstable after boot, most likely due to broken BIOS. Use 'tsc=unstable'.
[  103.453512] sched_clock: Marking unstable (103581349355, -127782148)<-(103605679503, -152167759)
[  103.453717] clocksource: Override clocksource tsc is unstable and not HRT compatible - cannot switch while in HRT/NOHZ mode
[  103.462461] clocksource: Switched to clocksource hpet
[  106.842934] hrtimer: interrupt took 88385244 ns

如上所述,clocksource 希望我切换到hpet,所以我只是将 grub 更新到下面。

GRUB_CMDLINE_LINUX_DEFAULT="clocksource=hpet"

以上方法无效,虚拟机仍然崩溃……然后我尝试下面的组合...仍然不起作用...

GRUB_CMDLINE_LINUX_DEFAULT="clocksource=hpet tsc=unstable trace_clock=local"

与此同时,必须开始清理日记sudo journalctl --vacuum-time=1h...

最后,结果证明什么有效?重新启动物理机/Proxmox!

相关内容