From patchwork Tue Nov 28 17:32:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 842238 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ymW474s27z9s7f for ; Wed, 29 Nov 2017 04:33:59 +1100 (AEDT) Received: from localhost ([::1]:39288 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eJjld-0003Rb-P4 for incoming@patchwork.ozlabs.org; Tue, 28 Nov 2017 12:33:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eJjkb-00031r-J8 for qemu-devel@nongnu.org; Tue, 28 Nov 2017 12:32:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eJjkW-0001rJ-7D for qemu-devel@nongnu.org; Tue, 28 Nov 2017 12:32:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33354) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eJjkV-0001oH-Op; Tue, 28 Nov 2017 12:32:47 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C25B2C0587E6; Tue, 28 Nov 2017 17:32:45 +0000 (UTC) Received: from thinkpad.redhat.com (unknown [10.40.205.77]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A1FB5D75A; Tue, 28 Nov 2017 17:32:43 +0000 (UTC) From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 28 Nov 2017 18:32:24 +0100 Message-Id: <20171128173224.1138-1-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 28 Nov 2017 17:32:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] pseries: fix TCG migration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Daniel Henrique Barboza , Bharata B Rao , qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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=, gtse=, proc_tbl=) at qemu/target/ppc/kvm.c:396 version_id=) at /home/lvivier/qemu/hw/ppc/spapr.c:1578 vmsd=0x1009479e0 , opaque=0x1019103c0, version_id=) 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 --- 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);