qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: qemu-devel@nongnu.org
Cc: Mike Roth <mdroth@linux.vnet.ibm.com>,
	Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] migration: fix divide-by-zero introduced by sleep time accounting
Date: Thu, 16 May 2013 16:12:12 -0500	[thread overview]
Message-ID: <874ne2634j.fsf@codemonkey.ws> (raw)
In-Reply-To: <1368737994-15630-1-git-send-email-aliguori@us.ibm.com>

Anthony Liguori <aliguori@us.ibm.com> writes:

> If current_time == (initial_time + sleep_time), since
> sleep_time == BUFFER_DELAY, time_spent will be 0 resulting in a
> divide-by-zero when computing bandwidth.
>
> This was introduced by:
>
>   commit 7161082c8d8cf167c508976887a0a63f4db92b51
>   Author: Juan Quintela <quintela@redhat.com>
>   Date:   Fri Feb 1 12:41:38 2013 +0100
>
>       migration: don't account sleep time for calculating bandwidth
>
> Cc: Juan Quintela <quintela@redhat.com>
> Reported-by: Mike Roth <mdroth@linux.vnet.ibm.com>
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Nack

Mike reports that this breaks migration in a different way.  He's
sending a full revert of the offending commit.

Regards,

Anthony Liguori

> ---
>  migration.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/migration.c b/migration.c
> index 3eb0fad..70ae7a9 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -539,7 +539,7 @@ static void *migration_thread(void *opaque)
>              break;
>          }
>          current_time = qemu_get_clock_ms(rt_clock);
> -        if (current_time >= initial_time + BUFFER_DELAY) {
> +        if ((current_time - sleep_time) >= initial_time + BUFFER_DELAY) {
>              uint64_t transferred_bytes = qemu_ftell(s->file) - initial_bytes;
>              uint64_t time_spent = current_time - initial_time - sleep_time;
>              double bandwidth = transferred_bytes / time_spent;
> -- 
> 1.8.0

      reply	other threads:[~2013-05-16 21:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16 20:59 [Qemu-devel] [PATCH] migration: fix divide-by-zero introduced by sleep time accounting Anthony Liguori
2013-05-16 21:12 ` Anthony Liguori [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=874ne2634j.fsf@codemonkey.ws \
    --to=aliguori@us.ibm.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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).