From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nz3c5-0003FK-G4 for qemu-devel@nongnu.org; Tue, 06 Apr 2010 03:54:21 -0400 Received: from [140.186.70.92] (port=35997 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nz3c1-0003E3-Ab for qemu-devel@nongnu.org; Tue, 06 Apr 2010 03:54:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nz3by-0002qh-AW for qemu-devel@nongnu.org; Tue, 06 Apr 2010 03:54:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4341) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nz3by-0002qS-1Y for qemu-devel@nongnu.org; Tue, 06 Apr 2010 03:54:14 -0400 Date: Tue, 6 Apr 2010 13:22:42 +0530 From: Amit Shah Message-ID: <20100406075242.GH4135@amit-x200.redhat.com> References: <1270471538-31275-1-git-send-email-amit.shah@redhat.com> <4BBAE471.40308@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BBAE471.40308@redhat.com> Subject: [Qemu-devel] Re: [PATCH 0/5] chardev, virtio-console: flow control, error handling List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu list , Juan Quintela On (Tue) Apr 06 2010 [09:36:17], Gerd Hoffmann wrote: > Hi, > >> In case of EAGAIN, the unix_write() function just kept spinning while >> attempting to write to the chardev till it succeeded. This resulted in >> a stuck VM in case a chardev had opened connection but wasn't reading >> anything from qemu. > > It spins only for non-blocking file handles. In blocking mode the write > syscall just goes sleep until it can write out data (or gets a signal). True. I'm interesting in non-blocking files for now. >> There are two fixes for that case: >> - Poll for POLLOUT instead of directly attempting write(), which helps >> relax the CPU (and we become greener). > > No need to do that, see above. Having a poll() call in unix_write() is > wrong IMHO. So you mean just return -EAGAIN in case write returns with -EAGAIN? Yeah, makes sense. >> - If the file that we're writing to is nonblocking, return -EAGAIN to >> the caller of qemu_chr_write() so that appropriate actions can be >> taken higher up in the stack. > > Good. Amit