From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: cornelia.huck@de.ibm.com, pbonzini@redhat.com,
Heinz Graalfs <graalfs@linux.vnet.ibm.com>,
borntraeger@de.ibm.com
Subject: [Qemu-devel] [RFC 3/3] s390x: Avoid hanging SCLP ASCII console
Date: Fri, 24 Oct 2014 10:13:47 +0200 [thread overview]
Message-ID: <1414138427-60643-4-git-send-email-graalfs@linux.vnet.ibm.com> (raw)
In-Reply-To: <1414138427-60643-1-git-send-email-graalfs@linux.vnet.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 <graalfs@linux.vnet.ibm.com>
---
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
next prev parent reply other threads:[~2014-10-24 8:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-24 8:13 [Qemu-devel] [RFC 0/3] qemu-char: Add poll timeouts for character backends Heinz Graalfs
2014-10-24 8:13 ` [Qemu-devel] [RFC 1/3] char: Trigger timeouts on poll() when frontend is unready Heinz Graalfs
2014-10-24 8:13 ` [Qemu-devel] [RFC 2/3] s390x: Fix hanging SCLP line mode console Heinz Graalfs
2014-10-24 8:13 ` Heinz Graalfs [this message]
2014-10-24 9:15 ` [Qemu-devel] [RFC 0/3] qemu-char: Add poll timeouts for character backends Paolo Bonzini
2014-10-24 11:29 ` Heinz Graalfs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1414138427-60643-4-git-send-email-graalfs@linux.vnet.ibm.com \
--to=graalfs@linux.vnet.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).