fix(kvm): disable PMU on aarch64 for Kunpeng-920 panic#3650
fix(kvm): disable PMU on aarch64 for Kunpeng-920 panic#3650ZStack-Robot wants to merge 1 commit into5.5.12from
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml (via .coderabbit.yaml) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough添加 VM_PMU 全局配置并绑定到 VM/Cluster;在 KVM StartVm 命令中新增 pmu 字段;在 KVM 主机启动逻辑中对 AArch64 架构读取并应用资源级 VM_PMU 配置;新增集成测试覆盖默认与资源级覆盖行为。(≤50 字) Changes
Sequence Diagram(s)sequenceDiagram
participant VM as 虚拟机/调用者
participant GlobalCfg as 全局配置系统
participant KVMHost as KVM 主机
participant ResourceCfg as 资源配置门面
participant KVMCmd as KVMAgent StartVmCmd
VM->>GlobalCfg: 查询 vm.pmu 默认值
GlobalCfg-->>VM: 返回默认 false
KVMHost->>KVMHost: 检测目标主机架构
alt 架构 == AArch64
KVMHost->>ResourceCfg: 按 VM UUID 读取 vm.pmu 资源级配置
ResourceCfg-->>KVMHost: 返回资源级值(若存在)
KVMHost->>KVMCmd: 设置 StartVmCmd.pmu = 资源级值或全局默认
else 其他架构(如 x86_64)
KVMHost->>KVMCmd: 保持 StartVmCmd.pmu 的默认行为(true/null)
end
KVMHost->>KVMCmd: 发送启动命令(包含 pmu)
KVMCmd-->>KVMHost: 命令已准备/响应
Estimated code review effort🎯 3 (中等) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.42.0)plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.javaComment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@test/src/test/groovy/org/zstack/test/integration/kvm/vm/VmPmuConfigCase.groovy`:
- Around line 138-140: The test only asserts PMU behavior for x86_64 (and null)
and misses an aarch64 branch; update VmPmuConfigCase.groovy to add an explicit
assertion for aarch64 by checking vm.architecture (e.g.,
"aarch64".equals(vm.architecture)) and assert startCmd.pmu == false with a clear
message like "aarch64 VM should have PMU disabled by default" next to the
existing x86_64/null check so the aarch64 regression is covered.
- Around line 180-182: The queryResourceConfig call that builds "conditions =
['name=${VmGlobalConfig.VM_PMU.name}', 'resourceUuid=${vm.uuid}']" is too broad
and may match same-named keys from other categories; update the conditions to
also include the correct category value (e.g., add
"category=${VmGlobalConfig.VM_PMU.category}" or the appropriate category string)
so the queryResourceConfig invocation filters by name, resourceUuid and category
for a precise assertion.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml (via .coderabbit.yaml)
Review profile: CHILL
Plan: Pro
Run ID: ea9fde7d-e3cf-45c5-8812-e507327bb723
📒 Files selected for processing (4)
compute/src/main/java/org/zstack/compute/vm/VmGlobalConfig.javaplugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.javaplugin/kvm/src/main/java/org/zstack/kvm/KVMHost.javatest/src/test/groovy/org/zstack/test/integration/kvm/vm/VmPmuConfigCase.groovy
test/src/test/groovy/org/zstack/test/integration/kvm/vm/VmPmuConfigCase.groovy
Show resolved
Hide resolved
test/src/test/groovy/org/zstack/test/integration/kvm/vm/VmPmuConfigCase.groovy
Show resolved
Hide resolved
On Kunpeng-920 V200 7270Z/5230Z, openEuler 24.03 guest kernel panics during boot because __armv8pmu_probe_pmu reads PMMIR_EL1 (PMUv3.4 register) which the host KVM (Kylin 4.19) does not handle, causing kvm_inject_undefined and guest kernel panic. Add vm.pmu GlobalConfig (ResourceConfig, VM/Cluster level) defaulting to false. On aarch64, read this config and set <pmu state='off'/> in domain XML. Users can re-enable via ResourceConfig if needed. Resolves: ZSTAC-76375 Change-Id: I6096bf5215fd4ff0b3170b9d299e38c6
32bb5fa to
6f83070
Compare
|
Comment from gitlab: 自上次添加REVIEWED标签(2026-03-31 17:55:58.000Z)后, 有新的COMMIT更新(2026-04-01 10:37:59.495Z), 所以移除了REVIEWED标签 |
On Kunpeng-920 V200 7270Z/5230Z, openEuler 24.03 guest kernel panics
during boot because __armv8pmu_probe_pmu reads PMMIR_EL1 (PMUv3.4
register) which the host KVM (Kylin 4.19) does not handle, causing
kvm_inject_undefined and guest kernel panic.
Add vm.pmu GlobalConfig (ResourceConfig, VM/Cluster level) defaulting
to false. On aarch64, read this config and set in
domain XML. Users can re-enable via ResourceConfig if needed.
Resolves: ZSTAC-76375
Change-Id: I6096bf5215fd4ff0b3170b9d299e38c6
sync from gitlab !9508