On Mon, Jan 23, 2017 at 10:32:19PM +0100, Juan Quintela wrote: > We just send the address through the alternate channels and test that it > is ok. > > Signed-off-by: Juan Quintela <quint...@redhat.com> > --- > migration/ram.c | 36 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) > > diff --git a/migration/ram.c b/migration/ram.c > index 4e530ea..95af694 100644 > --- a/migration/ram.c > +++ b/migration/ram.c > @@ -432,8 +432,22 @@ static void *multifd_send_thread(void *opaque) > qemu_mutex_lock(¶ms->mutex); > while (!params->quit){ > if (params->pages.num) { > + int i; > + int num; > + > + num = params->pages.num;
Is this likely to be a small or a large value ? ..... > params->pages.num = 0; > qemu_mutex_unlock(¶ms->mutex); > + > + for(i=0; i < num; i++) { > + if (qio_channel_write(params->c, > + (const char > *)¶ms->pages.address[i], > + sizeof(uint8_t *), &error_abort) > + != sizeof(uint8_t*)) { > + /* Shuoudn't ever happen */ > + exit(-1); > + } > + } If 'num' is large,then you would be better populating an iovec and using qio_channel_writev() rather than sending one uint8_t * at a time. > @@ -605,8 +620,29 @@ static void *multifd_recv_thread(void *opaque) > qemu_mutex_lock(¶ms->mutex); > while (!params->quit){ > if (params->pages.num) { > + int i; > + int num; > + > + num = params->pages.num; > params->pages.num = 0; > qemu_mutex_unlock(¶ms->mutex); > + > + for(i = 0; i < num; i++) { > + if (qio_channel_read(params->c, > + (char *)&recv_address, > + sizeof(uint8_t*), &error_abort) > + != sizeof(uint8_t *)) { > + /* shouldn't ever happen */ > + exit(-1); > + } > + if (recv_address != params->pages.address[i]) { > + printf("We received %p what we were expecting %p (%d)\n", > + recv_address, > + params->pages.address[i], i); > + exit(-1); > + } > + } Same comment as above. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|