* [Qemu-devel] [PATCH for-2.1 v2] qemu-char: ignore flow control if a PTY's slave is not connected
@ 2014-07-24 16:08 Paolo Bonzini
0 siblings, 0 replies; only message in thread
From: Paolo Bonzini @ 2014-07-24 16:08 UTC (permalink / raw)
To: qemu-devel; +Cc: phrdina
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.
Tested-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
qemu-char.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/qemu-char.c b/qemu-char.c
index 7acc03f..956be49 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -1168,6 +1168,9 @@ 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;
+ if (!s->connected) {
+ return NULL;
+ }
return g_io_create_watch(s->fd, cond);
}
@@ -3664,6 +3667,10 @@ int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond,
}
src = s->chr_add_watch(s, cond);
+ if (!src) {
+ return -EINVAL;
+ }
+
g_source_set_callback(src, (GSourceFunc)func, user_data, NULL);
tag = g_source_attach(src, NULL);
g_source_unref(src);
--
1.8.3.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-07-24 16:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-24 16:08 [Qemu-devel] [PATCH for-2.1 v2] qemu-char: ignore flow control if a PTY's slave is not connected Paolo Bonzini
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).