[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 5/5] s390x/sclpconsole: Avoid hanging SCLP ASCII cons
From: |
Cornelia Huck |
Subject: |
[Qemu-devel] [PULL 5/5] s390x/sclpconsole: Avoid hanging SCLP ASCII console |
Date: |
Wed, 5 Nov 2014 16:48:16 +0100 |
From: Heinz Graalfs <address@hidden>
Force recalculation of file descriptor sets for main loop's poll(),
in order to be able to readd a possibly removed input file descriptor
after can_read() returned 0 (zero).
Signed-off-by: Heinz Graalfs <address@hidden>
Reviewed-by: David Hildenbrand <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
hw/char/sclpconsole.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c
index fca105d..79891df 100644
--- a/hw/char/sclpconsole.c
+++ b/hw/char/sclpconsole.c
@@ -36,6 +36,7 @@ typedef struct SCLPConsole {
uint32_t iov_bs; /* offset in buf for char layer read operation */
uint32_t iov_data_len; /* length of byte stream in buffer */
uint32_t iov_sclp_rest; /* length of byte stream not read via SCLP */
+ bool notify; /* qemu_notify_event() req'd if true */
} SCLPConsole;
/* character layer call-back functions */
@@ -44,8 +45,12 @@ 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) {
+ scon->notify = true;
+ }
+ return avail;
}
/* Send data from a char device over to the guest */
@@ -113,6 +118,10 @@ static void get_console_data(SCLPEvent *event, uint8_t
*buf, size_t *size,
cons->iov_sclp += avail;
/* more data pending */
}
+ if (cons->notify) {
+ cons->notify = false;
+ qemu_notify_event();
+ }
}
static int read_event_data(SCLPEvent *event, EventBufferHeader *evt_buf_hdr,
@@ -229,6 +238,7 @@ static void console_reset(DeviceState *dev)
scon->iov_bs = 0;
scon->iov_data_len = 0;
scon->iov_sclp_rest = 0;
+ scon->notify = false;
}
static int console_exit(SCLPEvent *event)
--
1.7.9.5
- [Qemu-devel] [PULL 0/5] s390x fixes for 2.2, Cornelia Huck, 2014/11/05
- [Qemu-devel] [PULL 1/5] s390x/kvm: Fix opcode decoding for eb instruction handler, Cornelia Huck, 2014/11/05
- [Qemu-devel] [PULL 3/5] s390x/sclpconsole-lm: truncate input if line is too long, Cornelia Huck, 2014/11/05
- [Qemu-devel] [PULL 5/5] s390x/sclpconsole: Avoid hanging SCLP ASCII console,
Cornelia Huck <=
- [Qemu-devel] [PULL 2/5] s390x/kvm: Fix warning from sparse, Cornelia Huck, 2014/11/05
- [Qemu-devel] [PULL 4/5] s390x/sclpconsole-lm: Fix hanging SCLP line mode console, Cornelia Huck, 2014/11/05
- Re: [Qemu-devel] [PULL 0/5] s390x fixes for 2.2, Christian Borntraeger, 2014/11/10