From patchwork Tue Feb 7 15:46:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 725223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3vHpyg3b6Gz9s4s for ; Wed, 8 Feb 2017 03:02:50 +1100 (AEDT) Received: from localhost ([::1]:55060 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cb8EC-0007ZN-0m for incoming@patchwork.ozlabs.org; Tue, 07 Feb 2017 11:02:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cb7yC-0000pi-WC for qemu-devel@nongnu.org; Tue, 07 Feb 2017 10:46:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cb7y9-0007x6-VQ for qemu-devel@nongnu.org; Tue, 07 Feb 2017 10:46:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48752) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cb7y9-0007vl-Ma; Tue, 07 Feb 2017 10:46:13 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 91F223A7693; Tue, 7 Feb 2017 15:46:12 +0000 (UTC) Received: from [10.36.117.226] (ovpn-117-226.ams2.redhat.com [10.36.117.226]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v17Fk8On013482; Tue, 7 Feb 2017 10:46:08 -0500 To: Mark Cave-Ayland , David Gibson , peter.maydell@linaro.org References: <20170202051445.5735-1-david@gibson.dropbear.id.au> <20170202051445.5735-96-david@gibson.dropbear.id.au> <922cc254-3d39-c21e-3ac6-7f8bd3b95d90@ilande.co.uk> <83f44e87-d1aa-3c9f-f383-e06717dfa54c@ilande.co.uk> <999b15a2-2388-4397-64f4-06875f7f6d92@redhat.com> <824f7332-4893-fa64-d61d-7cb9497e5371@ilande.co.uk> From: Laurent Vivier Message-ID: Date: Tue, 7 Feb 2017 16:46:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <824f7332-4893-fa64-d61d-7cb9497e5371@ilande.co.uk> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 07 Feb 2017 15:46:13 +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: Re: [Qemu-devel] [PULL 095/107] spapr: clock should count only if vm is running 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: thuth@redhat.com, qemu-devel@nongnu.org, aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, agraf@suse.de, qemu-ppc@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" On 02/02/2017 16:50, Mark Cave-Ayland wrote: > On 02/02/17 14:20, Laurent Vivier wrote: > >> I think adding the the PPCTimebase field and the VMSTATE_PPC_TIMEBASE_V >> macro to the PMac machines should fix your issue. >> >> Do you have a test case I can try? >> >> Laurent > > Hi Laurent, > > Yes I'd say that is required, although I still think you need to migrate > the decrementer value as per the comments on > https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg00546.html. > > Here's the reproducer from an off-list email I sent last year: > > 1) Download https://www.ilande.co.uk/tmp/darwin_empty.qcow2.xz and > decompress the image (it's a pre-partitioned empty Apple Partition Map disk) > > 2) Download https://opensource.apple.com/static/iso/darwinppc-602.cdr.gz > image, gunzip it and rename with .iso extension > > 3) Start QEMU using the attached "empty" disk like this: > > ./qemu-system-ppc -hda darwin_empty.qcow2 -cdrom darwinppc-602.iso -boot d > > 4) Start the installer in the guest and you'll see lots of files with > ASCII progress bars as the various files are copied to disk > > Then to see the problem with the progress bar, repeat the following: > > 5) Pause the VM > > 6) Issue "savevm foo" in the monitor > > 7) Exit QEMU > > 8) Start QEMU again as below: > > ./qemu-system-ppc -hda darwin_empty.qcow2 -cdrom darwinppc-602.iso -boot > d -loadvm foo > > If you do this enough times (maybe 10 or so?) you'll see the progress > bars stop working correctly and get out of sync, i.e. it will freeze for > long periods of time and then "jump" to catch-up but not all the way. > > With my above patch applied to include the decrementer in the migration, > the bug was no longer visible in my tests. Thank you for all these details. I've been able to reproduce the problem, and I think the proposition you did in: https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg01114.html is the good one: It's interesting because it doesn't break migration between different qemu releases as the register is already part of the migration stream. It was just not updated in the case of TCG (KVM is keeping it alive). And in case of KVM, calling cpu_ppc_load_decr()/cpu_ppc_store_decr() will not break anything as: - cpu_ppc_load_decr() returns "env->spr[SPR_DECR]", - cpu_ppc_store_decr() does nothing. Could you re-send this patch with your S-o-b, please? Thanks, Laurent diff --git a/target/ppc/machine.c b/target/ppc/machine.c index df9f7a4..1dc95b8 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -172,6 +172,7 @@ static void cpu_pre_save(void *opaque) env->spr[SPR_CFAR] = env->cfar; #endif env->spr[SPR_BOOKE_SPEFSCR] = env->spe_fscr; + env->spr[SPR_DECR] = cpu_ppc_load_decr(env); for (i = 0; (i < 4) && (i < env->nb_BATs); i++) { env->spr[SPR_DBAT0U + 2*i] = env->DBAT[0][i]; @@ -214,6 +215,7 @@ static int cpu_post_load(void *opaque, int version_id) env->cfar = env->spr[SPR_CFAR]; #endif env->spe_fscr = env->spr[SPR_BOOKE_SPEFSCR]; + cpu_ppc_store_decr(env, env->spr[SPR_DECR]); for (i = 0; (i < 4) && (i < env->nb_BATs); i++) { env->DBAT[0][i] = env->spr[SPR_DBAT0U + 2*i];