From: David Gibson <david@gibson.dropbear.id.au>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: aik@ozlabs.ru, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH 1/3] ppc: fix timebase adjustment during migration
Date: Mon, 1 Feb 2016 12:16:20 +1100 [thread overview]
Message-ID: <20160201011620.GZ23043@voom.redhat.com> (raw)
In-Reply-To: <1454267976-27242-2-git-send-email-mark.cave-ayland@ilande.co.uk>
[-- Attachment #1: Type: text/plain, Size: 1805 bytes --]
On Sun, Jan 31, 2016 at 07:19:34PM +0000, Mark Cave-Ayland wrote:
> ns_diff is already clamped to a minimum of 0 to prevent the timebase going
> backwards during migration due to misaligned clocks. Following on from this
> migration_duration_tb is also subject to the same constraint; hence the
> expression MIN(0, migration_duration_tb) always evaluates to 0 and so no
> timebase adjustment ever takes place.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
So, there are actually two problems here, which could be expressed a
bit more clearly in the commit message.
First, this clamping is redundant, because of the earlier clamp on
ns_diff. Well.. probably.. I do wonder if we could get an overflow
anywhere giving us a negative number again.
More importantly, though, this is supposed to be a clamp below, which
needs a MAX. MIN is Just Plain Wrong.
> ---
> hw/ppc/ppc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
> index ce90b09..19f4570 100644
> --- a/hw/ppc/ppc.c
> +++ b/hw/ppc/ppc.c
> @@ -877,7 +877,7 @@ static int timebase_post_load(void *opaque, int version_id)
> migration_duration_ns = MIN(NANOSECONDS_PER_SECOND, ns_diff);
> migration_duration_tb = muldiv64(migration_duration_ns, freq,
> NANOSECONDS_PER_SECOND);
> - guest_tb = tb_remote->guest_timebase + MIN(0, migration_duration_tb);
> + guest_tb = tb_remote->guest_timebase + migration_duration_tb;
>
> tb_off_adj = guest_tb - cpu_get_host_ticks();
>
--
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 --]
next 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 [this message]
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
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=20160201011620.GZ23043@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=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).