thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
0727d3
From b21f18afceba8231c78d29e66f58516e12c28d22 Mon Sep 17 00:00:00 2001
0727d3
From: Juan Quintela <quintela@redhat.com>
0727d3
Date: Wed, 18 May 2022 02:52:23 -0300
0727d3
Subject: [PATCH 10/37] migration: All this fields are unsigned
0727d3
MIME-Version: 1.0
0727d3
Content-Type: text/plain; charset=UTF-8
0727d3
Content-Transfer-Encoding: 8bit
0727d3
0727d3
RH-Author: Leonardo Brás <leobras@redhat.com>
0727d3
RH-MergeRequest: 191: MSG_ZEROCOPY + Multifd @ rhel8.7
0727d3
RH-Commit: [10/26] 2c3ee27aae334db3b283ab7ef580f58e396e569d
0727d3
RH-Bugzilla: 2072049
0727d3
RH-Acked-by: Peter Xu <peterx@redhat.com>
0727d3
RH-Acked-by: Daniel P. Berrangé <berrange@redhat.com>
0727d3
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
0727d3
0727d3
So printing it as %d is wrong.  Notice that for the channel id, that
0727d3
is an uint8_t, but I changed it anyways for consistency.
0727d3
0727d3
Signed-off-by: Juan Quintela <quintela@redhat.com>
0727d3
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
0727d3
Reviewed-by: Peter Xu <peterx@redhat.com>
0727d3
(cherry picked from commit 04e114049406dbb69fc9043c795ddd28fdba31a6)
0727d3
Signed-off-by: Leonardo Bras <leobras@redhat.com>
0727d3
---
0727d3
 migration/multifd-zlib.c | 20 ++++++++++----------
0727d3
 migration/multifd-zstd.c | 24 ++++++++++++------------
0727d3
 migration/multifd.c      | 16 ++++++++--------
0727d3
 migration/trace-events   | 26 +++++++++++++-------------
0727d3
 4 files changed, 43 insertions(+), 43 deletions(-)
0727d3
0727d3
diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c
0727d3
index a1950a4588..a987e4a26c 100644
0727d3
--- a/migration/multifd-zlib.c
0727d3
+++ b/migration/multifd-zlib.c
0727d3
@@ -52,7 +52,7 @@ static int zlib_send_setup(MultiFDSendParams *p, Error **errp)
0727d3
     zs->opaque = Z_NULL;
0727d3
     if (deflateInit(zs, migrate_multifd_zlib_level()) != Z_OK) {
0727d3
         g_free(z);
0727d3
-        error_setg(errp, "multifd %d: deflate init failed", p->id);
0727d3
+        error_setg(errp, "multifd %u: deflate init failed", p->id);
0727d3
         return -1;
0727d3
     }
0727d3
     /* We will never have more than page_count pages */
0727d3
@@ -62,7 +62,7 @@ static int zlib_send_setup(MultiFDSendParams *p, Error **errp)
0727d3
     if (!z->zbuff) {
0727d3
         deflateEnd(&z->zs);
0727d3
         g_free(z);
0727d3
-        error_setg(errp, "multifd %d: out of memory for zbuff", p->id);
0727d3
+        error_setg(errp, "multifd %u: out of memory for zbuff", p->id);
0727d3
         return -1;
0727d3
     }
0727d3
     p->data = z;
0727d3
@@ -134,12 +134,12 @@ static int zlib_send_prepare(MultiFDSendParams *p, Error **errp)
0727d3
             ret = deflate(zs, flush);
0727d3
         } while (ret == Z_OK && zs->avail_in && zs->avail_out);
