From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqyh5-0002cA-KH for qemu-devel@nongnu.org; Fri, 15 Apr 2016 04:01:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aqygz-0001ez-Nh for qemu-devel@nongnu.org; Fri, 15 Apr 2016 04:01:35 -0400 Date: Fri, 15 Apr 2016 15:27:04 +1000 From: David Gibson Message-ID: <20160415052704.GO18218@voom.redhat.com> References: <1460042594-8056-1-git-send-email-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="keoAwTxaagou87Dg" Content-Disposition: inline In-Reply-To: <1460042594-8056-1-git-send-email-mark.cave-ayland@ilande.co.uk> Subject: Re: [Qemu-devel] [RFC 0/4] target-ppc: handle KVM timebase migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mark Cave-Ayland Cc: aik@ozlabs.ru, agraf@suse.de, qemu-ppc@nongnu.org, qemu-devel@nongnu.org --keoAwTxaagou87Dg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 07, 2016 at 04:23:10PM +0100, Mark Cave-Ayland wrote: > This RFC series follows on from discussions in the "Migrating decrementer" > thread relating to handling migration of the timebase and decrementer > registers for both TCG and KVM. The aim is to provide a consistent virtual > clock when migrating PPC machines TCG-TCG (already handled) and > KVM-KVM with both paused and live VMs in a unified manner for all PPC > machine types. >=20 > The existing code to handle timebase migration on PPC has a few issues: >=20 > 1) It uses cpu_get_host_ticks() which doesn't work correctly on TCG with > different host architectures Yeah, that's just wrong. We should be using qemu_clock_get_ns() instead. > 2) tb_offset is calculated from the difference in the host clock between > source and destination. Thus if the guest is paused then the resulting > offset is calculated incorrectly since the host clock still runs, regardl= ess > of the state of the virtual clock. >=20 > 3) Due to a typo in the existing implementation (MIN instead of MAX) then > guest_tb never takes migration_duration_tb into account The statement above is not correct. The problem is not MIN vs. MAX. The problem is that it was assuming a 1s limit on downtime during migration which is Just Plain Wrong - especialy in the case where it's actually a savevm / restore rather than a live migration. Having a long downtime shouldn't break the guest's timebase sync with realtime. > Patches 1-2 introduce a new PPCMachineClass and derive all the PPC machine > classes from it, not dissimilar to x86's PCMachineClass. >=20 > Patch 3 adds a VM state change hook into PCMachineClass and updates the > tb_offset from the host when the machine (re)starts as discussed in the > thread. Note that it may be possible to add the hook to specific machine > types, however using PPCMachineClass allows all PPC machines to pick up > this functionality automatically. >=20 > Patch 4 temporarily disables the existing timebase migration code to allow > testing. >=20 > Note that this has only been compile-tested on x86 as I have no KVM PPC > hardware and so it's really an RFC to determine whether this approach can > work, and to invite testing and discussion from existing KVM PPC users. >=20 > Signed-off-by: Mark Cave-Ayland >=20 >=20 > Mark Cave-Ayland (4): > target-ppc: introduce PPCMachineClass and PPCMachineState > target-ppc: derive all PPC machine classes to have PPCMachineClass as > their superclass > target-ppc: synchronise tb_offset with KVM host on machine start > target-ppc: hack to remove existing timebase migration code for > testing >=20 > hw/ppc/e500plat.c | 7 +++- > hw/ppc/mac_newworld.c | 17 ++------ > hw/ppc/mac_oldworld.c | 6 ++- > hw/ppc/mpc8544ds.c | 7 +++- > hw/ppc/ppc.c | 100 +++++++++++++++++++++++++++++------------= ------ > hw/ppc/ppc405_boards.c | 28 +++---------- > hw/ppc/ppc440_bamboo.c | 6 ++- > hw/ppc/prep.c | 6 ++- > hw/ppc/spapr.c | 2 +- > hw/ppc/virtex_ml507.c | 6 ++- > include/hw/ppc/ppc.h | 35 +++++++++++++++++ > include/qemu/typedefs.h | 2 + > 12 files changed, 135 insertions(+), 87 deletions(-) >=20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --keoAwTxaagou87Dg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXEHunAAoJEGw4ysog2bOSbi0P/2mHLw1jITuIVVn913HwbR2S GV4wmtCMwlvFShOmjiEN/e/PX5GgRsPyyWRJ/kpcDJTg8YywinFz0kPDFT61jnQR OL/F+0LW4YOnvE5KgH+WxmB1AxhK06BGFukE57QxS/NknrzNLwhzfPypn3DPIPNf GN/tYMYmcaf3WPK2YDiD3wIE3FB9iNyrh2a1IxVaVRWzIjse98z2VfYjcRasj5w+ Dtu7n0X5shxH6y0FYvtWiXYIA0Jy5mNhOQ1gcHtHNdabxQdhaG6M1a3k1B2yNKcd BKYrtkpINqAHY22hQmmEKTJXKh7CZexOfJ6Fxp/M1YESIj/a7sEBaNXrs2cONNth wijX0J4Z+wTB7kNHufQm5fUBURIu7Jfqg18WdM4o+JyqiOFsw0La9AxRV8v0ce8W aqS6X7kehu8qkErlQzFnchNkUQ8zhNohoLM/kaxoct6BF7xWoQRBUUfSiat9PuT3 GXBWNPRdCjtxEurQ61P7VOp10KGO8ook9ub2pR4GjHJk+yUOe3wN7701hzeKqYu/ hBtjI1s+LVZvpP/RAXruLVRPENboQPFcybMwtFEw/C2P8vuHEDy7i8LG6fePWtWy HK/yx6OvXkSYz3/Cq9aOYIBzfK+ZxlHE0Kjrz6ZzOujQ1TmpHVYkyrU/oFA11jEF qXKpp55+DXHeQZZIZSnX =8rz2 -----END PGP SIGNATURE----- --keoAwTxaagou87Dg--