All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1047470] [NEW] qemu/kvm hangs reading from serial console
@ 2012-09-07 15:47 Buck
  2012-09-07 18:07 ` [Qemu-devel] [Bug 1047470] " Buck
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Buck @ 2012-09-07 15:47 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

This is for a qemu-kvm running on RHEL 5, so it's pretty old,
but i think the problem still exists in 1.2

We have conman running on our hosts, connecting to the
kvm/qemu's using
    virsh console
which just opens up the console /dev/pts/slave that qemu
opens up when run with options
    -nographic
    -serial mon:pty

Sometimes virsh console exits and then qemu locks up.
My guess is that something like this happens:

virsh console exits
qemu does a select() on /dev/ptmx (and other FDs)
select() returns the FD of /dev/ptmx in the read-fdset
qemu does a read()
read() returns -1 (EIO)
qemu does other stuff for a while
select() ... /dev/ptmx
read() .. EIO
other stuff
select() ... read() ... select() ... read() ... select()
conman starts a new virsh console that connects
qemu does a read()
read() blocks b/c there is now a writer on the tty slave

So i don't see any way around this, given the sorta rudi-
mentary semantics of TTY IO on Linux (not that i know of
any platform that does it better ... ?), except ...

maybe qemu should
    fcntl(master_fd, F_SETFL, flags | O_NONBLOCK) 
in qemu-char.c:qemu_char_open_pty()
and be prepared to handle E_WOULDBLOCK|E_AGAIN in 
qemu-char.c:fd_chr_read() ... ?

--buck

[*] i think, b/c in the old version we are running, sometimes
    the guest spits out the
        ^]
    character to its console, and virsh console reads it and
    doesn't check to see if its from stdin or the pty and exits, 
    which, i think, can be fixed like this:

--- libvirt-0.8.2/tools/console.c.ctrl_close_bracket_handling_fix       2012-09-06 10:30:43.606997191 -0400
+++ libvirt-0.8.2/tools/console.c       2012-09-06 10:34:52.154000464 -0400
@@ -155,6 +155,7 @@ int vshRunConsole(const char *tty) {

                 /* Quit if end of file, or we got the Ctrl-] key */
                 if (!got ||
+                    fds[i].fd == STDIN_FILENO &&
                     (got == 1 &&
                      buf[0] == CTRL_CLOSE_BRACKET))
                     goto done;

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1047470

Title:
  qemu/kvm hangs reading from serial console

Status in QEMU:
  New

Bug description:
  This is for a qemu-kvm running on RHEL 5, so it's pretty old,
  but i think the problem still exists in 1.2

  We have conman running on our hosts, connecting to the
  kvm/qemu's using
      virsh console
  which just opens up the console /dev/pts/slave that qemu
  opens up when run with options
      -nographic
      -serial mon:pty

  Sometimes virsh console exits and then qemu locks up.
  My guess is that something like this happens:

  virsh console exits
  qemu does a select() on /dev/ptmx (and other FDs)
  select() returns the FD of /dev/ptmx in the read-fdset
  qemu does a read()
  read() returns -1 (EIO)
  qemu does other stuff for a while
  select() ... /dev/ptmx
  read() .. EIO
  other stuff
  select() ... read() ... select() ... read() ... select()
  conman starts a new virsh console that connects
  qemu does a read()
  read() blocks b/c there is now a writer on the tty slave

  So i don't see any way around this, given the sorta rudi-
  mentary semantics of TTY IO on Linux (not that i know of
  any platform that does it better ... ?), except ...

  maybe qemu should
      fcntl(master_fd, F_SETFL, flags | O_NONBLOCK) 
  in qemu-char.c:qemu_char_open_pty()
  and be prepared to handle E_WOULDBLOCK|E_AGAIN in 
  qemu-char.c:fd_chr_read() ... ?

  --buck

  [*] i think, b/c in the old version we are running, sometimes
      the guest spits out the
          ^]
      character to its console, and virsh console reads it and
      doesn't check to see if its from stdin or the pty and exits, 
      which, i think, can be fixed like this:

  --- libvirt-0.8.2/tools/console.c.ctrl_close_bracket_handling_fix       2012-09-06 10:30:43.606997191 -0400
  +++ libvirt-0.8.2/tools/console.c       2012-09-06 10:34:52.154000464 -0400
  @@ -155,6 +155,7 @@ int vshRunConsole(const char *tty) {

                   /* Quit if end of file, or we got the Ctrl-] key */
                   if (!got ||
  +                    fds[i].fd == STDIN_FILENO &&
                       (got == 1 &&
                        buf[0] == CTRL_CLOSE_BRACKET))
                       goto done;

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1047470/+subscriptions

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [Bug 1047470] Re: qemu/kvm hangs reading from serial console
  2012-09-07 15:47 [Qemu-devel] [Bug 1047470] [NEW] qemu/kvm hangs reading from serial console Buck
@ 2012-09-07 18:07 ` Buck
  2017-06-22 11:53 ` Thomas Huth
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Buck @ 2012-09-07 18:07 UTC (permalink / raw)
  To: qemu-devel

** Description changed:

  This is for a qemu-kvm running on RHEL 5, so it's pretty old,
  but i think the problem still exists in 1.2
  
  We have conman running on our hosts, connecting to the
  kvm/qemu's using
-     virsh console
+     virsh console
  which just opens up the console /dev/pts/slave that qemu
  opens up when run with options
-     -nographic
-     -serial mon:pty
+     -nographic
+     -serial mon:pty
  
- Sometimes virsh console exits and then qemu locks up.
+ Sometimes virsh console exits and then qemu locks up[*].
  My guess is that something like this happens:
  
  virsh console exits
  qemu does a select() on /dev/ptmx (and other FDs)
  select() returns the FD of /dev/ptmx in the read-fdset
  qemu does a read()
  read() returns -1 (EIO)
  qemu does other stuff for a while
  select() ... /dev/ptmx
  read() .. EIO
  other stuff
  select() ... read() ... select() ... read() ... select()
  conman starts a new virsh console that connects
  qemu does a read()
  read() blocks b/c there is now a writer on the tty slave
  
  So i don't see any way around this, given the sorta rudi-
  mentary semantics of TTY IO on Linux (not that i know of
  any platform that does it better ... ?), except ...
  
  maybe qemu should
-     fcntl(master_fd, F_SETFL, flags | O_NONBLOCK) 
+     fcntl(master_fd, F_SETFL, flags | O_NONBLOCK)
  in qemu-char.c:qemu_char_open_pty()
- and be prepared to handle E_WOULDBLOCK|E_AGAIN in 
+ and be prepared to handle E_WOULDBLOCK|E_AGAIN in
  qemu-char.c:fd_chr_read() ... ?
  
  --buck
  
  [*] i think, b/c in the old version we are running, sometimes
-     the guest spits out the
-         ^]
-     character to its console, and virsh console reads it and
-     doesn't check to see if its from stdin or the pty and exits, 
-     which, i think, can be fixed like this:
+     the guest spits out the
+         ^]
+     character to its console, and virsh console reads it and
+     doesn't check to see if its from stdin or the pty and exits,
+     which, i think, can be fixed like this:
  
  --- libvirt-0.8.2/tools/console.c.ctrl_close_bracket_handling_fix       2012-09-06 10:30:43.606997191 -0400
  +++ libvirt-0.8.2/tools/console.c       2012-09-06 10:34:52.154000464 -0400
  @@ -155,6 +155,7 @@ int vshRunConsole(const char *tty) {
  
-                  /* Quit if end of file, or we got the Ctrl-] key */
-                  if (!got ||
+                  /* Quit if end of file, or we got the Ctrl-] key */
+                  if (!got ||
  +                    fds[i].fd == STDIN_FILENO &&
-                      (got == 1 &&
-                       buf[0] == CTRL_CLOSE_BRACKET))
-                      goto done;
+                      (got == 1 &&
+                       buf[0] == CTRL_CLOSE_BRACKET))
+                      goto done;

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1047470

Title:
  qemu/kvm hangs reading from serial console

Status in QEMU:
  New

Bug description:
  This is for a qemu-kvm running on RHEL 5, so it's pretty old,
  but i think the problem still exists in 1.2

  We have conman running on our hosts, connecting to the
  kvm/qemu's using
      virsh console
  which just opens up the console /dev/pts/slave that qemu
  opens up when run with options
      -nographic
      -serial mon:pty

  Sometimes virsh console exits and then qemu locks up[*].
  My guess is that something like this happens:

  virsh console exits
  qemu does a select() on /dev/ptmx (and other FDs)
  select() returns the FD of /dev/ptmx in the read-fdset
  qemu does a read()
  read() returns -1 (EIO)
  qemu does other stuff for a while
  select() ... /dev/ptmx
  read() .. EIO
  other stuff
  select() ... read() ... select() ... read() ... select()
  conman starts a new virsh console that connects
  qemu does a read()
  read() blocks b/c there is now a writer on the tty slave

  So i don't see any way around this, given the sorta rudi-
  mentary semantics of TTY IO on Linux (not that i know of
  any platform that does it better ... ?), except ...

  maybe qemu should
      fcntl(master_fd, F_SETFL, flags | O_NONBLOCK)
  in qemu-char.c:qemu_char_open_pty()
  and be prepared to handle E_WOULDBLOCK|E_AGAIN in
  qemu-char.c:fd_chr_read() ... ?

  --buck

  [*] i think, b/c in the old version we are running, sometimes
      the guest spits out the
          ^]
      character to its console, and virsh console reads it and
      doesn't check to see if its from stdin or the pty and exits,
      which, i think, can be fixed like this:

  --- libvirt-0.8.2/tools/console.c.ctrl_close_bracket_handling_fix       2012-09-06 10:30:43.606997191 -0400
  +++ libvirt-0.8.2/tools/console.c       2012-09-06 10:34:52.154000464 -0400
  @@ -155,6 +155,7 @@ int vshRunConsole(const char *tty) {

                   /* Quit if end of file, or we got the Ctrl-] key */
                   if (!got ||
  +                    fds[i].fd == STDIN_FILENO &&
                       (got == 1 &&
                        buf[0] == CTRL_CLOSE_BRACKET))
                       goto done;

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1047470/+subscriptions

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [Bug 1047470] Re: qemu/kvm hangs reading from serial console
  2012-09-07 15:47 [Qemu-devel] [Bug 1047470] [NEW] qemu/kvm hangs reading from serial console Buck
  2012-09-07 18:07 ` [Qemu-devel] [Bug 1047470] " Buck
