From nobody Fri May 3 06:59:39 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151189110139526.3671820486893; Tue, 28 Nov 2017 09:45:01 -0800 (PST) Received: from localhost ([::1]:39350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eJjw5-0002zy-Ew for importer@patchew.org; Tue, 28 Nov 2017 12:44:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eJjug-0002Ak-8w for qemu-devel@nongnu.org; Tue, 28 Nov 2017 12:43:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eJjue-0007Py-MQ for qemu-devel@nongnu.org; Tue, 28 Nov 2017 12:43:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58414) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eJjue-0007Pb-Fd; Tue, 28 Nov 2017 12:43:16 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 909AE85550; Tue, 28 Nov 2017 17:43:15 +0000 (UTC) Received: from thinkpad.redhat.com (unknown [10.40.205.77]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63424600D1; Tue, 28 Nov 2017 17:43:13 +0000 (UTC) From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 28 Nov 2017 18:43:10 +0100 Message-Id: <20171128174310.15700-1-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 28 Nov 2017 17:43:15 +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 v2] 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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(): #0 kvm_vm_ioctl (s=3D0x0, type=3D-2146390353) at qemu/accel/kvm/kvm-all.c:2032 #1 0x00000001003e3e2c in kvmppc_configure_v3_mmu (cpu=3D, radix=3D, gtse=3D, proc_tbl=3D) at qemu/target/ppc/kvm.c:396 #2 0x00000001002f8b88 in spapr_post_load (opaque=3D0x1019103c0, version_id=3D) at qemu/hw/ppc/spapr.c:1578 #3 0x000000010059e4cc in vmstate_load_state (f=3D0x106230000, vmsd=3D0x1009479e0 , opaque=3D0x1019103c0, version_id=3D) at qemu/migration/vmstate.c:165 #4 0x00000001005987e0 in vmstate_load (f=3D, se=3D) 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 Reviewed-by: Daniel Henrique Barboza Reviewed-by: Suraj Jitindar Singh --- v2: fix the comment to keep GDB backtrace lines starting with '#' 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 =3D spapr_rtc_import_offset(&spapr->rtc, spapr->rtc_offset); } =20 - if (spapr->patb_entry) { + if (kvm_enabled() && spapr->patb_entry) { PowerPCCPU *cpu =3D POWERPC_CPU(first_cpu); bool radix =3D !!(spapr->patb_entry & PATBE1_GR); bool gtse =3D !!(cpu->env.spr[SPR_LPCR] & LPCR_GTSE); --=20 2.13.6