From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xha1N-0002w8-0p for qemu-devel@nongnu.org; Fri, 24 Oct 2014 04:15:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xha1D-00050k-Tg for qemu-devel@nongnu.org; Fri, 24 Oct 2014 04:14:52 -0400 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:36137) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xha1D-00050W-L4 for qemu-devel@nongnu.org; Fri, 24 Oct 2014 04:14:43 -0400 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Oct 2014 09:14:42 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id F056B17D8047 for ; Fri, 24 Oct 2014 09:14:40 +0100 (BST) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s9O8Edli17826110 for ; Fri, 24 Oct 2014 08:14:39 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s9O8Ec6c029256 for ; Fri, 24 Oct 2014 02:14:39 -0600 From: Heinz Graalfs Date: Fri, 24 Oct 2014 10:13:47 +0200 Message-Id: <1414138427-60643-4-git-send-email-graalfs@linux.vnet.ibm.com> In-Reply-To: <1414138427-60643-1-git-send-email-graalfs@linux.vnet.ibm.com> References: <1414138427-60643-1-git-send-email-graalfs@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC 3/3] s390x: Avoid hanging SCLP ASCII console List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: cornelia.huck@de.ibm.com, pbonzini@redhat.com, Heinz Graalfs , borntraeger@de.ibm.com Exploit the new can_read timeout infrastructure in order to avoid hangs when no further activity happens on the main thread. Signed-off-by: Heinz Graalfs --- hw/char/sclpconsole.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index fca105d..a33aaa2 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -44,8 +44,13 @@ typedef struct SCLPConsole { static int chr_can_read(void *opaque) { SCLPConsole *scon = opaque; + int avail = SIZE_BUFFER_VT220 - scon->iov_data_len; - return SIZE_BUFFER_VT220 - scon->iov_data_len; + if (avail > 0) { + return avail; + } + + return -EAGAIN; } /* Send data from a char device over to the guest */ -- 1.8.3.1