Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Tao Cui <cui.tao@linux.dev>
To: Kaiyang Wu <wukaiyang@loongfans.cn>,
	Zeng Chi <zeng_chi911@163.com>,
	zhaotianrui@loongson.cn, maobibo@loongson.cn,
	chenhuacai@kernel.org, kernel@xen0n.name
Cc: cui.tao@linux.dev, kvm@vger.kernel.org,
	loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
	zengchi@kylinos.cn, stable@vger.kernel.org
Subject: Re: [PATCH 1/2] LoongArch: KVM: Fix PC double advance in kernel MMIO read fast path
Date: Wed, 2 Sep 2026 20:21:35 +0800	[thread overview]
Message-ID: <5e86d83a-425f-43d9-91d3-06821ec670ae@linux.dev> (raw)
In-Reply-To: <D7B309C007238053+3831de19-a2c3-4f17-9281-e4e355c6c464@loongfans.cn>

Hi, Kaiyang

在 2026/9/2 18:12, Kaiyang Wu 写道:
> 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.
> 

Thank you for the testing, this is really helpful.

Our test setup is a bit different: we were running a 7.x kernel on
both the host and the guest, and we confirmed the issue by observing
that the PC advanced by the wrong step after an MMIO read.

Your result is a nice complement to ours — it suggests the same issue
may also explain the boot failure of a 4.19 guest on a 7.x host. We
had been debugging this boot failure for a while without finding the
root cause, and had assumed it was some kind of version
incompatibility. Your testing gives us a good lead to look into.

Thanks again for sharing your results.

--
Tao> Best,
> Kaiyang


      reply	other threads:[~2026-09-02 12:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260723111552.1623996-1-zeng_chi911@163.com>
2026-07-24  1:23 ` [PATCH 1/2] LoongArch: KVM: Fix PC double advance in kernel MMIO read fast path Bibo Mao
2026-07-25  3:38 ` Tao Cui
2026-08-02 12:00   ` Huacai Chen
2026-09-02 10:12 ` Kaiyang Wu
2026-09-02 12:21   ` Tao Cui [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e86d83a-425f-43d9-91d3-06821ec670ae@linux.dev \
    --to=cui.tao@linux.dev \
    --cc=chenhuacai@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=maobibo@loongson.cn \
    --cc=stable@vger.kernel.org \
    --cc=wukaiyang@loongfans.cn \
    --cc=zeng_chi911@163.com \
    --cc=zengchi@kylinos.cn \
    --cc=zhaotianrui@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox