From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQ3PA-0005kG-H7 for qemu-devel@nongnu.org; Sun, 31 Jan 2016 20:35:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQ3P6-0001br-Ee for qemu-devel@nongnu.org; Sun, 31 Jan 2016 20:35:48 -0500 Date: Mon, 1 Feb 2016 12:36:34 +1100 From: David Gibson Message-ID: <20160201013634.GB23043@voom.redhat.com> References: <1454267976-27242-1-git-send-email-mark.cave-ayland@ilande.co.uk> <1454267976-27242-4-git-send-email-mark.cave-ayland@ilande.co.uk> <56AE6A20.1030809@ilande.co.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0B3PZ1+h5f4cFxHi" Content-Disposition: inline In-Reply-To: <56AE6A20.1030809@ilande.co.uk> Subject: Re: [Qemu-devel] [PATCH 3/3] ppc: include timebase in migration stream for g3beige/mac99 machines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mark Cave-Ayland Cc: Alexey Kardashevskiy , Peter Maydell , "qemu-ppc@nongnu.org" , QEMU Developers , Alexander Graf --0B3PZ1+h5f4cFxHi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jan 31, 2016 at 08:10:08PM +0000, Mark Cave-Ayland wrote: > On 31/01/16 19:58, Peter Maydell wrote: >=20 > > On 31 January 2016 at 19:19, Mark Cave-Ayland > > wrote: > >> Signed-off-by: Mark Cave-Ayland > >> --- > >> hw/ppc/mac_newworld.c | 4 ++++ > >> hw/ppc/mac_oldworld.c | 4 ++++ > >> 2 files changed, 8 insertions(+) > >> > >> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c > >> index f95086b..3283f1d 100644 > >> --- a/hw/ppc/mac_newworld.c > >> +++ b/hw/ppc/mac_newworld.c > >> @@ -179,6 +179,7 @@ static void ppc_core99_init(MachineState *machine) > >> int *token =3D g_new(int, 1); > >> hwaddr nvram_addr =3D 0xFFF04000; > >> uint64_t tbfreq; > >> + PPCTimebase *tb; > >> > >> linux_boot =3D (kernel_filename !=3D NULL); > >> > >> @@ -201,6 +202,9 @@ static void ppc_core99_init(MachineState *machine) > >> /* Set time-base frequency to 100 Mhz */ > >> cpu_ppc_tb_init(env, TBFREQ); > >> qemu_register_reset(ppc_core99_reset, cpu); > >> + > >> + tb =3D g_malloc0(sizeof(PPCTimebase)); > >> + vmstate_register(NULL, -1, &vmstate_ppc_timebase, tb); > >=20 > > Is there no way to avoid the vmstate_register here (ie to > > tie the migration data to an actual device or CPU object) ? >=20 > Not exactly that I know of - although I shamelessly borrowed this part > from similar code in spapr which has this comment: >=20 > /* FIXME: Should register things through the MachineState's qdev > * interface, this is a legacy from the sPAPREnvironment structure > * which predated MachineState but had a similar function */ >=20 > Is this something that is now possible? Well, it's certainly possible to do better than this. You want to make a vmstate_g3beige and vmstate_mac99 which contain all the machine level things to migrate for these machines, similar to vmstate_spapr. They will be attached to the MachineState object. That will at least mean that if more things need to get added to migration for these machines, then additional vmstate_register() calls won't be needed. I'm not sure if there's a better way to register a vmstate for a machine type. I thought there was, but I couldn't spot it in a quick lock. Peter, I believe this does need to be attached to the machine, not to the cpu, even though the cpu would seem to make more sense on a first look. The reason is that attaching it to the cpu means it will be transferred separately for each cpu, and unless we're super-careful about timing the destination cpus could end up with slightly different values. That would be bad, because ppc has a pretty strong requirement that the timebases be synchronized across all cpus in an smp system. The means of initially accomplishing that vary by platform - usually there's some board level register to freeze / resume all the timebases - but however it's been done, we don't want to mess it up on migration. --=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 --0B3PZ1+h5f4cFxHi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWrraiAAoJEGw4ysog2bOSeZAQAK1u97dm9Z5EN1qwuSi2ETn4 NaxMMJ5ApYiP4AwLkTO1s5fVbprRoLZ7CaXBRhuxJ2oh0YFYgDwFydtVHfQK736s hfAcDPM/3EJdabcrJ0hJ1Wul71RjFNjCYcsqmsZ0QxpjDnd4ZhgbrzCEaTi1gtb6 w9n75JXfz7hVx9fHrf422C+37hGvZ2AvguA7C8oAz0Kx9mf3rDflwwWifDDPqkdH u5gqQaR5iJHFBUPgyRpbbb0U/V2M8kl9omCBmRcrg43JvioQaYPuvYmc2WBX3Tcw 1CXSujfRs0lOdXP9cNJpt9vU2F2wXKeS4xy2vExEmA2jtx9acXBI+DFcDY+nE2b1 6Xv6BxYmBnZCO4WmNbcYMgyVn/pueBmDwc9VSp8MtPMcHg51kKtWrnVXKVDO3+Wn LvMF86ccvz5GRi0G2BPv7eq8moC96vHqQsNUQqGZ3IKluqyhxcFV0qtA+vMBYDUR uCR9SYUQFKCliW5TJcEDhfLhI0XT5cQxPMmKRclvFcjRkGrtR9mk91rH9tk0qudU 0k910QlGjI5qZU4eBtlqpiEOM6AXy10gVZSCdBTSe7WaK2F6hoNJjXm5s9J0lSuc wC69MLNlJZSqajQCtMrmnPpXmRgE2lD7KWJ9hFN0h1fWjNHcuE/1//iJkl/muKD4 2CZHa8wYUO6j1OlR6khF =WaPd -----END PGP SIGNATURE----- --0B3PZ1+h5f4cFxHi--