X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=migration%2Fqemu-file-channel.c;h=8e639eb496f7cb9688145456280f09b4e04f07fb;hb=e87fd1e6e547a80b3e403e882b829d2750e24e44;hp=dc991c90510cc841238b2ca33009760371039181;hpb=730a6e875b137f74109cc93560a3f643d7ad8263;p=mirror_qemu.git diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c index dc991c9051..8e639eb496 100644 --- a/migration/qemu-file-channel.c +++ b/migration/qemu-file-channel.c @@ -24,7 +24,8 @@ #include "qemu/osdep.h" #include "qemu-file-channel.h" -#include "migration/qemu-file.h" +#include "exec/cpu-common.h" +#include "qemu-file.h" #include "io/channel-socket.h" #include "qemu/iov.h" @@ -48,7 +49,11 @@ static ssize_t channel_writev_buffer(void *opaque, ssize_t len; len = qio_channel_writev(ioc, local_iov, nlocal_iov, NULL); if (len == QIO_CHANNEL_ERR_BLOCK) { - qio_channel_wait(ioc, G_IO_OUT); + if (qemu_in_coroutine()) { + qio_channel_yield(ioc, G_IO_OUT); + } else { + qio_channel_wait(ioc, G_IO_OUT); + } continue; } if (len < 0) { @@ -79,7 +84,11 @@ static ssize_t channel_get_buffer(void *opaque, ret = qio_channel_read(ioc, (char *)buf, size, NULL); if (ret < 0) { if (ret == QIO_CHANNEL_ERR_BLOCK) { - qio_channel_yield(ioc, G_IO_IN); + if (qemu_in_coroutine()) { + qio_channel_yield(ioc, G_IO_IN); + } else { + qio_channel_wait(ioc, G_IO_IN); + } } else { /* XXX handle Error * object */ return -EIO;