0727d3
         if (ret == Z_OK && zs->avail_in) {
0727d3
-            error_setg(errp, "multifd %d: deflate failed to compress all input",
0727d3
+            error_setg(errp, "multifd %u: deflate failed to compress all input",
0727d3
                        p->id);
0727d3
             return -1;
0727d3
         }
0727d3
         if (ret != Z_OK) {
0727d3
-            error_setg(errp, "multifd %d: deflate returned %d instead of Z_OK",
0727d3
+            error_setg(errp, "multifd %u: deflate returned %d instead of Z_OK",
0727d3
                        p->id, ret);
0727d3
             return -1;
0727d3
         }
0727d3
@@ -193,7 +193,7 @@ static int zlib_recv_setup(MultiFDRecvParams *p, Error **errp)
0727d3
     zs->avail_in = 0;
0727d3
     zs->next_in = Z_NULL;
0727d3
     if (inflateInit(zs) != Z_OK) {
0727d3
-        error_setg(errp, "multifd %d: inflate init failed", p->id);
0727d3
+        error_setg(errp, "multifd %u: inflate init failed", p->id);
0727d3
         return -1;
0727d3
     }
0727d3
     /* We will never have more than page_count pages */
0727d3
@@ -203,7 +203,7 @@ static int zlib_recv_setup(MultiFDRecvParams *p, Error **errp)
0727d3
     z->zbuff = g_try_malloc(z->zbuff_len);
0727d3
     if (!z->zbuff) {
0727d3
         inflateEnd(zs);
0727d3
-        error_setg(errp, "multifd %d: out of memory for zbuff", p->id);
0727d3
+        error_setg(errp, "multifd %u: out of memory for zbuff", p->id);
0727d3
         return -1;
0727d3
     }
0727d3
     return 0;
0727d3
@@ -252,7 +252,7 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp)
0727d3
     int i;
0727d3
 
0727d3
     if (flags != MULTIFD_FLAG_ZLIB) {
0727d3
-        error_setg(errp, "multifd %d: flags received %x flags expected %x",
0727d3
+        error_setg(errp, "multifd %u: flags received %x flags expected %x",
0727d3
                    p->id, flags, MULTIFD_FLAG_ZLIB);
0727d3
         return -1;
0727d3
     }
0727d3
@@ -289,19 +289,19 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp)
0727d3
         } while (ret == Z_OK && zs->avail_in
0727d3
                              && (zs->total_out - start) < page_size);
