On Sun, Aug 30, 2026 at 09:27:47AM +0800, Yanfei Xu wrote:
> find_dirty_block() directly invokes multifd's per-round synchronization
> when the RAM scan wraps.  Other transports need the same boundary to
> order page versions.
> 
> Add a return-valued notifier for RAM round completion and register
> multifd's existing synchronization through it.  This keeps the current
> behavior while allowing other transports to synchronize at the same
> boundary.
> 
> Signed-off-by: Yanfei Xu <[email protected]>

Reviewed-by: Peter Xu <[email protected]>

One nitpick only,

[...]

> @@ -95,6 +96,17 @@ void ram_handle_zero(void *host, uint64_t size);
>  void ram_transferred_add(uint64_t bytes);
>  void ram_release_page(const char *rbname, uint64_t offset);
>  
> +/*
> + * Round notifiers must complete writes from the previous RAM scan before
> + * returning, so a newer version of a page cannot overtake an older version.

This is fine, but IMHO the better way to describe this notifier is as
simple as:

  The RAM round notifier kicks off whenever the migration RAM core finishes
  scanning one full round of guest memories.

We can further provide examples of multifd/rdma use case of it to use it as
a hook to flush old pages, but just to say maybe it can be used for other
things in the future, hence we can make the document more generic.

> + */
> +typedef struct RAMRoundNotifyData {
> +    QEMUFile *file;
> +} RAMRoundNotifyData;
> +
> +void ram_round_add_notifier(NotifierWithReturn *n);
> +void ram_round_remove_notifier(NotifierWithReturn *n);
> +
>  int ramblock_recv_bitmap_test(RAMBlock *rb, void *host_addr);
>  bool ramblock_recv_bitmap_test_byte_offset(RAMBlock *rb, uint64_t 
> byte_offset);
>  void ramblock_recv_bitmap_set(RAMBlock *rb, void *host_addr);
> -- 
> 2.20.1
> 

-- 
Peter Xu


Reply via email to