diff options
author | Maciej S. Szmigiero <maciej.szmigiero@oracle.com> | 2025-05-16 15:53:03 +0200 |
---|---|---|
committer | Peter Xu <peterx@redhat.com> | 2025-05-20 11:26:32 -0400 |
commit | 6be7696129b302830a9cff7e30484e08c2d64b57 (patch) | |
tree | bd9f4a7842e36982f80d90e6def64aa101983c53 | |
parent | 766bbabac8f00bc5cf23ba90a8326678636280ed (diff) | |
download | qemu-6be7696129b302830a9cff7e30484e08c2d64b57.zip qemu-6be7696129b302830a9cff7e30484e08c2d64b57.tar.gz qemu-6be7696129b302830a9cff7e30484e08c2d64b57.tar.bz2 |
migration/multifd: Don't send device state packets with zerocopy flag
If zerocopy is enabled for multifd then QIO_CHANNEL_WRITE_FLAG_ZERO_COPY
flag is forced into all multifd channel write calls via p->write_flags
that was setup in multifd_nocomp_send_setup().
However, device state packets aren't compatible with zerocopy - the data
buffer isn't getting kept pinned until multifd channel flush.
Make sure to mask that QIO_CHANNEL_WRITE_FLAG_ZERO_COPY flag in a multifd
send thread if the data being sent is device state.
Fixes: 0525b91a0b99 ("migration/multifd: Device state transfer support - send side")
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/3bd5f48578e29f3a78f41b1e4fbea3d4b2d9b136.1747403393.git.maciej.szmigiero@oracle.com
Signed-off-by: Peter Xu <peterx@redhat.com>
-rw-r--r-- | migration/multifd.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/migration/multifd.c b/migration/multifd.c index f18b166..b255778 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -690,6 +690,7 @@ static void *multifd_send_thread(void *opaque) if (qatomic_load_acquire(&p->pending_job)) { bool is_device_state = multifd_payload_device_state(p->data); size_t total_size; + int write_flags_masked = 0; p->flags = 0; p->iovs_num = 0; @@ -697,6 +698,9 @@ static void *multifd_send_thread(void *opaque) if (is_device_state) { multifd_device_state_send_prepare(p); + + /* Device state packets cannot be sent via zerocopy */ + write_flags_masked |= QIO_CHANNEL_WRITE_FLAG_ZERO_COPY; } else { ret = multifd_send_state->ops->send_prepare(p, &local_err); if (ret != 0) { @@ -718,7 +722,8 @@ static void *multifd_send_thread(void *opaque) &p->data->u.ram, &local_err); } else { ret = qio_channel_writev_full_all(p->c, p->iov, p->iovs_num, - NULL, 0, p->write_flags, + NULL, 0, + p->write_flags & ~write_flags_masked, &local_err); } |