From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:32995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud5TV-0002Ry-2s for qemu-devel@nongnu.org; Thu, 16 May 2013 17:12:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ud5TQ-0000uk-Gl for qemu-devel@nongnu.org; Thu, 16 May 2013 17:12:33 -0400 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:35921) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud5TP-0000uX-Ti for qemu-devel@nongnu.org; Thu, 16 May 2013 17:12:28 -0400 Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 17 May 2013 07:05:58 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id D76212BB0050 for ; Fri, 17 May 2013 07:12:17 +1000 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r4GKwEh822347848 for ; Fri, 17 May 2013 06:58:16 +1000 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r4GLCGtD016348 for ; Fri, 17 May 2013 07:12:16 +1000 From: Anthony Liguori In-Reply-To: <1368737994-15630-1-git-send-email-aliguori@us.ibm.com> References: <1368737994-15630-1-git-send-email-aliguori@us.ibm.com> Date: Thu, 16 May 2013 16:12:12 -0500 Message-ID: <874ne2634j.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH] migration: fix divide-by-zero introduced by sleep time accounting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Mike Roth , Juan Quintela Anthony Liguori 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 > Date: Fri Feb 1 12:41:38 2013 +0100 > > migration: don't account sleep time for calculating bandwidth > > Cc: Juan Quintela > Reported-by: Mike Roth > Signed-off-by: Anthony Liguori 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