<fix>[kvm]: disable arm vm pmu by default#4420
Conversation
Backport PMU-off handling from ZSTAC-76375 to 5.4.10 for Kunpeng openEuler guest panic. Resolves: ZSTAC-86338 Change-Id: I3c2dbe1944c300a803f50198b4c7ba575bd77dcc
|
Warning
|
| Layer / File(s) | Summary |
|---|---|
全局配置与启动命令字段定义 compute/src/main/java/org/zstack/compute/vm/VmGlobalConfig.java, plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java |
VM_PMU 全局配置新增默认值 "false"、类型 Boolean 及说明;StartVmCmd 新增 pmu 字段(默认 true)及 isPmu/setPmu 方法。 |
KVMHost 中根据架构设置 PMU plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.java |
startVm 流程中针对 aarch64 架构读取 VM_PMU 资源配置并调用 cmd.setPmu 设置结果。 |
PMU 配置集成测试 test/src/test/groovy/org/zstack/test/integration/kvm/vm/VmPmuConfigCase.groovy |
新增测试用例验证全局配置默认值、x86 默认开启、aarch64 默认关闭以及资源级配置覆盖后重启生效的行为。 |
Estimated code review effort: 2 (Simple) | ~15 minutes
Sequence Diagram(s)
sequenceDiagram
participant KVMHost
participant VmGlobalConfig
participant StartVmCmd
participant KVMAgent
KVMHost->>KVMHost: 判断镜像架构是否为 aarch64
alt aarch64 架构
KVMHost->>VmGlobalConfig: 读取 VM_PMU 资源配置(vmUuid)
VmGlobalConfig-->>KVMHost: 返回 pmuEnabled
KVMHost->>StartVmCmd: setPmu(pmuEnabled)
end
KVMHost->>StartVmCmd: 设置其他启动参数(setAcpi 等)
KVMHost->>KVMAgent: 发送 StartVmCmd
Poem
小兔子敲代码到深夜,🐇
为鲲鹏芯片装上开关,
aarch64 静悄悄,PMU 默认关,
x86 依旧欢快转,
测试通过心欢喜,跳跳跳向前!
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | 标题准确概括了本次变更的核心:默认禁用 ARM/aarch64 虚机 PMU。 |
| Description check | ✅ Passed | 描述与变更一致,说明了 PMU 默认关闭、aarch64 透传、兼容性和测试覆盖。 |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✨ Finishing Touches
📝 Generate docstrings
- Create stacked PR
- Commit on current branch
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch
sync/zstackio/fix/5.4.10/ZSTAC-86338@@3
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.44.0)
compute/src/main/java/org/zstack/compute/vm/VmGlobalConfig.java
ast-grep exited with code unknown
plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java
ast-grep exited with code unknown
plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.java
ast-grep exited with code unknown
Comment @coderabbitai help to get the list of available commands.
Summary
Backport the PMU-off handling from ZSTAC-76375 to 5.4.10 for ZSTAC-86338.
Kunpeng-920 V200 7270Z/5230Z exposes PMUv3.4 PMMIR_EL1 to the guest. openEuler 24.03 / kernel 6.6 probes PMU during boot, while the reported Kylin 4.19 host KVM does not emulate the register, which can trigger a guest undefined-instruction panic and black console.
This MR:
vm.pmu, defaultfalse, with VM/Cluster resource bindingStartVmCmd.pmudefaulttruefor compatibilityvm.pmuand sends it to kvmagentTesting
git diff --cached --checkpassed before commitVmPmuConfigCaseLocal environment blockers:
mvn -f test/pom.xml -Dtest=org.zstack.test.integration.kvm.vm.VmPmuConfigCase test -DfailIfNoTests=falseis blocked by missing localorg.zstack:*:5.4.0artifactsmvn -DskipTests -pl compute,plugin/kvm -am compileis blocked before touched modules under local Java 17 by existing JAXB dependency inutilssync from gitlab !10382