On Wed, Oct 13, 2021 at 3:26 AM Peter Xu <pet...@redhat.com> wrote: > > On Sat, Oct 09, 2021 at 04:56:13AM -0300, Leonardo Bras wrote: > > @@ -105,7 +105,13 @@ static int nocomp_send_prepare(MultiFDSendParams *p, > > uint32_t used, > > */ > > static int nocomp_send_write(MultiFDSendParams *p, uint32_t used, Error > > **errp) > > { > > - return qio_channel_writev_all(p->c, p->pages->iov, used, errp); > > + int flags = 0; > > + > > + if (migrate_multifd_zerocopy()) { > > + flags = QIO_CHANNEL_WRITE_FLAG_ZEROCOPY; > > + } > > + > > + return qio_channel_writev_all_flags(p->c, p->pages->iov, used, flags, > > errp); > > } > > What if the user specified ZEROCOPY+MULTIFD, but the kernel doesn't support > it? > > IIUC then the first call to qio_channel_writev_all_flags() above will fail, > then we fail the migration. > > It seems fine, but since you've introduced QIO_CHANNEL_FEATURE_WRITE_ZEROCOPY > in the previous patch - I think the cleaner way is when start migration and > after we setup the ioc, we sanity check on the capability and the ioc to make > sure if ZEROCOPY+MULTIFD is specified, we should fail early if we're sure the > ioc doesn't have QIO_CHANNEL_FEATURE_WRITE_ZEROCOPY bit set? > > -- > Peter Xu >
Failing earlier is always a good idea. I will try to implement that. Thanks Peter! Best regards, Leo