Skip to contentSkip to conversation

Next patches

GIT PULL Applied Peter Xu 2 participants 5 messages Jul 20

lore
Share & tools
lore

Peter Xu

author
#0 lore raw

The following changes since commit 30e8a06b64aa58a3990ba39cb5d09531e7d265e0:

Merge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging (2026-06-29 17:41:42 +0200)

are available in the Git repository at:

https://gitlab.com/peterx/qemu.git tags/next-pull-request

for you to fetch changes up to 60f2281450c4b4e9a16922fd69c66486a8207abb:

migration: clean up postcopy blocktime presentation (2026-07-17 12:33:42 -0400)

----------------------------------------------------------------
Migration pull for rc1

- Bin's cleanup on migration blocktime (partly)
- Yujun's fix on print format

----------------------------------------------------------------

Bin Guo (2):
migration: fix ineffective overflow assert in postcopy blocktime
migration: clean up postcopy blocktime presentation

yujun (1):
migration: Fix invalid %ud format and trace arg typo

 migration/migration-hmp-cmds.c |  2 +-
 migration/postcopy-ram.c       | 14 ++++++--------
 migration/trace-events         |  6 +++---
 3 files changed, 10 insertions(+), 12 deletions(-)
Signature · 1 line
2.54.0
author
#1 lore raw

[PULL 3/3] migration: clean up postcopy blocktime presentation

From: Bin Guo <[email protected]>

Small cleanups for the postcopy blocktime fine-grained tracking feature:

* Remove a redundant memset() on latency_buckets after g_new0().
* Use singular "Latency" in the HMP label for postcopy non-vCPU latency, consistent with other single-value labels.

---
 migration/migration-hmp-cmds.c | 2 +-
 migration/postcopy-ram.c       | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)
migration/migration-hmp-cmds.c +1 -1
index 8b385f560e..7ec010fd05 100644
@@ -95,7 +95,7 @@ static void migration_dump_blocktime(Monitor *mon, MigrationInfo *info)
     }
 
     if (info->has_postcopy_non_vcpu_latency) {
-        monitor_printf(mon, "Postcopy non-vCPU Latencies (ns): %" PRIu64 "\n",
+        monitor_printf(mon, "Postcopy non-vCPU Latency (ns): %" PRIu64 "\n",
                        info->postcopy_non_vcpu_latency);
     }
 
migration/postcopy-ram.c +0 -3
index b0828edb3e..a3314d3180 100644
@@ -297,9 +297,6 @@ static struct PostcopyBlocktimeContext *blocktime_context_new(void)
     unsigned int smp_cpus = ms->smp.cpus;
     PostcopyBlocktimeContext *ctx = g_new0(PostcopyBlocktimeContext, 1);
 
-    /* Initialize all counters to be zeros */
-    memset(ctx->latency_buckets, 0, sizeof(ctx->latency_buckets));
-
     ctx->vcpu_blocktime_total = g_new0(uint64_t, smp_cpus);
     ctx->vcpu_faults_count = g_new0(uint64_t, smp_cpus);
     ctx->vcpu_faults_current = g_new0(uint8_t, smp_cpus);
Signature · 1 line
2.54.0
author
#2 lore raw

[PULL 1/3] migration: Fix invalid %ud format and trace arg typo

In reply to Peter Xu

From: yujun <[email protected]>

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.54.0
author
#3 lore raw

[PULL 2/3] migration: fix ineffective overflow assert in postcopy blocktime

In reply to Peter Xu

From: Bin Guo <[email protected]>

vcpu_faults_current[] is uint8_t. The overflow assert was checked after the post-increment, so 255 would wrap to 0 and the assert would pass silently. Move the check before the increment and use < 255.

---
 migration/postcopy-ram.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
migration/postcopy-ram.c +4 -3
index 980b938a4c..b0828edb3e 100644
@@ -1093,7 +1093,11 @@ void mark_postcopy_blocktime_begin(uintptr_t addr, uint32_t ptid,
         /*
          * Account how many concurrent faults on this vCPU we trapped.  See
          * comments above vcpu_faults_current[] on why it can be more than one.
+         *
+         * vcpu_faults_current[] is uint8_t, so assert before incrementing to
+         * catch overflow before it wraps.
          */
+        assert(dc->vcpu_faults_current[cpu] < 255);
         if (dc->vcpu_faults_current[cpu]++ == 0) {
             dc->smp_cpus_down++;
             /*
@@ -1103,9 +1107,6 @@ void mark_postcopy_blocktime_begin(uintptr_t addr, uint32_t ptid,
              */
             dc->last_begin = current;
         }
-
-        /* Making sure it won't overflow - it really should never! */
-        assert(dc->vcpu_faults_current[cpu] <= 255);
     } else {
         /*
          * For non-vCPU thread faults, we don't care about tid or cpu index
Signature · 1 line
2.54.0