@ 2017-06-22 11:53 ` Thomas Huth
  2017-06-22 21:48 ` Buck
  2017-06-23  5:57 ` Thomas Huth
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2017-06-22 11:53 UTC (permalink / raw)
  To: qemu-devel

Can you still reproduce this problem with the latest version of QEMU?
There have been quite a bunch of fixes in this area in the latest
versions...

** Changed in: qemu
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1047470

Title:
  qemu/kvm hangs reading from serial console

Status in QEMU:
  Incomplete

Bug description:
  This is for a qemu-kvm running on RHEL 5, so it's pretty old,
  but i think the problem still exists in 1.2

  We have conman running on our hosts, connecting to the
  kvm/qemu's using
      virsh console
  which just opens up the console /dev/pts/slave that qemu
  opens up when run with options
      -nographic
      -serial mon:pty

  Sometimes virsh console exits and then qemu locks up[*].
  My guess is that something like this happens:

  virsh console exits
  qemu does a select() on /dev/ptmx (and other FDs)
  select() returns the FD of /dev/ptmx in the read-fdset
  qemu does a read()
  read() returns -1 (EIO)
  qemu does other stuff for a while
  select() ... /dev/ptmx
  read() .. EIO
  other stuff
  select() ... read() ... select() ... read() ... select()
  conman starts a new virsh console that connects
  qemu does a read()
  read() blocks b/c there is now a writer on the tty slave

  So i don't see any way around this, given the sorta rudi-
  mentary semantics of TTY IO on Linux (not that i know of
  any platform that does it better ... ?), except ...

  maybe qemu should
      fcntl(master_fd, F_SETFL, flags | O_NONBLOCK)
  in qemu-char.c:qemu_char_open_pty()
  and be prepared to handle E_WOULDBLOCK|E_AGAIN in
  qemu-char.c:fd_chr_read() ... ?

  --buck

  [*] i think, b/c in the old version we are running, sometimes
      the guest spits out the
          ^]
      character to its console, and virsh console reads it and
      doesn't check to see if its from stdin or the pty and exits,
      which, i think, can be fixed like this:

  --- libvirt-0.8.2/tools/console.c.ctrl_close_bracket_handling_fix       2012-09-06 10:30:43.606997191 -0400
  +++ libvirt-0.8.2/tools/console.c       2012-09-06 10:34:52.154000464 -0400
  @@ -155,6 +155,7 @@ int vshRunConsole(const char *tty) {

                   /* Quit if end of file, or we got the Ctrl-] key */
                   if (!got ||
  +                    fds[i].fd == STDIN_FILENO &&
                       (got == 1 &&
                        buf[0] == CTRL_CLOSE_BRACKET))
                       goto done;

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1047470/+subscriptions

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [Bug 1047470] Re: qemu/kvm hangs reading from serial console
  2012-09-07 15:47 [Qemu-devel] [Bug 1047470] [NEW] qemu/kvm hangs reading from serial console Buck
  2012-09-07 18:07 ` [Qemu-devel] [Bug 1047470] " Buck
  2017-06-22 11:53 ` Thomas Huth
@ 2017-06-22 21:48 ` Buck
  2017-06-23  5:57 ` Thomas Huth
  3 siblings, 0 replies; 5+ messages in thread
From: Buck @ 2017-06-22 21:48 UTC (permalink / raw)
  To: qemu-devel

i don't use kvm/qemu any more and so don't have a means
to determine if this is still an issue or not so please
presume fixed, i guess

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1047470

Title:
  qemu/kvm hangs reading from serial console

Status in QEMU:
  Incomplete

Bug description:
  This is for a qemu-kvm running on RHEL 5, so it's pretty old,
  but i think the problem still exists in 1.2

  We have conman running on our hosts, connecting to the
  kvm/qemu's using
      virsh console
  which just opens up the console /dev/pts/slave that qemu
  opens up when run with options
      -nographic
      -serial mon:pty

  Sometimes virsh console exits and then qemu locks up[*].
  My guess is that something like this happens:

  virsh console exits
  qemu does a select() on /dev/ptmx (and other FDs)
  select() returns the FD of /dev/ptmx in the read-fdset
  qemu does a read()
  read() returns -1 (EIO)
  qemu does other stuff for a while
  select() ... /dev/ptmx
  read() .. EIO
  other stuff
  select() ... read() ... select() ... read() ... select()
  conman starts a new virsh console that connects
  qemu does a read()
  read() blocks b/c there is now a writer on the tty slave

  So i don't see any way around this, given the sorta rudi-
  mentary semantics of TTY IO on Linux (not that i know of
  any platform that does it better ... ?), except ...

  maybe qemu should
      fcntl(master_fd, F_SETFL, flags | O_NONBLOCK)
  in qemu-char.c:qemu_char_open_pty()
  and be prepared to handle E_WOULDBLOCK|E_AGAIN in
  qemu-char.c:fd_chr_read() ... ?

  --buck

  [*] i think, b/c in the old version we are running, sometimes
      the guest spits out the
          ^]
      character to its console, and virsh console reads it and
      doesn't check to see if its from stdin or the pty and exits,
      which, i think, can be fixed like this:

  --- libvirt-0.8.2/tools/console.c.ctrl_close_bracket_handling_fix       2012-09-06 10:30:43.606997191 -0400
  +++ libvirt-0.8.2/tools/console.c       2012-09-06 10:34:52.154000464 -0400
  @@ -155,6 +155,7 @@ int vshRunConsole(const char *tty) {

                   /* Quit if end of file, or we got the Ctrl-] key */
                   if (!got ||
  +                    fds[i].fd == STDIN_FILENO &&
                       (got == 1 &&
                        buf[0] == CTRL_CLOSE_BRACKET))
                       goto done;

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1047470/+subscriptions

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [Bug 1047470] Re: qemu/kvm hangs reading from serial console
  2012-09-07 15:47 [Qemu-devel] [Bug 1047470] [NEW] qemu/kvm hangs reading from serial console Buck
                   ` (2 preceding siblings ...)
  2017-06-22 21:48 ` Buck
@ 2017-06-23  5:57 ` Thomas Huth
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2017-06-23  5:57 UTC (permalink / raw)
  To: qemu-devel

