[PATCH v4 1/8] migration: Flush migration channel after sending data of CMD_PACKAGED

Juraj Marcin posted 8 patches 1 week, 3 days ago
[PATCH v4 1/8] migration: Flush migration channel after sending data of CMD_PACKAGED
Posted by Juraj Marcin 1 week, 3 days ago
From: Juraj Marcin <jmarcin@redhat.com>

If the length of the data sent after CMD_PACKAGED is just right, and
there is not much data to send afterward, it is possible part of the
CMD_PACKAGED payload will get left behind in the sending buffer. This
causes the destination side to hang while it tries to load the whole
package and initiate postcopy.

Signed-off-by: Juraj Marcin <jmarcin@redhat.com>
---
 migration/savevm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/migration/savevm.c b/migration/savevm.c
index 232cae090b..fa017378db 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1142,6 +1142,7 @@ int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len)
     qemu_savevm_command_send(f, MIG_CMD_PACKAGED, 4, (uint8_t *)&tmp);
 
     qemu_put_buffer(f, buf, len);
+    qemu_fflush(f);
 
     return 0;
 }
-- 
2.51.0
Re: [PATCH v4 1/8] migration: Flush migration channel after sending data of CMD_PACKAGED
Posted by Peter Xu 1 week, 3 days ago
On Mon, Nov 03, 2025 at 07:32:50PM +0100, Juraj Marcin wrote:
> From: Juraj Marcin <jmarcin@redhat.com>
> 
> If the length of the data sent after CMD_PACKAGED is just right, and
> there is not much data to send afterward, it is possible part of the
> CMD_PACKAGED payload will get left behind in the sending buffer. This
> causes the destination side to hang while it tries to load the whole
> package and initiate postcopy.
> 
> Signed-off-by: Juraj Marcin <jmarcin@redhat.com>

Reviewed-by: Peter Xu <peterx@redhat.com>

-- 
Peter Xu