[PATCH] migration: Fix invalid %ud format and trace arg typo

yujun posted 1 patch 3 weeks, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260630031324.43453-1-yujun@kylinos.cn
Maintainers: Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>
migration/postcopy-ram.c | 4 ++--
migration/trace-events   | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
[PATCH] migration: Fix invalid %ud format and trace arg typo
Posted by yujun 3 weeks, 5 days ago
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")
Signed-off-by: yujun <yujun@kylinos.cn>
---
 migration/postcopy-ram.c | 4 ++--
 migration/trace-events   | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index f5ef93f193..980b938a4c 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -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 */
diff --git a/migration/trace-events b/migration/trace-events
index de99d976ab..3b1258c3bf 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -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"
-- 
2.25.1
Re: [PATCH] migration: Fix invalid %ud format and trace arg typo
Posted by Peter Xu 3 weeks, 4 days ago
On Tue, Jun 30, 2026 at 11:13:24AM +0800, yujun wrote:
> 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")
> Signed-off-by: yujun <yujun@kylinos.cn>

queued, thanks.

-- 
Peter Xu
Re: [PATCH] migration: Fix invalid %ud format and trace arg typo
Posted by Fabiano Rosas 3 weeks, 4 days ago
yujun <yujun@kylinos.cn> writes:

> 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")
> Signed-off-by: yujun <yujun@kylinos.cn>
> ---
>  migration/postcopy-ram.c | 4 ++--
>  migration/trace-events   | 6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
> index f5ef93f193..980b938a4c 100644
> --- a/migration/postcopy-ram.c
> +++ b/migration/postcopy-ram.c
> @@ -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 */
> diff --git a/migration/trace-events b/migration/trace-events
> index de99d976ab..3b1258c3bf 100644
> --- a/migration/trace-events
> +++ b/migration/trace-events
> @@ -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"

Reviewed-by: Fabiano Rosas <farosas@suse.de>