qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: phrdina@redhat.com, batuzovk@ispras.ru
Subject: [Qemu-devel] [PATCH for-2.1] qemu-char: ignore flow control if a PTY's slave is not connected
Date: Thu, 24 Jul 2014 16:09:23 +0200	[thread overview]
Message-ID: <1406210963-15846-1-git-send-email-pbonzini@redhat.com> (raw)

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.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qemu-char.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/qemu-char.c b/qemu-char.c
index 7acc03f..64d3473 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -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)
-- 
1.8.3.1

             reply	other threads:[~2014-07-24 14:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-24 14:09 Paolo Bonzini [this message]
2014-07-24 15:42 ` [Qemu-devel] [PATCH for-2.1] qemu-char: ignore flow control if a PTY's slave is not connected Pavel Hrdina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406210963-15846-1-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=batuzovk@ispras.ru \
    --cc=phrdina@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).