0727d3
         if (ret == Z_OK && (zs->total_out - start) < page_size) {
0727d3
-            error_setg(errp, "multifd %d: inflate generated too few output",
0727d3
+            error_setg(errp, "multifd %u: inflate generated too few output",
0727d3
                        p->id);
0727d3
             return -1;
0727d3
         }
0727d3
         if (ret != Z_OK) {
0727d3
-            error_setg(errp, "multifd %d: inflate returned %d instead of Z_OK",
0727d3
+            error_setg(errp, "multifd %u: inflate returned %d instead of Z_OK",
0727d3
                        p->id, ret);
0727d3
             return -1;
0727d3
         }
0727d3
     }
0727d3
     out_size = zs->total_out - out_size;
0727d3
     if (out_size != expected_size) {
0727d3
-        error_setg(errp, "multifd %d: packet size received %d size expected %d",
0727d3
+        error_setg(errp, "multifd %u: packet size received %u size expected %u",
0727d3
                    p->id, out_size, expected_size);
0727d3
         return -1;
0727d3
     }
0727d3
diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c
0727d3
index d9ed42622b..2185a83eac 100644
0727d3
--- a/migration/multifd-zstd.c
0727d3
+++ b/migration/multifd-zstd.c
0727d3
@@ -56,7 +56,7 @@ static int zstd_send_setup(MultiFDSendParams *p, Error **errp)
0727d3
     z->zcs = ZSTD_createCStream();
0727d3
     if (!z->zcs) {
0727d3
         g_free(z);
0727d3
-        error_setg(errp, "multifd %d: zstd createCStream failed", p->id);
0727d3
+        error_setg(errp, "multifd %u: zstd createCStream failed", p->id);
0727d3
         return -1;
0727d3
     }
0727d3
 
0727d3
@@ -64,7 +64,7 @@ static int zstd_send_setup(MultiFDSendParams *p, Error **errp)
0727d3
     if (ZSTD_isError(res)) {
0727d3
         ZSTD_freeCStream(z->zcs);
0727d3
         g_free(z);
0727d3
-        error_setg(errp, "multifd %d: initCStream failed with error %s",
0727d3
+        error_setg(errp, "multifd %u: initCStream failed with error %s",
0727d3
                    p->id, ZSTD_getErrorName(res));
0727d3
         return -1;
0727d3
     }
0727d3
@@ -75,7 +75,7 @@ static int zstd_send_setup(MultiFDSendParams *p, Error **errp)
0727d3
     if (!z->zbuff) {
0727d3
         ZSTD_freeCStream(z->zcs);
0727d3
         g_free(z);
0727d3
-        error_setg(errp, "multifd %d: out of memory for zbuff", p->id);
0727d3
+        error_setg(errp, "multifd %u: out of memory for zbuff", p->id);
0727d3
         return -1;
0727d3
     }
0727d3
     return 0;
0727d3
@@ -146,12 +146,12 @@ static int zstd_send_prepare(MultiFDSendParams *p, Error **errp)
0727d3
         } while (ret > 0 && (z->in.size - z->in.pos > 0)
0727d3
                          && (z->out.size - z->out.pos > 0));
0727d3
         if (ret > 0 && (z->in.size - z->in.pos > 0)) {
0727d3
-            error_setg(errp, "multifd %d: compressStream buffer too small",
0727d3
+            error_setg(errp, "multifd %u: compressStream buffer too small",
0727d3
                        p->id);
0727d3
             return -1;
0727d3
         }
0727d3
         if (ZSTD_isError(ret)) {
0727d3
-            error_setg(errp, "multifd %d: compressStream error %s",
0727d3
+            error_setg(errp, "multifd %u: compressStream error %s",
0727d3
                        p->id, ZSTD_getErrorName(ret));
0727d3
             return -1;
0727d3
         }
0727d3
@@ -201,7 +201,7 @@ static int zstd_recv_setup(MultiFDRecvParams *p, Error **errp)
0727d3
     z->zds = ZSTD_createDStream();
0727d3
     if (!z->zds) {
0727d3
         g_free(z);
0727d3
-        error_setg(errp, "multifd %d: zstd createDStream failed", p->id);
0727d3
+        error_setg(errp, "multifd %u: zstd createDStream failed", p->id);
0727d3
         return -1;
0727d3
     }
0727d3
 
0727d3
@@ -209,7 +209,7 @@ static int zstd_recv_setup(MultiFDRecvParams *p, Error **errp)
0727d3
     if (ZSTD_isError(ret)) {
0727d3
         ZSTD_freeDStream(z->zds);
0727d3
         g_free(z);
0727d3
-        error_setg(errp, "multifd %d: initDStream failed with error %s",
0727d3
+        error_setg(errp, "multifd %u: initDStream failed with error %s",
0727d3
                    p->id, ZSTD_getErrorName(ret));
0727d3
         return -1;
0727d3
     }
0727d3
@@ -222,7 +222,7 @@ static int zstd_recv_setup(MultiFDRecvParams *p, Error **errp)
0727d3
     if (!z->zbuff) {
0727d3
         ZSTD_freeDStream(z->zds);
0727d3
         g_free(z);
0727d3
-        error_setg(errp, "multifd %d: out of memory for zbuff", p->id);
0727d3
+        error_setg(errp, "multifd %u: out of memory for zbuff", p->id);
0727d3
         return -1;
0727d3
     }
0727d3
     return 0;
0727d3
@@ -270,7 +270,7 @@ static int zstd_recv_pages(MultiFDRecvParams *p, Error **errp)
0727d3
     int i;
0727d3
 
0727d3
     if (flags != MULTIFD_FLAG_ZSTD) {
0727d3
-        error_setg(errp, "multifd %d: flags received %x flags expected %x",
0727d3
+        error_setg(errp, "multifd %u: flags received %x flags expected %x",
0727d3
                    p->id, flags, MULTIFD_FLAG_ZSTD);
0727d3
         return -1;
0727d3
     }
0727d3
@@ -302,19 +302,19 @@ static int zstd_recv_pages(MultiFDRecvParams *p, Error **errp)
0727d3
         } while (ret > 0 && (z->in.size - z->in.pos > 0)
0727d3
                          && (z->out.pos < page_size));
0727d3
         if (ret > 0 && (z->out.pos < page_size)) {
0727d3
-            error_setg(errp, "multifd %d: decompressStream buffer too small",
0727d3
+            error_setg(errp, "multifd %u: decompressStream buffer too small",
0727d3
                        p->id);
0727d3
             return -1;
0727d3
         }
0727d3
         if (ZSTD_isError(ret)) {
0727d3
-            error_setg(errp, "multifd %d: decompressStream returned %s",
0727d3
+            error_setg(errp, "multifd %u: decompressStream returned %s",
0727d3
                        p->id, ZSTD_getErrorName(ret));
0727d3
             return ret;
0727d3
         }
0727d3
         out_size += z->out.pos;
0727d3
     }
0727d3
     if (out_size != expected_size) {
0727d3
-        error_setg(errp, "multifd %d: packet size received %d size expected %d",
0727d3
+        error_setg(errp, "multifd %u: packet size received %u size expected %u",
0727d3
                    p->id, out_size, expected_size);
0727d3
         return -1;
0727d3
     }
0727d3
diff --git a/migration/multifd.c b/migration/multifd.c
0727d3
index 0533da154a..d0d19470f9 100644
0727d3
--- a/migration/multifd.c
0727d3
+++ b/migration/multifd.c
0727d3
@@ -148,7 +148,7 @@ static int nocomp_recv_pages(MultiFDRecvParams *p, Error **errp)
0727d3
     uint32_t flags = p->flags & MULTIFD_FLAG_COMPRESSION_MASK;
0727d3
 
0727d3
     if (flags != MULTIFD_FLAG_NOCOMP) {
0727d3
-        error_setg(errp, "multifd %d: flags received %x flags expected %x",
0727d3
+        error_setg(errp, "multifd %u: flags received %x flags expected %x",
0727d3
                    p->id, flags, MULTIFD_FLAG_NOCOMP);
0727d3
         return -1;
0727d3
     }
0727d3
@@ -212,8 +212,8 @@ static int multifd_recv_initial_packet(QIOChannel *c, Error **errp)
0727d3
     }
0727d3
 
0727d3
     if (msg.version != MULTIFD_VERSION) {
0727d3
-        error_setg(errp, "multifd: received packet version %d "
0727d3
-                   "expected %d", msg.version, MULTIFD_VERSION);
0727d3
+        error_setg(errp, "multifd: received packet version %u "
0727d3
+                   "expected %u", msg.version, MULTIFD_VERSION);
0727d3
         return -1;
0727d3
     }
0727d3
 
0727d3
@@ -229,8 +229,8 @@ static int multifd_recv_initial_packet(QIOChannel *c, Error **errp)
0727d3
     }
0727d3
 
0727d3
     if (msg.id > migrate_multifd_channels()) {
0727d3
-        error_setg(errp, "multifd: received channel version %d "
0727d3
-                   "expected %d", msg.version, MULTIFD_VERSION);
0727d3
+        error_setg(errp, "multifd: received channel version %u "
0727d3
+                   "expected %u", msg.version, MULTIFD_VERSION);
0727d3
         return -1;
0727d3
     }
0727d3
 
0727d3
@@ -303,7 +303,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp)
0727d3
     packet->version = be32_to_cpu(packet->version);
0727d3
     if (packet->version != MULTIFD_VERSION) {
0727d3
         error_setg(errp, "multifd: received packet "
0727d3
-                   "version %d and expected version %d",
0727d3
+                   "version %u and expected version %u",
0727d3
                    packet->version, MULTIFD_VERSION);
0727d3
         return -1;
0727d3
     }
0727d3
@@ -317,7 +317,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp)
0727d3
      */
0727d3
     if (packet->pages_alloc > pages_max * 100) {
0727d3
         error_setg(errp, "multifd: received packet "
0727d3
-                   "with size %d and expected a maximum size of %d",
0727d3
+                   "with size %u and expected a maximum size of %u",
0727d3
                    packet->pages_alloc, pages_max * 100) ;
0727d3
         return -1;
0727d3
     }
0727d3
@@ -333,7 +333,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp)
0727d3
     p->pages->num = be32_to_cpu(packet->pages_used);
0727d3
     if (p->pages->num > packet->pages_alloc) {
0727d3
         error_setg(errp, "multifd: received packet "
0727d3
-                   "with %d pages and expected maximum pages are %d",
0727d3
+                   "with %u pages and expected maximum pages are %u",
0727d3
                    p->pages->num, packet->pages_alloc) ;
0727d3
         return -1;
0727d3
     }
0727d3
diff --git a/migration/trace-events b/migration/trace-events
0727d3
index b48d873b8a..5172cb3b3d 100644
0727d3
--- a/migration/trace-events
0727d3
+++ b/migration/trace-events
0727d3
@@ -115,23 +115,23 @@ ram_write_tracking_ramblock_start(const char *block_id, size_t page_size, void *
0727d3
 ram_write_tracking_ramblock_stop(const char *block_id, size_t page_size, void *addr, size_t length) "%s: page_size: %zu addr: %p length: %zu"
0727d3
 
0727d3
 # multifd.c
0727d3
-multifd_new_send_channel_async(uint8_t id) "channel %d"
0727d3
-multifd_recv(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flags, uint32_t next_packet_size) "channel %d packet_num %" PRIu64 " pages %d flags 0x%x next packet size %d"
0727d3
-multifd_recv_new_channel(uint8_t id) "channel %d"
0727d3
+multifd_new_send_channel_async(uint8_t id) "channel %u"
0727d3
+multifd_recv(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flags, uint32_t next_packet_size) "channel %u packet_num %" PRIu64 " pages %u flags 0x%x next packet size %u"
0727d3
+multifd_recv_new_channel(uint8_t id) "channel %u"
0727d3
 multifd_recv_sync_main(long packet_num) "packet num %ld"
0727d3
-multifd_recv_sync_main_signal(uint8_t id) "channel %d"
0727d3
-multifd_recv_sync_main_wait(uint8_t id) "channel %d"
0727d3
+multifd_recv_sync_main_signal(uint8_t id) "channel %u"
0727d3
+multifd_recv_sync_main_wait(uint8_t id) "channel %u"
0727d3
 multifd_recv_terminate_threads(bool error) "error %d"
0727d3
-multifd_recv_thread_end(uint8_t id, uint64_t packets, uint64_t pages) "channel %d packets %" PRIu64 " pages %" PRIu64
0727d3
-multifd_recv_thread_start(uint8_t id) "%d"
0727d3
-multifd_send(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flags, uint32_t next_packet_size) "channel %d packet_num %" PRIu64 " pages %d flags 0x%x next packet size %d"
0727d3
-multifd_send_error(uint8_t id) "channel %d"
0727d3
+multifd_recv_thread_end(uint8_t id, uint64_t packets, uint64_t pages) "channel %u packets %" PRIu64 " pages %" PRIu64
0727d3
+multifd_recv_thread_start(uint8_t id) "%u"
0727d3
+multifd_send(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flags, uint32_t next_packet_size) "channel %u packet_num %" PRIu64 " pages %u flags 0x%x next packet size %u"
0727d3
+multifd_send_error(uint8_t id) "channel %u"
0727d3
 multifd_send_sync_main(long packet_num) "packet num %ld"
0727d3
-multifd_send_sync_main_signal(uint8_t id) "channel %d"
0727d3
-multifd_send_sync_main_wait(uint8_t id) "channel %d"
0727d3
+multifd_send_sync_main_signal(uint8_t id) "channel %u"
0727d3
+multifd_send_sync_main_wait(uint8_t id) "channel %u"
0727d3
 multifd_send_terminate_threads(bool error) "error %d"
0727d3
-multifd_send_thread_end(uint8_t id, uint64_t packets, uint64_t pages) "channel %d packets %" PRIu64 " pages %"  PRIu64
0727d3
-multifd_send_thread_start(uint8_t id) "%d"
0727d3
+multifd_send_thread_end(uint8_t id, uint64_t packets, uint64_t pages) "channel %u packets %" PRIu64 " pages %"  PRIu64
0727d3
+multifd_send_thread_start(uint8_t id) "%u"
0727d3
 multifd_tls_outgoing_handshake_start(void *ioc, void *tioc, const char *hostname) "ioc=%p tioc=%p hostname=%s"
0727d3
 multifd_tls_outgoing_handshake_error(void *ioc, const char *err) "ioc=%p err=%s"
0727d3
 multifd_tls_outgoing_handshake_complete(void *ioc) "ioc=%p"
0727d3
-- 
0727d3
2.35.3
0727d3