Re: [PATCH 1/2] LoongArch: KVM: Fix PC double advance in kernel MMIO read fast path
From: Kaiyang Wu
Date: Wed Sep 02 2026 - 06:20:10 EST
On 2026-07-23 19:15, Zeng Chi wrote:
In the in-kernel MMIO read fast path of kvm_emu_mmio_read(),
kvm_complete_mmio_read() already advances the guest PC via update_pc().
The explicit update_pc() call right after it advances the PC a second
time, so PC moves forward by 8 instead of 4 and the instruction
following the MMIO read is silently skipped.
The user space MMIO read completion path in kvm_arch_vcpu_ioctl_run()
calls kvm_complete_mmio_read() only once, and the MMIO write fast path
advances the PC exactly once as well.
Remove the redundant update_pc() so the kernel MMIO read fast path
advances the PC by a single instruction.
Hi Zeng,
I have tested the patch on Proxmox VE with the environment below:
- CPU: Loongson 3C6000/D
- OS: Proxmox VE 9.2.11 (LoongArch port https://github.com/pve-loong64-port)
- Kernel: 7.0.14-15-pve
- Guest OS: Kylin Linux Advanced Server V10 (SP3 2403)
- Guest Kernel: 4.19.90-89.45.v2401.a.ky10.loongarch64
Without the patch, the guest system could not boot with the 4.19.90-89.45.v2401.a.ky10.loongarch64 kernel and there was no output in neither tty nor serial. I can confirm the system boots from the same kernel version with the patch applied to the host kernel.
Best,
Kaiyang