|
|
b28c64 |
From 1e2929d890fb4cc88162b9771ed93b1c61f89b33 Mon Sep 17 00:00:00 2001
|
|
|
b28c64 |
From: Fam Zheng <famz@redhat.com>
|
|
|
b28c64 |
Date: Fri, 19 May 2017 00:35:14 +0200
|
|
|
b28c64 |
Subject: [PATCH 09/18] qemu-char: ignore flow control if a PTY's slave is not
|
|
|
b28c64 |
connected
|
|
|
b28c64 |
|
|
|
b28c64 |
RH-Author: Fam Zheng <famz@redhat.com>
|
|
|
b28c64 |
Message-id: <20170519003523.21163-10-famz@redhat.com>
|
|
|
b28c64 |
Patchwork-id: 75364
|
|
|
b28c64 |
O-Subject: [RHEL-7.3.z qemu-kvm PATCH 09/18] qemu-char: ignore flow control if a PTY's slave is not connected
|
|
|
b28c64 |
Bugzilla: 1452332
|
|
|
b28c64 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
b28c64 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
b28c64 |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
b28c64 |
|
|
|
b28c64 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
b28c64 |
|
|
|
b28c64 |
After commit f702e62 (serial: change retry logic to avoid concurrency,
|
|
|
b28c64 |
2014-07-11), guest boot hangs if the backend is an unconnected PTY.
|
|
|
b28c64 |
|
|
|
b28c64 |
The reason is that PTYs do not support G_IO_HUP, and serial_xmit is
|
|
|
b28c64 |
never called. To fix this, simply invoke serial_xmit immediately
|
|
|
b28c64 |
(via g_idle_source_new) when this happens.
|
|
|
b28c64 |
|
|
|
b28c64 |
Tested-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
b28c64 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
b28c64 |
(cherry picked from commit 62c339c5272ce8fbe8ca52695cee8ff40da7872e)
|
|
|
b28c64 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
b28c64 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
b28c64 |
---
|
|
|
b28c64 |
qemu-char.c | 7 +++++++
|
|
|
b28c64 |
1 file changed, 7 insertions(+)
|
|
|
b28c64 |
|
|
|
b28c64 |
diff --git a/qemu-char.c b/qemu-char.c
|
|
|
b28c64 |
index 47ac55a..08cb959 100644
|
|
|
b28c64 |
--- a/qemu-char.c
|
|
|
b28c64 |
+++ b/qemu-char.c
|
|
|
b28c64 |
@@ -1068,6 +1068,9 @@ static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
|
|
|
b28c64 |
static GSource *pty_chr_add_watch(CharDriverState *chr, GIOCondition cond)
|
|
|
b28c64 |
{
|
|
|
b28c64 |
PtyCharDriver *s = chr->opaque;
|
|
|
b28c64 |
+ if (!s->connected) {
|
|
|
b28c64 |
+ return NULL;
|
|
|
b28c64 |
+ }
|
|
|
b28c64 |
return g_io_create_watch(s->fd, cond);
|
|
|
b28c64 |
}
|
|
|
b28c64 |
|
|
|
b28c64 |
@@ -3381,6 +3384,10 @@ int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond,
|
|
|
b28c64 |
}
|
|
|
b28c64 |
|
|
|
b28c64 |
src = s->chr_add_watch(s, cond);
|
|
|
b28c64 |
+ if (!src) {
|
|
|
b28c64 |
+ return -EINVAL;
|
|
|
b28c64 |
+ }
|
|
|
b28c64 |
+
|
|
|
b28c64 |
g_source_set_callback(src, (GSourceFunc)func, user_data, NULL);
|
|
|
b28c64 |
tag = g_source_attach(src, NULL);
|
|
|
b28c64 |
g_source_unref(src);
|
|
|
b28c64 |
--
|
|
|
b28c64 |
1.8.3.1
|
|
|
b28c64 |
|