Repository navigation
开机后记下客体时钟源,x86_64 不是 tsc 时存下内核日志 - #171
Merged
Merged
Conversation
开机后设置的最后一步读一次 current_clocksource(连同可选的时钟源和 uname -m), 写进这次开机的日志,并记到 avd\.mas_<i>.clocksource.json。x86_64 客体不是 tsc 时记一条警告,马上把 su 0 logcat -b kernel -d 存到 logs\mas_<i>-<时间>-clocksource.txt(和时钟有关的行在前,整份不超过 4 MB, 每台实例留最新 5 份),警告里带上找到的原因行。arm64 客体没有 tsc,只记不报。 读不到只记一句,不重试、不拦开机。 问题包:实例那节加一行最近一次开机的时钟源(没有记录就不写); *-clocksource.txt 每台实例收最新 3 份,不占日志的 300 MB 上限。 这只是取证,不是修复。 Refs ModAVD/ModAVD#110
This was referenced Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs ModAVD/ModAVD#110
这只是取证,不是修复:客体时钟源偶尔从 tsc 退回 hpet,出事那次没留内核日志,不知道内核是哪种原因停用 tsc 的。这个 PR 让产品每次开机自己记下时钟源,退回时马上存下内核日志。issue 不随它关。
改了什么
internal/emu/clocksource.go,在afterBoot里排在下载盘之后):读一次/sys/devices/system/clocksource/clocksource0/current_clocksource,连同available_clocksource和uname -m。客体里跑的是一条固定命令,不带变量和管道。modavd-bootwatch.log。avd\.mas_<i>.clocksource.json,给问题包用;删实例时一起删。su 0 logcat -b kernel -d,在宿主这边过滤clocksource|tsc|watchdog|hpet(不分大小写),存到logs\mas_<i>-<时间>-clocksource.txt。unstable|warp|skew|read-back delay的行),对应 issue 里列的三种情况。arch_sys_counter:照样记,但不报警,也不读内核日志。是不是 x86 看uname -m,读不到时看实例的 config.ini。internal/report):时钟源(最近一次开机,<时间> 读):tsc。不是 tsc 时写成hpet,不是 tsc(可选 …),内核日志 logs\…。没有记录(之后没开过机、旧版 modavd)就不写这一行,所以现有的 golden 摘要不用改。*-clocksource.txt每台实例收最新 3 份,像启动卡死的线程转储一样不占日志的 300 MB 上限;一份都没有时 summary 里不提。日志原文
测试
gofmt -l、go vet ./...,以及GOOS=darwin/GOOS=linux下的go vet ./internal/...,都过了;go test ./internal/emu ./internal/report也过了。