From: Zhenzhong Duan Date: Sun, 28 Sep 2025 08:54:31 +0000 (-0400) Subject: accel/kvm: Fix an erroneous check on coalesced_mmio_ring X-Git-Tag: v10.2.0-rc1~50^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=725ec898039dfed0a669bf78b556529b51e248e8;p=thirdparty%2Fqemu.git accel/kvm: Fix an erroneous check on coalesced_mmio_ring According to KVM uAPI, coalesced mmio page is KVM_COALESCED_MMIO_PAGE_OFFSET offset from kvm_run pages. For x86 it's 2 pages offset, for arm it's 1 page offset currently. We shouldn't presume it's hardcoded 1 page or else coalesced_mmio_ring will not be cleared in do_kvm_destroy_vcpu() in x86. Fixes: 7ed0919119b0 ("migration: close kvm after cpr") Cc: Markus Armbruster Signed-off-by: Zhenzhong Duan Reviewed-by: Steve Sistare Link: https://lore.kernel.org/qemu-devel/20250928085432.40107-6-zhenzhong.duan@intel.com Signed-off-by: Cédric Le Goater --- diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 56031925c4..f9254ae654 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -525,7 +525,8 @@ static int do_kvm_destroy_vcpu(CPUState *cpu) } /* If I am the CPU that created coalesced_mmio_ring, then discard it */ - if (s->coalesced_mmio_ring == (void *)cpu->kvm_run + PAGE_SIZE) { + if (s->coalesced_mmio_ring == + (void *)cpu->kvm_run + s->coalesced_mmio * PAGE_SIZE) { s->coalesced_mmio_ring = NULL; }