From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4wCy-00025L-Sg for qemu-devel@nongnu.org; Sat, 17 Sep 2011 10:49:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R4wCt-0007Xx-Sn for qemu-devel@nongnu.org; Sat, 17 Sep 2011 10:49:32 -0400 Received: from mail-wy0-f181.google.com ([74.125.82.181]:53427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4wCt-0007Xs-OT for qemu-devel@nongnu.org; Sat, 17 Sep 2011 10:49:27 -0400 Received: by wyg36 with SMTP id 36so4461058wyg.12 for ; Sat, 17 Sep 2011 07:49:26 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4E74B372.2060505@redhat.com> Date: Sat, 17 Sep 2011 16:49:22 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1316183152-5481-1-git-send-email-pbonzini@redhat.com> <1316183152-5481-4-git-send-email-pbonzini@redhat.com> <871uvfy95d.wl%morita.kazutaka@lab.ntt.co.jp> In-Reply-To: <871uvfy95d.wl%morita.kazutaka@lab.ntt.co.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 03/15] sheepdog: move coroutine send/recv function to generic code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: MORITA Kazutaka Cc: Kevin Wolf , qemu-devel@nongnu.org On 09/17/2011 08:29 AM, MORITA Kazutaka wrote: >> > +#else >> > + struct iovec *p = iov; >> > + ret = 0; >> > + while (iovlen> 0) { >> > + int rc; >> > + if (do_sendv) { >> > + rc = send(sockfd, p->iov_base, p->iov_len, 0); >> > + } else { >> > + rc = qemu_recv(sockfd, p->iov_base, p->iov_len, 0); >> > + } >> > + if (rc == -1) { >> > + if (errno == EINTR) { >> > + continue; >> > + } >> > + if (ret == 0) { >> > + ret = -1; >> > + } >> > + break; >> > + } >> > + iovlen--, p++; >> > + ret += rc; >> > + } > This code can be called inside coroutines with a non-blocking fd, so > should we avoid busy waiting? It doesn't busy wait, it exits with EAGAIN. I'll squash in here the first hunk of patch 4, which is needed. qemu_co_recvv already handles reads that return zero, unlike sheepdog's do_readv_writev. I probably moved it there inadvertently while moving code around to cutils.c, but in order to fix qemu-ga I need to create a new file qemu-coroutine-io.c. Kevin, do you want me to resubmit everything, or are you going to apply some more patches to the block branch (5 to 12 should be fine)? Paolo