From: David Gibson <david@gibson.dropbear.id.au>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
Peter Maydell <peter.maydell@linaro.org>,
"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
QEMU Developers <qemu-devel@nongnu.org>,
Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH 3/3] ppc: include timebase in migration stream for g3beige/mac99 machines
Date: Mon, 1 Feb 2016 12:36:34 +1100 [thread overview]
Message-ID: <20160201013634.GB23043@voom.redhat.com> (raw)
In-Reply-To: <56AE6A20.1030809@ilande.co.uk>
[-- Attachment #1: Type: text/plain, Size: 3244 bytes --]
On Sun, Jan 31, 2016 at 08:10:08PM +0000, Mark Cave-Ayland wrote:
> On 31/01/16 19:58, Peter Maydell wrote:
>
> > On 31 January 2016 at 19:19, Mark Cave-Ayland
> > <mark.cave-ayland@ilande.co.uk> wrote:
> >> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> >> ---
> >> 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 = g_new(int, 1);
> >> hwaddr nvram_addr = 0xFFF04000;
> >> uint64_t tbfreq;
> >> + PPCTimebase *tb;
> >>
> >> linux_boot = (kernel_filename != 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 = g_malloc0(sizeof(PPCTimebase));
> >> + vmstate_register(NULL, -1, &vmstate_ppc_timebase, tb);
> >
> > Is there no way to avoid the vmstate_register here (ie to
> > tie the migration data to an actual device or CPU object) ?
>
> Not exactly that I know of - although I shamelessly borrowed this part
> from similar code in spapr which has this comment:
>
> /* 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 */
>
> 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.
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2016-02-01 1:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-31 19:19 [Qemu-devel] [PATCH 0/3] ppc: add timebase migration support to Mac machines Mark Cave-Ayland
2016-01-31 19:19 ` [Qemu-devel] [PATCH 1/3] ppc: fix timebase adjustment during migration Mark Cave-Ayland
2016-02-01 1:16 ` David Gibson
2016-01-31 19:19 ` [Qemu-devel] [PATCH 2/3] ppc: add support for timebase migration on non-PPC hosts Mark Cave-Ayland
2016-02-01 1:19 ` David Gibson
2016-01-31 19:19 ` [Qemu-devel] [PATCH 3/3] ppc: include timebase in migration stream for g3beige/mac99 machines Mark Cave-Ayland
2016-01-31 19:58 ` Peter Maydell
2016-01-31 20:10 ` Mark Cave-Ayland
2016-02-01 1:36 ` David Gibson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160201013634.GB23043@voom.redhat.com \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).