qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] migration: fix xbzrle encoding rate calculation
@ 2020-06-08  0:53 Wei Wang
  2020-06-08 16:24 ` Richard Henderson
  2020-06-10 16:08 ` Richard Henderson
  0 siblings, 2 replies; 4+ messages in thread
From: Wei Wang @ 2020-06-08  0:53 UTC (permalink / raw)
  To: qemu-devel, dgilbert, richard.henderson; +Cc: yi.y.sun, wei.w.wang

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
Reported-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
---
 migration/ram.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/migration/ram.c b/migration/ram.c
index 41cc530..069b6e3 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.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] migration: fix xbzrle encoding rate calculation
  2020-06-08  0:53 [PATCH] migration: fix xbzrle encoding rate calculation Wei Wang
@ 2020-06-08 16:24 ` Richard Henderson
  2020-06-10 16:08 ` Richard Henderson
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2020-06-08 16:24 UTC (permalink / raw)
  To: Wei Wang, qemu-devel, dgilbert; +Cc: yi.y.sun

On 6/7/20 5:53 PM, Wei Wang wrote:
> 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
> Reported-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Wei Wang <wei.w.wang@intel.com>
> ---
>  migration/ram.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] migration: fix xbzrle encoding rate calculation
  2020-06-08  0:53 [PATCH] migration: fix xbzrle encoding rate calculation Wei Wang
  2020-06-08 16:24 ` Richard Henderson
@ 2020-06-10 16:08 ` Richard Henderson
  2020-06-10 19:07   ` Dr. David Alan Gilbert
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2020-06-10 16:08 UTC (permalink / raw)
  To: Wei Wang, qemu-devel, dgilbert; +Cc: yi.y.sun

On 6/7/20 5:53 PM, Wei Wang wrote:
> 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
> Reported-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Wei Wang <wei.w.wang@intel.com>
> ---
>  migration/ram.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Queuing to a clang 10 fixes branch.


r~


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] migration: fix xbzrle encoding rate calculation
  2020-06-10 16:08 ` Richard Henderson
@ 2020-06-10 19:07   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 4+ messages in thread
From: Dr. David Alan Gilbert @ 2020-06-10 19:07 UTC (permalink / raw)
  To: Richard Henderson; +Cc: yi.y.sun, Wei Wang, qemu-devel

* Richard Henderson (richard.henderson@linaro.org) wrote:
> On 6/7/20 5:53 PM, Wei Wang wrote:
> > 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
> > Reported-by: Richard Henderson <richard.henderson@linaro.org>
> > Signed-off-by: Wei Wang <wei.w.wang@intel.com>
> > ---
> >  migration/ram.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> Queuing to a clang 10 fixes branch.

Thanks

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Dave


> 
> 
> r~
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-10 19:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-08  0:53 [PATCH] migration: fix xbzrle encoding rate calculation Wei Wang
2020-06-08 16:24 ` Richard Henderson
2020-06-10 16:08 ` Richard Henderson
2020-06-10 19:07   ` Dr. David Alan Gilbert

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).