fix(someboot): clamp x86 LAPIC timer delta - #1794
Merged
Merged
Conversation
ZR233
marked this pull request as ready for review
July 31, 2026 03:14
Contributor
There was a problem hiding this comment.
本 PR 仅修改 platforms/someboot/src/arch/x86_64/trap.rs:为 TSC-deadline 与 legacy LAPIC 初始计数两条路径统一施加 0x0f 的最小 delta,并在 tick→APIC count 换算后再次钳制,避免校准比例向下取整后重新落到设备下限以下。该修复局限于 x86 someboot 的本地 APIC 定时器编程,不改变公共接口、其他架构路径或用户态 ABI;feature-development.md 不适用(既有缺陷修复,而非新增能力)。
实现与 Linux x86 LAPIC 的最小事件间隔方向一致;新增的源码末尾单元测试直接覆盖 legacy 路径中 1 -> 0x0f 的回归场景,未修复实现会失败。未发现新的 unsafe、锁/原子同步、资源所有权或 ABI 风险。
验证:
cargo fmt --check:通过。cargo clippy --manifest-path platforms/someboot/Cargo.toml --all-features -- -D warnings:通过。cargo test --manifest-path platforms/someboot/Cargo.toml --all-features:通过(库测试 46 项及全部集成测试)。- 当前 head
4cbe6a52b7565bc4725d862a00bbb2d00ede5651的组织 CI:Detect changed paths、Run sync-lint / run_container、Check formatting / run_host成功;其余跳过项符合矩阵/路径条件,未见 PR 相关失败。
已检查已有 review / issue 评论:均为空,无遗留讨论。已对 base 中既有 x86 定时器代码和开放 PR 的 LAPIC timer、someboot x86 关键词进行重复/重叠核对;未发现重复或依赖顺序冲突。没有新增或变更 app/QEMU 流程,故 app 运行准备不适用。最终 checklist 已逐项完成,无未解决风险、测试缺口或需要追加领域审阅者的事项。
Powered by gpt-5.6-terra
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.
问题
x86 someboot 在为已过期或被舍入为极小值的时钟事件编程时,会把
1tick 直接传给 TSC-deadline 或 legacy LAPIC 计数器。LAPIC 时钟事件需要保留最小 delta;Linux x86 的对应配置使用0xF。修改
0x0f)。ticks_to_apic_counts(1)返回1,修复后返回15。提取范围
仅提取 #1775 中提交
6a138fb40beaa7883d6ff6cbcb3ee5624adc206a的 someboot x86 LAPIC 最小间隔修复;不包含该提交其余的时钟事件框架改造。已检查当前开放 PR,没有发现同一 someboot LAPIC 修复的重复实现。验证
cargo test -p someboot --lib legacy_lapic_clamps_overdue_events_to_the_device_minimum:先红(1 != 15),修复后绿。cargo fmt --all -- --checkcargo xtask clippy --package someboot(8/8 checks passed)cargo xtask arceos test qemu --test-group rust --target x86_64-unknown-none --test-case task-sleep(1/1 passed)未运行物理板或自托管测试。