migration: Wait for blocking IO
We have three conditions here: - channel fails -> error - we have to quit: we close the channel and reads fails - normal read that success, we are in bussiness So forget the complications of waiting in a semaphore. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
8b2db7f5fd
commit
4d22c148c9
|
@ -602,8 +602,6 @@ typedef struct {
|
|||
bool running;
|
||||
/* should this thread finish */
|
||||
bool quit;
|
||||
/* thread has work to do */
|
||||
bool pending_job;
|
||||
/* array of pages to receive */
|
||||
MultiFDPages_t *pages;
|
||||
/* packet allocated len */
|
||||
|
@ -1199,14 +1197,6 @@ static void multifd_recv_sync_main(void)
|
|||
for (i = 0; i < migrate_multifd_channels(); i++) {
|
||||
MultiFDRecvParams *p = &multifd_recv_state->params[i];
|
||||
|
||||
trace_multifd_recv_sync_main_signal(p->id);
|
||||
qemu_mutex_lock(&p->mutex);
|
||||
p->pending_job = true;
|
||||
qemu_mutex_unlock(&p->mutex);
|
||||
}
|
||||
for (i = 0; i < migrate_multifd_channels(); i++) {
|
||||
MultiFDRecvParams *p = &multifd_recv_state->params[i];
|
||||
|
||||
trace_multifd_recv_sync_main_wait(p->id);
|
||||
qemu_sem_wait(&multifd_recv_state->sem_sync);
|
||||
qemu_mutex_lock(&p->mutex);
|
||||
|
@ -1219,7 +1209,6 @@ static void multifd_recv_sync_main(void)
|
|||
MultiFDRecvParams *p = &multifd_recv_state->params[i];
|
||||
|
||||
trace_multifd_recv_sync_main_signal(p->id);
|
||||
|
||||
qemu_sem_post(&p->sem_sync);
|
||||
}
|
||||
trace_multifd_recv_sync_main(multifd_recv_state->packet_num);
|
||||
|
@ -1256,7 +1245,6 @@ static void *multifd_recv_thread(void *opaque)
|
|||
used = p->pages->used;
|
||||
flags = p->flags;
|
||||
trace_multifd_recv(p->id, p->packet_num, used, flags);
|
||||
p->pending_job = false;
|
||||
p->num_packets++;
|
||||
p->num_pages += used;
|
||||
qemu_mutex_unlock(&p->mutex);
|
||||
|
@ -1306,7 +1294,6 @@ int multifd_load_setup(void)
|
|||
qemu_sem_init(&p->sem, 0);
|
||||
qemu_sem_init(&p->sem_sync, 0);
|
||||
p->quit = false;
|
||||
p->pending_job = false;
|
||||
p->id = i;
|
||||
p->pages = multifd_pages_init(page_count);
|
||||
p->packet_len = sizeof(MultiFDPacket_t)
|
||||
|
|
Loading…
Reference in a new issue