qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: Wei Wang <wei.w.wang@intel.com>,
	alex.bennee@linaro.org,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>
Subject: [PATCH v3 2/5] migration: fix xbzrle encoding rate calculation
Date: Tue, 16 Jun 2020 21:37:54 -0700	[thread overview]
Message-ID: <20200617043757.1623337-3-richard.henderson@linaro.org> (raw)
In-Reply-To: <20200617043757.1623337-1-richard.henderson@linaro.org>

From: Wei Wang <wei.w.wang@intel.com>

It's reported an error of implicit conversion from "unsigned long" to
"double" when compiling with Clang 10. Simply make the encoding rate 0
when the encoded_size is 0.

Fixes: e460a4b1a4
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reported-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 migration/ram.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/migration/ram.c b/migration/ram.c
index 41cc530d9d..069b6e30bc 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -913,10 +913,8 @@ static void migration_update_rates(RAMState *rs, int64_t end_time)
         unencoded_size = (xbzrle_counters.pages - rs->xbzrle_pages_prev) *
                          TARGET_PAGE_SIZE;
         encoded_size = xbzrle_counters.bytes - rs->xbzrle_bytes_prev;
-        if (xbzrle_counters.pages == rs->xbzrle_pages_prev) {
+        if (xbzrle_counters.pages == rs->xbzrle_pages_prev || !encoded_size) {
             xbzrle_counters.encoding_rate = 0;
-        } else if (!encoded_size) {
-            xbzrle_counters.encoding_rate = UINT64_MAX;
         } else {
             xbzrle_counters.encoding_rate = unencoded_size / encoded_size;
         }
-- 
2.25.1



  parent reply	other threads:[~2020-06-17  4:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17  4:37 [PATCH v3 0/5] Vs clang-10 and gcc-9 warnings Richard Henderson
2020-06-17  4:37 ` [PATCH v3 1/5] fpu/softfloat: Silence 'bitwise negation of boolean expression' warning Richard Henderson
2020-06-17 10:37   ` Alex Bennée
2020-06-17  4:37 ` Richard Henderson [this message]
2020-06-17 10:25   ` [PATCH v3 2/5] migration: fix xbzrle encoding rate calculation Philippe Mathieu-Daudé
2020-06-17 10:54   ` Alex Bennée
2020-06-17  4:37 ` [PATCH v3 3/5] configure: Clean up warning flag lists Richard Henderson
2020-06-17  7:11   ` Philippe Mathieu-Daudé
2020-06-17 10:56   ` Alex Bennée
2020-06-17  4:37 ` [PATCH v3 4/5] configure: Disable -Wtautological-type-limit-compare Richard Henderson
2020-06-17  4:37 ` [PATCH v3 5/5] configure: Add -Wno-psabi Richard Henderson
2020-06-17  6:50   ` Philippe Mathieu-Daudé
2020-06-17  7:10     ` Philippe Mathieu-Daudé
2020-06-17 11:02   ` Alex Bennée
2020-06-17  5:15 ` [PATCH v3 0/5] Vs clang-10 and gcc-9 warnings no-reply

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=20200617043757.1623337-3-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wei.w.wang@intel.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).