OK, thanks for your answer!

** Changed in: qemu
       Status: Incomplete => Won't Fix

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1047470

Title:
  qemu/kvm hangs reading from serial console

Status in QEMU:
  Won't Fix

Bug description:
  This is for a qemu-kvm running on RHEL 5, so it's pretty old,
  but i think the problem still exists in 1.2

  We have conman running on our hosts, connecting to the
  kvm/qemu's using
      virsh console
  which just opens up the console /dev/pts/slave that qemu
  opens up when run with options
      -nographic
      -serial mon:pty

  Sometimes virsh console exits and then qemu locks up[*].
  My guess is that something like this happens:

  virsh console exits
  qemu does a select() on /dev/ptmx (and other FDs)
  select() returns the FD of /dev/ptmx in the read-fdset
  qemu does a read()
  read() returns -1 (EIO)
  qemu does other stuff for a while
  select() ... /dev/ptmx
  read() .. EIO
  other stuff
  select() ... read() ... select() ... read() ... select()
  conman starts a new virsh console that connects
  qemu does a read()
  read() blocks b/c there is now a writer on the tty slave

  So i don't see any way around this, given the sorta rudi-
  mentary semantics of TTY IO on Linux (not that i know of
  any platform that does it better ... ?), except ...

  maybe qemu should
      fcntl(master_fd, F_SETFL, flags | O_NONBLOCK)
  in qemu-char.c:qemu_char_open_pty()
  and be prepared to handle E_WOULDBLOCK|E_AGAIN in
  qemu-char.c:fd_chr_read() ... ?

  --buck

  [*] i think, b/c in the old version we are running, sometimes
      the guest spits out the
          ^]
      character to its console, and virsh console reads it and
      doesn't check to see if its from stdin or the pty and exits,
      which, i think, can be fixed like this:

  --- libvirt-0.8.2/tools/console.c.ctrl_close_bracket_handling_fix       2012-09-06 10:30:43.606997191 -0400
  +++ libvirt-0.8.2/tools/console.c       2012-09-06 10:34:52.154000464 -0400
  @@ -155,6 +155,7 @@ int vshRunConsole(const char *tty) {

                   /* Quit if end of file, or we got the Ctrl-] key */
                   if (!got ||
  +                    fds[i].fd == STDIN_FILENO &&
                       (got == 1 &&
                        buf[0] == CTRL_CLOSE_BRACKET))
                       goto done;

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1047470/+subscriptions

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-06-23  6:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-07 15:47 [Qemu-devel] [Bug 1047470] [NEW] qemu/kvm hangs reading from serial console Buck
2012-09-07 18:07 ` [Qemu-devel] [Bug 1047470] " Buck
2017-06-22 11:53 ` Thomas Huth
2017-06-22 21:48 ` Buck
2017-06-23  5:57 ` Thomas Huth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.