From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nz3L3-0007Ea-77 for qemu-devel@nongnu.org; Tue, 06 Apr 2010 03:36:45 -0400 Received: from [140.186.70.92] (port=35922 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nz3Ky-0007EG-EN for qemu-devel@nongnu.org; Tue, 06 Apr 2010 03:36:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nz3Kw-0000Qg-WC for qemu-devel@nongnu.org; Tue, 06 Apr 2010 03:36:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21074) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nz3Kw-0000QM-JY for qemu-devel@nongnu.org; Tue, 06 Apr 2010 03:36:38 -0400 Message-ID: <4BBAE471.40308@redhat.com> Date: Tue, 06 Apr 2010 09:36:17 +0200 From: Gerd Hoffmann MIME-Version: 1.0 References: <1270471538-31275-1-git-send-email-amit.shah@redhat.com> In-Reply-To: <1270471538-31275-1-git-send-email-amit.shah@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: Amit Shah Cc: qemu list , Juan Quintela 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). > 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. > - 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. cheers, Gerd