qemu-char: ignore flow control if a PTY's slave is not connected
PATCH 1/1 qemu-char: ignore flow control if a PTY's slave is not connected
After commit f702e62 (serial: change retry logic to avoid concurrency, 2014-07-11), guest boot hangs if the backend is an unconnected PTY.
The reason is that PTYs do not support G_IO_HUP, and serial_xmit is never called. To fix this, simply invoke serial_xmit immediately (via g_idle_source_new) when this happens.
--- qemu-char.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
qemu-char.c +5 -1
@@ -1168,7 +1168,11 @@ static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len)static GSource *pty_chr_add_watch (CharDriverState *chr,GIOCondition cond) {PtyCharDriver *s = chr->opaque; -return g_io_create_watch (s->fd, cond); +if (!s->connected) { +return g_idle_source_new (); + }else { +return g_io_create_watch (s->fd, cond); + } }static int pty_chr_read_poll (void *opaque)
Signature · 1 line
1.8.3.1
Quoted 20 lines · Paolo Bonzini
After commit f702e62 (serial: change retry logic to avoid concurrency, 2014-07-11), guest boot hangs if the backend is an unconnected PTY.
The reason is that PTYs do not support
G_IO_HUP, andserial_xmitis never called. To fix this, simply invokeserial_xmitimmediately (viag_idle_source_new) when this happens.Signed-off-by Paolo Bonzini <[email protected]>--- qemu-char.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)qemu-char.c +0
-0@@ -1168,7 +1168,11 @@ static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len)static GSource *pty_chr_add_watch (CharDriverState *chr,GIOCondition cond) {
qemu-char.c static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len) · line 1178
Quoted 10 lines
qemu-char.c +5
-1PtyCharDriver *s = chr->opaque; -return g_io_create_watch (s->fd, cond); +if (!s->connected) { +return g_idle_source_new (); + }else { +return g_io_create_watch (s->fd, cond); + } }static int pty_chr_read_poll (void *opaque)
Sadly, it didn't fix the issue and a guest still don't boot up with serial console.
Pavel