[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 38/58] sclpconsolelm: remove bogus check for -EAGAIN
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 38/58] sclpconsolelm: remove bogus check for -EAGAIN |
Date: |
Tue, 13 Sep 2016 19:16:09 +0200 |
From: "Daniel P. Berrange" <address@hidden>
The write_console_data() method in sclpconsole-lm.c checks
whether the return value of qemu_chr_fe_write() has the
value of -EAGAIN and if so then increments the buffer offset
by the value of EAGAIN. Fortunately qemu_chr_fe_write() will
never return EAGAIN directly, rather it returns -1 with
errno set to EAGAIN, so this broken code path was not
reachable. The behaviour on EAGAIN was stil bad though,
causing the write_console_data() to busy_wait repeatedly
calling qemu_chr_fe_write() with no sleep between iters.
Just remove all this loop logic and replace with a call
to qemu_chr_fe_write_all().
Acked-by: Cornelia Huck <address@hidden>
Signed-off-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/char/sclpconsole-lm.c | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)
diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c
index a22ad8d..dbe7531 100644
--- a/hw/char/sclpconsole-lm.c
+++ b/hw/char/sclpconsole-lm.c
@@ -191,9 +191,6 @@ static int read_event_data(SCLPEvent *event,
EventBufferHeader *evt_buf_hdr,
*/
static int write_console_data(SCLPEvent *event, const uint8_t *buf, int len)
{
- int ret = 0;
- const uint8_t *buf_offset;
-
SCLPConsoleLM *scon = SCLPLM_CONSOLE(event);
if (!scon->chr) {
@@ -201,21 +198,9 @@ static int write_console_data(SCLPEvent *event, const
uint8_t *buf, int len)
return len;
}
- buf_offset = buf;
- while (len > 0) {
- ret = qemu_chr_fe_write(scon->chr, buf, len);
- if (ret == 0) {
- /* a pty doesn't seem to be connected - no error */
- len = 0;
- } else if (ret == -EAGAIN || (ret > 0 && ret < len)) {
- len -= ret;
- buf_offset += ret;
- } else {
- len = 0;
- }
- }
-
- return ret;
+ /* XXX this blocks entire thread. Rewrite to use
+ * qemu_chr_fe_write and background I/O callbacks */
+ return qemu_chr_fe_write_all(scon->chr, buf, len);
}
static int process_mdb(SCLPEvent *event, MDBO *mdbo)
--
1.8.3.1
- [Qemu-devel] [PULL 26/58] scsi: mptconfig: fix misuse of MPTSAS_CONFIG_PACK, (continued)
- [Qemu-devel] [PULL 26/58] scsi: mptconfig: fix misuse of MPTSAS_CONFIG_PACK, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 27/58] vmxcap: Show raw MSR value, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 28/58] vmxcap: Add TSC scaling bit, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 30/58] chardev: Add 'help' option to print all available chardev backend types, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 29/58] doc/rcu: fix typo, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 31/58] MAINTAINERS: Fix wildcard for scsi headers, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 32/58] MAINTAINERS: Add some header files to the PC chipset section, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 35/58] default-configs: removed obsolete CONFIG_ISA_MMIO, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 33/58] scsi: pvscsi: limit loop to fetch SG list, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 34/58] default-configs: remove CONFIG_PAM, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 38/58] sclpconsolelm: remove bogus check for -EAGAIN,
Paolo Bonzini <=
- [Qemu-devel] [PULL 37/58] ipmi: check return of qemu_chr_fe_write() for errors, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 40/58] char: convert qemu_chr_fe_write to qemu_chr_fe_write_all, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 39/58] hw: replace most use of qemu_chr_fe_write with qemu_chr_fe_write_all, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 42/58] i8257: Make device "i8257" unavailable with -device, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 43/58] kvm-all: drop kvm_setup_guest_memory, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 41/58] Revert "megasas: remove useless check for cmd->frame", Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 36/58] default-configs: remove CONFIG_PIIX_PCI, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 45/58] atomics: Use __atomic_*_n() variant primitives, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 44/58] atomics: Remove redundant barrier()'s, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 46/58] checkpatch: Fix whitespace checks for documentation code blocks, Paolo Bonzini, 2016/09/13