From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5YXE-0006nl-KZ for qemu-devel@nongnu.org; Mon, 19 Sep 2011 03:45:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R5YXD-0007V1-JW for qemu-devel@nongnu.org; Mon, 19 Sep 2011 03:45:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19274) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5YXD-0007Ut-AA for qemu-devel@nongnu.org; Mon, 19 Sep 2011 03:44:59 -0400 Message-ID: <4E76F3A9.1090902@redhat.com> Date: Mon, 19 Sep 2011 09:47:53 +0200 From: Kevin Wolf 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> <4E74B372.2060505@redhat.com> In-Reply-To: <4E74B372.2060505@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 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: Paolo Bonzini Cc: qemu-devel@nongnu.org, MORITA Kazutaka Am 17.09.2011 16:49, schrieb Paolo Bonzini: > 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)? As long as it's clear what the current version is, I don't mind. Do I understand right that there will be a v3 for patches 3 and 4? Kevin