Skip to contentSkip to conversation

migration: Fix invalid %ud format and trace arg typo

PATCH Applied yujun 3 participants 3 messages Jun 30

lore
Share & tools
lore

yujun

author
#0 lore raw

PATCH 1/1 migration: Fix invalid %ud format and trace arg typo

Standard printf has no %ud conversion; glibc treats it as %u followed by a literal 'd', so postcopy userfaultfd error messages printed event values like "5d" instead of "5". The same typo existed in two postcopy discard trace format strings.

Also rename the misspelled ram_save_iterate_big_wait() trace argument milliconds to milliseconds.

Fixes 00fa4fc85b ("postcopy: Allow registering of fd handler")
---
 migration/postcopy-ram.c | 4 ++--
 migration/trace-events   | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
migration/postcopy-ram.c +2 -2
index f5ef93f193..980b938a4c 100644
@@ -1368,7 +1368,7 @@ static void *postcopy_ram_fault_thread(void *opaque)
                 }
             }
             if (msg.event != UFFD_EVENT_PAGEFAULT) {
-                error_report("%s: Read unexpected event %ud from userfaultfd",
+                error_report("%s: Read unexpected event %u from userfaultfd",
                              __func__, msg.event);
                 continue; /* It's not a page fault, shouldn't happen */
             }
@@ -1443,7 +1443,7 @@ retry:
                     }
                 }
                 if (msg.event != UFFD_EVENT_PAGEFAULT) {
-                    error_report("%s: Read unexpected event %ud "
+                    error_report("%s: Read unexpected event %u "
                                  "from userfaultfd (shared)",
                                  __func__, msg.event);
                     continue; /* It's not a page fault, shouldn't happen */
migration/trace-events +3 -3
index de99d976ab..3b1258c3bf 100644
@@ -21,14 +21,14 @@ loadvm_postcopy_handle_run(void) ""
 loadvm_postcopy_handle_resume(void) ""
 loadvm_postcopy_ram_handle_discard(void) ""
 loadvm_postcopy_ram_handle_discard_end(void) ""
-loadvm_postcopy_ram_handle_discard_header(const char *ramid, uint16_t len) "%s: %ud"
+loadvm_postcopy_ram_handle_discard_header(const char *ramid, uint16_t len) "%s: %u"
 loadvm_process_command(const char *s, uint16_t len) "com=%s len=%d"
 loadvm_process_command_ping(uint32_t val) "0x%x"
 loadvm_approve_switchover(unsigned int switchover_ack_pending_num) "Switchover ack pending num=%u"
 postcopy_ram_listen_thread_exit(void) ""
 postcopy_ram_listen_thread_start(void) ""
 qemu_savevm_send_postcopy_advise(void) ""
-qemu_savevm_send_postcopy_ram_discard(const char *id, uint16_t len) "%s: %ud"
+qemu_savevm_send_postcopy_ram_discard(const char *id, uint16_t len) "%s: %u"
 savevm_command_send(uint16_t command, uint16_t len) "com=0x%x len=%d"
 savevm_section_start(const char *id, unsigned int section_id) "%s, section_id %u"
 savevm_section_end(const char *id, unsigned int section_id, int ret) "%s, section_id %u -> %d"
@@ -119,7 +119,7 @@ colo_flush_ram_cache_begin(uint64_t dirty_pages) "dirty_pages %" PRIu64
 colo_flush_ram_cache_end(void) ""
 save_xbzrle_page_skipping(void) ""
 save_xbzrle_page_overflow(void) ""
-ram_save_iterate_big_wait(uint64_t milliconds, int iterations) "big wait: %" PRIu64 " milliseconds, %d iterations"
+ram_save_iterate_big_wait(uint64_t milliseconds, int iterations) "big wait: %" PRIu64 " milliseconds, %d iterations"
 ram_load_start(void) ""
 ram_load_complete(int ret, uint64_t seq_iter) "exit_code %d seq iteration %" PRIu64
 ram_write_tracking_ramblock_start(const char *block_id, size_t page_size, void *addr, size_t length) "%s: page_size: %zu addr: %p length: %zu"
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 59 lines · yujun

Standard printf has no %ud conversion; glibc treats it as %u followed by a literal 'd', so postcopy userfaultfd error messages printed event values like "5d" instead of "5". The same typo existed in two postcopy discard trace format strings.

Also rename the misspelled ram_save_iterate_big_wait() trace argument milliconds to milliseconds.

Fixes 00fa4fc85b ("postcopy: Allow registering of fd handler")
---
 migration/postcopy-ram.c | 4 ++--
 migration/trace-events   | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
migration/postcopy-ram.c +2 -2
index f5ef93f193..980b938a4c 100644
@@ -1368,7 +1368,7 @@ static void *postcopy_ram_fault_thread(void *opaque)
                 }
             }
             if (msg.event != UFFD_EVENT_PAGEFAULT) {
-                error_report("%s: Read unexpected event %ud from userfaultfd",
+                error_report("%s: Read unexpected event %u from userfaultfd",
                              __func__, msg.event);
                 continue; /* It's not a page fault, shouldn't happen */
             }
@@ -1443,7 +1443,7 @@ retry:
                     }
                 }
                 if (msg.event != UFFD_EVENT_PAGEFAULT) {
-                    error_report("%s: Read unexpected event %ud "
+                    error_report("%s: Read unexpected event %u "
                                  "from userfaultfd (shared)",
                                  __func__, msg.event);
                     continue; /* It's not a page fault, shouldn't happen */
migration/trace-events +2 -2
index de99d976ab..3b1258c3bf 100644
@@ -21,14 +21,14 @@ loadvm_postcopy_handle_run(void) ""
 loadvm_postcopy_handle_resume(void) ""
 loadvm_postcopy_ram_handle_discard(void) ""
 loadvm_postcopy_ram_handle_discard_end(void) ""
-loadvm_postcopy_ram_handle_discard_header(const char *ramid, uint16_t len) "%s: %ud"
+loadvm_postcopy_ram_handle_discard_header(const char *ramid, uint16_t len) "%s: %u"
 loadvm_process_command(const char *s, uint16_t len) "com=%s len=%d"
 loadvm_process_command_ping(uint32_t val) "0x%x"
 loadvm_approve_switchover(unsigned int switchover_ack_pending_num) "Switchover ack pending num=%u"
 postcopy_ram_listen_thread_exit(void) ""
 postcopy_ram_listen_thread_start(void) ""
 qemu_savevm_send_postcopy_advise(void) ""
-qemu_savevm_send_postcopy_ram_discard(const char *id, uint16_t len) "%s: %ud"
+qemu_savevm_send_postcopy_ram_discard(const char *id, uint16_t len) "%s: %u"
 savevm_command_send(uint16_t command, uint16_t len) "com=0x%x len=%d"
 savevm_section_start(const char *id, unsigned int section_id) "%s, section_id %u"
 savevm_section_end(const char *id, unsigned int section_id, int ret) "%s, section_id %u -> %d"

migration/trace-events colo_flush_ram_cache_begin(uint64_t dirty_pages) "dirty_pages %" PRIu64 · line 125

Quoted 8 lines
migration/trace-events +1 -1
@@ -119,7 +119,7 @@ colo_flush_ram_cache_begin(uint64_t dirty_pages) "dirty_pages %" PRIu64
 colo_flush_ram_cache_end(void) ""
 save_xbzrle_page_skipping(void) ""
 save_xbzrle_page_overflow(void) ""
-ram_save_iterate_big_wait(uint64_t milliconds, int iterations) "big wait: %" PRIu64 " milliseconds, %d iterations"
+ram_save_iterate_big_wait(uint64_t milliseconds, int iterations) "big wait: %" PRIu64 " milliseconds, %d iterations"
 ram_load_start(void) ""
 ram_load_complete(int ret, uint64_t seq_iter) "exit_code %d seq iteration %" PRIu64
 ram_write_tracking_ramblock_start(const char *block_id, size_t page_size, void *addr, size_t length) "%s: page_size: %zu addr: %p length: %zu"
Applied
#2 lore raw
In reply to yujun
Quoted 10 lines · yujun

Standard printf has no %ud conversion; glibc treats it as %u followed by a literal 'd', so postcopy userfaultfd error messages printed event values like "5d" instead of "5". The same typo existed in two postcopy discard trace format strings.

Also rename the misspelled ram_save_iterate_big_wait() trace argument milliconds to milliseconds.

Fixes 00fa4fc85b ("postcopy: Allow registering of fd handler")

queued, thanks.

Signature · 1 line
Peter Xu