[Qemu-devel] [PATCH] pseries: fix TCG migration

Laurent Vivier posted 1 patch 6 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20171128173224.1138-1-lvivier@redhat.com
Test checkpatch passed
Test docker passed
Test ppc passed
Test s390x passed
There is a newer version of this series
hw/ppc/spapr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] pseries: fix TCG migration
Posted by Laurent Vivier 6 years, 4 months ago
Migration of pseries is broken with TCG because
QEMU tries to restore KVM MMU state unconditionally.

The result is a SIGSEGV in kvm_vm_ioctl():

    at qemu/accel/kvm/kvm-all.c:2032
    radix=<optimized out>, gtse=<optimized out>, proc_tbl=<optimized out>)
    at qemu/target/ppc/kvm.c:396
    version_id=<optimized out>) at /home/lvivier/qemu/hw/ppc/spapr.c:1578
    vmsd=0x1009479e0 <vmstate_spapr>, opaque=0x1019103c0,
    version_id=<optimized out>) at /home/lvivier/qemu/migration/vmstate.c:165
    at qemu/migration/savevm.c:748

This patch fixes the problem by not calling the KVM function with the
TCG mode.

Fixes: d39c90f5f3 ("spapr: Fix migration of Radix guests")
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 hw/ppc/spapr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 9efddeaee5..a471de6cab 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1570,7 +1570,7 @@ static int spapr_post_load(void *opaque, int version_id)
         err = spapr_rtc_import_offset(&spapr->rtc, spapr->rtc_offset);
     }
 
-    if (spapr->patb_entry) {
+    if (kvm_enabled() && spapr->patb_entry) {
         PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
         bool radix = !!(spapr->patb_entry & PATBE1_GR);
         bool gtse = !!(cpu->env.spr[SPR_LPCR] & LPCR_GTSE);
-- 
2.13.6


Re: [Qemu-devel] [PATCH] pseries: fix TCG migration
Posted by Laurent Vivier 6 years, 4 months ago
On 28/11/2017 18:32, Laurent Vivier wrote:
> Migration of pseries is broken with TCG because
> QEMU tries to restore KVM MMU state unconditionally.
> 
> The result is a SIGSEGV in kvm_vm_ioctl():
> 
>     at qemu/accel/kvm/kvm-all.c:2032
>     radix=<optimized out>, gtse=<optimized out>, proc_tbl=<optimized out>)
>     at qemu/target/ppc/kvm.c:396
>     version_id=<optimized out>) at /home/lvivier/qemu/hw/ppc/spapr.c:1578
>     vmsd=0x1009479e0 <vmstate_spapr>, opaque=0x1019103c0,
>     version_id=<optimized out>) at /home/lvivier/qemu/migration/vmstate.c:165
>     at qemu/migration/savevm.c:748
> 

I'm going to resend the patch because the lines starting with "#" have
been removed...

Thanks,
Laurent