From patchwork Thu Sep 22 11:07:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Nikunj A. Dadhania" X-Patchwork-Id: 9345033 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7CD5660757 for ; Thu, 22 Sep 2016 11:08:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FA602A99D for ; Thu, 22 Sep 2016 11:08:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6484C2A9A0; Thu, 22 Sep 2016 11:08:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 19ADF2A99D for ; Thu, 22 Sep 2016 11:08:31 +0000 (UTC) Received: from localhost ([::1]:38990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn1ri-0002cO-LL for patchwork-qemu-devel@patchwork.kernel.org; Thu, 22 Sep 2016 07:08:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn1rG-0002aH-Q2 for qemu-devel@nongnu.org; Thu, 22 Sep 2016 07:08:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bn1rC-0000NF-Pz for qemu-devel@nongnu.org; Thu, 22 Sep 2016 07:08:01 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59944 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn1rC-0000NA-KY for qemu-devel@nongnu.org; Thu, 22 Sep 2016 07:07:58 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8MB3ff5015689 for ; Thu, 22 Sep 2016 07:07:58 -0400 Received: from e23smtp02.au.ibm.com (e23smtp02.au.ibm.com [202.81.31.144]) by mx0a-001b2d01.pphosted.com with ESMTP id 25me2ggan9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 22 Sep 2016 07:07:57 -0400 Received: from localhost by e23smtp02.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 22 Sep 2016 21:07:54 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp02.au.ibm.com (202.81.31.208) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 22 Sep 2016 21:07:51 +1000 Received: from d23relay08.au.ibm.com (d23relay08.au.ibm.com [9.185.71.33]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 0727A2CE8046; Thu, 22 Sep 2016 21:07:51 +1000 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u8MB7oKk3080598; Thu, 22 Sep 2016 21:07:50 +1000 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u8MB7oR2029939; Thu, 22 Sep 2016 21:07:50 +1000 Received: from abhimanyu.vnet.linux.ibm.com (abhimanyu.in.ibm.com [9.124.35.51]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u8MB7iUg029852 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 22 Sep 2016 21:07:48 +1000 From: Nikunj A Dadhania To: Benjamin Herrenschmidt , bharata@linux.vnet.ibm.com, aik@ozlabs.ru In-Reply-To: <1474538671.2857.169.camel@kernel.crashing.org> References: <20160922052105.GD7915@in.ibm.com> <1474524441.2857.159.camel@kernel.crashing.org> <20160922061514.GF7915@in.ibm.com> <1474534046.2857.166.camel@kernel.crashing.org> <87d1jw5mr0.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> <1474538671.2857.169.camel@kernel.crashing.org> User-Agent: Notmuch/0.21 (https://notmuchmail.org) Emacs/25.0.94.1 (x86_64-redhat-linux-gnu) Date: Thu, 22 Sep 2016 16:37:43 +0530 MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16092211-0004-0000-0000-0000019DD774 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16092211-0005-0000-0000-000008BDC894 Message-Id: <8737ks5h1c.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-22_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609220205 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: Re: [Qemu-devel] pseries-2.6 migration from QEMU-2.6 to QEMU-2.7 broken 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: clg@kaod.org, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Benjamin Herrenschmidt writes: > On Thu, 2016-09-22 at 14:34 +0530, Nikunj A Dadhania wrote: >> Something like this works for KVM: >> >> diff --git a/target-ppc/machine.c b/target-ppc/machine.c >> index 4820f22..1cf3779 100644 >> --- a/target-ppc/machine.c >> +++ b/target-ppc/machine.c >> @@ -563,8 +563,8 @@ const VMStateDescription vmstate_ppc_cpu = { >>   >>          /* Sanity checking */ >>          VMSTATE_UINTTL_EQUAL(env.msr_mask, PowerPCCPU), >> -        VMSTATE_UINT64_EQUAL(env.insns_flags, PowerPCCPU), >> -        VMSTATE_UINT64_EQUAL(env.insns_flags2, PowerPCCPU), >> +        VMSTATE_UNUSED(sizeof(target_ulong)), /* was _EQUAL(env.insns_flags) */ >> +        VMSTATE_UNUSED(sizeof(target_ulong)), /* was _EQUAL(env.insns_flags2) */ >>          VMSTATE_UINT32_EQUAL(env.nb_BATs, PowerPCCPU), >>          VMSTATE_END_OF_LIST() >>      }, >> >> TCG migration still remains broken with this. > > Can we have conditionally present flags and a post-load that does some > matching ? I think its possible like this: TCG migration succeeds and proceeds ahead. But fails somewhere ahead in powerpc exception handler: [qemu]$ ./ppc64-softmmu/qemu-system-ppc64 -machine pseries-2.6,usb=off -vga none -nographic -m 2G ../../imgs/guest.disk -monitor pty --incoming tcp:localhost:4444 char device redirected to /dev/pts/5 (label compat_monitor0) ppc_kvm_enabled: is kvm enabled 0 get_insns_equal: Did not match, ignore 9223477658187168481 != 9223477658187151905 ppc_kvm_enabled: is kvm enabled 0 get_insns_equal: Did not match, ignore 331702 != 69558 Cannot open font file True Cannot open font file True qemu: fatal: Trying to deliver HV exception 4 with no HV support NIP c0000000000795c8 LR d00000000074407c CTR c000000000079544 XER 0000000000000000 CPU#0 MSR 8000000000009032 HID0 0000000000000000 HF 8000000000000030 iidx 1 didx 1 TB 00000007 32202510341 DECR 00596259 Regards, Nikunj diff --git a/target-ppc/machine.c b/target-ppc/machine.c index 4820f22..dc4704e 100644 --- a/target-ppc/machine.c +++ b/target-ppc/machine.c @@ -528,6 +528,42 @@ static const VMStateDescription vmstate_tlbmas = { } }; +static bool ppc_kvm_enabled(void *opaque, int version_id) +{ + printf("%s: is kvm enabled %d\n", __func__, kvm_enabled()); + return !kvm_enabled(); +} + +static int get_insns_equal(QEMUFile *f, void *pv, size_t size) +{ + uint64_t *v = pv; + uint64_t v2; + qemu_get_be64s(f, &v2); + + printf("%s: \n", __func__); + + if (*v == v2) { + return 0; + } + printf("Did not match, ignore %" PRIu64 " != %" PRIu64 "\n", *v, v2); + return 0; +} + +static void put_insns(QEMUFile *f, void *pv, size_t size) +{ + uint64_t *v = pv; + qemu_put_be64s(f, v); +} + +const VMStateInfo vmstate_info_insns_equal = { + .name = "insns equal", + .get = get_insns_equal, + .put = put_insns, +}; + +#define VMSTATE_INSNS_EQUAL(_f, _s, _t) \ + VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_insns_equal, uint64_t) + const VMStateDescription vmstate_ppc_cpu = { .name = "cpu", .version_id = 5, @@ -563,8 +599,8 @@ const VMStateDescription vmstate_ppc_cpu = { /* Sanity checking */ VMSTATE_UINTTL_EQUAL(env.msr_mask, PowerPCCPU), - VMSTATE_UINT64_EQUAL(env.insns_flags, PowerPCCPU), - VMSTATE_UINT64_EQUAL(env.insns_flags2, PowerPCCPU), + VMSTATE_INSNS_EQUAL(env.insns_flags, PowerPCCPU, ppc_kvm_enabled), + VMSTATE_INSNS_EQUAL(env.insns_flags2, PowerPCCPU, ppc_kvm_enabled), VMSTATE_UINT32_EQUAL(env.nb_BATs, PowerPCCPU), VMSTATE_END_OF_LIST() },