Skip to content

Commit 7484d61

Browse files
maciejsszmigieroMichael Tokarev
authored andcommitted
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: 0525b91 ("migration/multifd: Device state transfer support - send side") Signed-off-by: Maciej S. Szmigiero <[email protected]> Reviewed-by: Fabiano Rosas <[email protected]> Link: https://lore.kernel.org/r/3bd5f48578e29f3a78f41b1e4fbea3d4b2d9b136.1747403393.git.maciej.szmigiero@oracle.com Signed-off-by: Peter Xu <[email protected]> (cherry picked from commit 6be7696) Signed-off-by: Michael Tokarev <[email protected]>
1 parent 5e8ef1d commit 7484d61

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

migration/multifd.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,13 +695,17 @@ static void *multifd_send_thread(void *opaque)
695695
if (qatomic_load_acquire(&p->pending_job)) {
696696
bool is_device_state = multifd_payload_device_state(p->data);
697697
size_t total_size;
698+
int write_flags_masked = 0;
698699

699700
p->flags = 0;
700701
p->iovs_num = 0;
701702
assert(!multifd_payload_empty(p->data));
702703

703704
if (is_device_state) {
704705
multifd_device_state_send_prepare(p);
706+
707+
/* Device state packets cannot be sent via zerocopy */
708+
write_flags_masked |= QIO_CHANNEL_WRITE_FLAG_ZERO_COPY;
705709
} else {
706710
ret = multifd_send_state->ops->send_prepare(p, &local_err);
707711
if (ret != 0) {
@@ -723,7 +727,8 @@ static void *multifd_send_thread(void *opaque)
723727
&p->data->u.ram, &local_err);
724728
} else {
725729
ret = qio_channel_writev_full_all(p->c, p->iov, p->iovs_num,
726-
NULL, 0, p->write_flags,
730+
NULL, 0,
731+
p->write_flags & ~write_flags_masked,
727732
&local_err);
728733
}
729734

0 commit comments

Comments
 (0)