Skip to contentSkip to conversation

GTK terminal is broken

Qemu-devel Stefan Weil 4 participants 13 messages Jul 29, 2013 – Nov 15, 2013

lore
Share & tools
lore
#0 lore raw

Hello,

maybe most developers will already have noticed that the terminal output in QEMU's GTK user interface is broken. As far as I know, it never worked, but as there are working alternatives, I did not care much and forgot to report the issues.

See these snapshots which show the problems with QEMU's GTK terminals:

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo1.png

Here the first line of the QEMUmonitor is only partially visible. Tested with Cygwin/X on W64 host, QEMU running on Debian Linux. Other X servers (e.g. native X on Debian Linux) don't show this problem.

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo2.png

This shows crippled output of "help" in the QEMU monitor (look for "default frequency" at the bottom of the page). Tested with several X servers.

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo3.png

This shows crippled output in the QEMU serial console. The Linux kernel boot messages are hardly readable. Tested with several X servers, x86 and mips kernels, GTK 2 and GTK 3.

Regards,

StefanW.

#1 lore raw
Quoted 7 lines · Stefan Weil

Hello,

maybe most developers will already have noticed that the terminal output in QEMU's GTK user interface is broken. As far as I know, it never worked, but as there are working alternatives, I did not care much and forgot to report the issues.

Quoted 8 lines

See these snapshots which show the problems with QEMU's GTK terminals:

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo1.png

Here the first line of the QEMUmonitor is only partially visible. Tested with Cygwin/X on W64 host, QEMU running on Debian Linux. Other X servers (e.g. native X on Debian Linux) don't show this problem.

It's a GTK/Cygwin/X bug.

We use a vbox without anything particularly fancy happening. Looks like something is calculating layout incorrectly.

Regards,

Anthony Liguori

Quoted 18 lines

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo2.png

This shows crippled output of "help" in the QEMU monitor (look for "default frequency" at the bottom of the page). Tested with several X servers.

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo3.png

This shows crippled output in the QEMU serial console. The Linux kernel boot messages are hardly readable. Tested with several X servers, x86 and mips kernels, GTK 2 and GTK 3.

Regards,

StefanW.

#2 lore raw

Am 29.07.2013 20:05, schrieb Anthony Liguori:

Quoted 17 lines
Quoted 7 lines · Stefan Weil

Hello,

maybe most developers will already have noticed that the terminal output in QEMU's GTK user interface is broken. As far as I know, it never worked, but as there are working alternatives, I did not care much and forgot to report the issues.

Quoted 8 lines

See these snapshots which show the problems with QEMU's GTK terminals:

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo1.png

Here the first line of the QEMUmonitor is only partially visible. Tested with Cygwin/X on W64 host, QEMU running on Debian Linux. Other X servers (e.g. native X on Debian Linux) don't show this problem.

Quoted 8 lines

It's a GTK/Cygwin/X bug.

We use a vbox without anything particularly fancy happening. Looks like something is calculating layout incorrectly.

Regards,

Anthony Liguori

I miss a comment on the more important next two points. They are _not_ related to Cygwin / X.

Do you investigate them?

Quoted 18 lines
Quoted 18 lines

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo2.png

This shows crippled output of "help" in the QEMU monitor (look for "default frequency" at the bottom of the page). Tested with several X servers.

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo3.png

This shows crippled output in the QEMU serial console. The Linux kernel boot messages are hardly readable. Tested with several X servers, x86 and mips kernels, GTK 2 and GTK 3.

Regards,

StefanW.

#3 lore raw
Quoted 23 lines · Stefan Weil

Am 29.07.2013 20:05, schrieb Anthony Liguori:

Quoted 22 lines
Quoted 7 lines · Stefan Weil

Hello,

maybe most developers will already have noticed that the terminal output in QEMU's GTK user interface is broken. As far as I know, it never worked, but as there are working alternatives, I did not care much and forgot to report the issues.

Quoted 8 lines

See these snapshots which show the problems with QEMU's GTK terminals:

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo1.png

Here the first line of the QEMUmonitor is only partially visible. Tested with Cygwin/X on W64 host, QEMU running on Debian Linux. Other X servers (e.g. native X on Debian Linux) don't show this problem.

It's a GTK/Cygwin/X bug.

We use a vbox without anything particularly fancy happening. Looks like something is calculating layout incorrectly.

Quoted 8 lines
Quoted 3 lines

Regards,

Anthony Liguori

I miss a comment on the more important next two points. They are _not_ related to Cygwin / X.

Do you investigate them?

What you're seeing has always existed and is not GTK specific. There is not flow control on the outgoing side of serial emulation. Data will get dropped.

My guess is that your system is sufficiently slow and overloaded that it's happening a lot for you.

Regards,

Anthony Liguori

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo2.png

This shows crippled output of "help" in the QEMU monitor (look for "default frequency" at the bottom of the page). Tested with several X servers.

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo3.png

This shows crippled output in the QEMU serial console. The Linux kernel boot messages are hardly readable. Tested with several X servers, x86 and mips kernels, GTK 2 and GTK 3.

Regards,

StefanW.

#4 lore raw

Am 29.07.2013 20:55, schrieb Anthony Liguori:

Quoted 36 lines
Quoted 23 lines · Stefan Weil

Am 29.07.2013 20:05, schrieb Anthony Liguori:

Quoted 22 lines
Quoted 7 lines · Stefan Weil

Hello,

maybe most developers will already have noticed that the terminal output in QEMU's GTK user interface is broken. As far as I know, it never worked, but as there are working alternatives, I did not care much and forgot to report the issues.

Quoted 8 lines

See these snapshots which show the problems with QEMU's GTK terminals:

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo1.png

Here the first line of the QEMUmonitor is only partially visible. Tested with Cygwin/X on W64 host, QEMU running on Debian Linux. Other X servers (e.g. native X on Debian Linux) don't show this problem.

It's a GTK/Cygwin/X bug.

We use a vbox without anything particularly fancy happening. Looks like something is calculating layout incorrectly.

Quoted 7 lines
Quoted 3 lines

Regards,

Anthony Liguori

I miss a comment on the more important next two points. They are _not_ related to Cygwin / X.

Do you investigate them?

What you're seeing has always existed and is not GTK specific. There is not flow control on the outgoing side of serial emulation. Data will get dropped.

Quoted 6 lines

My guess is that your system is sufficiently slow and overloaded that it's happening a lot for you.

Regards,

Anthony Liguori

If it were as simply as that, that would be fine, but alas, it isn't. Even fast servers without any load show dropped characters. There are dropped characters for QEMU's monitor window (Alt-ctrl-2) and for Malta's line display (Alt-Ctrl-5). Neither of these two should suffer from missing flow control.

And even a current X.Org on Ubuntu shows the first bug (crippled first line) here, so it is not Cygwin / X specific.

None of the Linux hosts which I use in my test is able to display a correct Linux boot protocol on QEMU's GTK serial console window. All of them work with SDL or when the serial console is redirected to stdout.

Regards,

Stefan Weil

#5 lore raw

Am 29.07.2013 21:27, schrieb Stefan Weil:

Quoted 51 lines

Am 29.07.2013 20:55, schrieb Anthony Liguori:

Quoted 36 lines
Quoted 23 lines · Stefan Weil

Am 29.07.2013 20:05, schrieb Anthony Liguori:

Quoted 22 lines
Quoted 7 lines · Stefan Weil

Hello,

maybe most developers will already have noticed that the terminal output in QEMU's GTK user interface is broken. As far as I know, it never worked, but as there are working alternatives, I did not care much and forgot to report the issues.

Quoted 8 lines

See these snapshots which show the problems with QEMU's GTK terminals:

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo1.png

Here the first line of the QEMUmonitor is only partially visible. Tested with Cygwin/X on W64 host, QEMU running on Debian Linux. Other X servers (e.g. native X on Debian Linux) don't show this problem.

It's a GTK/Cygwin/X bug.

We use a vbox without anything particularly fancy happening. Looks like something is calculating layout incorrectly.

Quoted 7 lines
Quoted 3 lines

Regards,

Anthony Liguori

I miss a comment on the more important next two points. They are _not_ related to Cygwin / X.

Do you investigate them?

What you're seeing has always existed and is not GTK specific. There is not flow control on the outgoing side of serial emulation. Data will get dropped.

Quoted 6 lines

My guess is that your system is sufficiently slow and overloaded that it's happening a lot for you.

Regards,

Anthony Liguori

If it were as simply as that, that would be fine, but alas, it isn't. Even fast servers without any load show dropped characters. There are dropped characters for QEMU's monitor window (Alt-ctrl-2) and for Malta's line display (Alt-Ctrl-5). Neither of these two should suffer from missing flow control.

Quoted 2 lines

And even a current X.Org on Ubuntu shows the first bug (crippled first line) here, so it is not Cygwin / X specific.

FWIW I've been seeing similar garbled-Gtk-output issues on openSUSE 12.3 but didn't investigate further. -monitor stdio has so far not failed me on the same system by comparison.

One reproducible test case was the openrisc kernel that Jia provided recently.

Regards,
Andreas

Quoted 11 lines

None of the Linux hosts which I use in my test is able to display a correct Linux boot protocol on QEMU's GTK serial console window. All of them work with SDL or when the serial console is redirected to stdout.

Regards,

Stefan Weil

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#6 lore raw

Am 29.07.2013 22:34, schrieb Andreas Färber:

Quoted 57 lines

Am 29.07.2013 21:27, schrieb Stefan Weil:

Quoted 50 lines

Am 29.07.2013 20:55, schrieb Anthony Liguori:

Quoted 36 lines
Quoted 23 lines · Stefan Weil

Am 29.07.2013 20:05, schrieb Anthony Liguori:

Quoted 22 lines
Quoted 7 lines · Stefan Weil

Hello,

maybe most developers will already have noticed that the terminal output in QEMU's GTK user interface is broken. As far as I know, it never worked, but as there are working alternatives, I did not care much and forgot to report the issues.

Quoted 8 lines

See these snapshots which show the problems with QEMU's GTK terminals:

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo1.png

Here the first line of the QEMUmonitor is only partially visible. Tested with Cygwin/X on W64 host, QEMU running on Debian Linux. Other X servers (e.g. native X on Debian Linux) don't show this problem.

It's a GTK/Cygwin/X bug.

We use a vbox without anything particularly fancy happening. Looks like something is calculating layout incorrectly.

Quoted 7 lines
Quoted 3 lines

Regards,

Anthony Liguori

I miss a comment on the more important next two points. They are _not_ related to Cygwin / X.

Do you investigate them?

What you're seeing has always existed and is not GTK specific. There is not flow control on the outgoing side of serial emulation. Data will get dropped.

Quoted 6 lines

My guess is that your system is sufficiently slow and overloaded that it's happening a lot for you.

Regards,

Anthony Liguori

If it were as simply as that, that would be fine, but alas, it isn't. Even fast servers without any load show dropped characters. There are dropped characters for QEMU's monitor window (Alt-ctrl-2) and for Malta's line display (Alt-Ctrl-5). Neither of these two should suffer from missing flow control.

Quoted 2 lines

And even a current X.Org on Ubuntu shows the first bug (crippled first line) here, so it is not Cygwin / X specific.

FWIW I've been seeing similar garbled-Gtk-output issues on openSUSE 12.3 but didn't investigate further. -monitor stdio has so far not failed me on the same system by comparison.

Quoted 5 lines

One reproducible test case was the openrisc kernel that Jia provided recently.

Regards,
Andreas

Maybe the problems only occur with TCG, but not with KVM. That might explain why I get them more often than Anthony :-)

Up to now, I did not try GTK terminals with KVM because my typical test scenario uses MIPS or ARM boards on Intel hosts.

Regards,
Stefan

#7 lore raw
Quoted 61 lines · Stefan Weil

Am 29.07.2013 22:34, schrieb Andreas Färber:

Quoted 60 lines

Am 29.07.2013 21:27, schrieb Stefan Weil:

Quoted 50 lines

Am 29.07.2013 20:55, schrieb Anthony Liguori:

Quoted 36 lines
Quoted 23 lines · Stefan Weil

Am 29.07.2013 20:05, schrieb Anthony Liguori:

Quoted 22 lines
Quoted 7 lines · Stefan Weil

Hello,

maybe most developers will already have noticed that the terminal output in QEMU's GTK user interface is broken. As far as I know, it never worked, but as there are working alternatives, I did not care much and forgot to report the issues.

Quoted 8 lines

See these snapshots which show the problems with QEMU's GTK terminals:

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo1.png

Here the first line of the QEMUmonitor is only partially visible. Tested with Cygwin/X on W64 host, QEMU running on Debian Linux. Other X servers (e.g. native X on Debian Linux) don't show this problem.

It's a GTK/Cygwin/X bug.

We use a vbox without anything particularly fancy happening. Looks like something is calculating layout incorrectly.

Quoted 7 lines
Quoted 3 lines

Regards,

Anthony Liguori

I miss a comment on the more important next two points. They are _not_ related to Cygwin / X.

Do you investigate them?

What you're seeing has always existed and is not GTK specific. There is not flow control on the outgoing side of serial emulation. Data will get dropped.

Quoted 6 lines

My guess is that your system is sufficiently slow and overloaded that it's happening a lot for you.

Regards,

Anthony Liguori

If it were as simply as that, that would be fine, but alas, it isn't. Even fast servers without any load show dropped characters. There are dropped characters for QEMU's monitor window (Alt-ctrl-2) and for Malta's line display (Alt-Ctrl-5). Neither of these two should suffer from missing flow control.

Quoted 2 lines

And even a current X.Org on Ubuntu shows the first bug (crippled first line) here, so it is not Cygwin / X specific.

FWIW I've been seeing similar garbled-Gtk-output issues on openSUSE 12.3 but didn't investigate further. -monitor stdio has so far not failed me on the same system by comparison.

One reproducible test case was the openrisc kernel that Jia provided recently.

Quoted 8 lines
Quoted 2 lines

Regards,
Andreas

Maybe the problems only occur with TCG, but not with KVM. That might explain why I get them more often than Anthony :-)

Up to now, I did not try GTK terminals with KVM because my typical test scenario uses MIPS or ARM boards on Intel hosts.

x86 vs. other will come into play too.

The serial driver for x86 has some basic backoff logic. I suspect others don't.

My guess why you don't see this on -serial stdio is that it probably is using synchronous I/O.

Regards,

Anthony Liguori

Quoted 3 lines

Regards,
Stefan

#8 lore raw
In reply to Andreas Färber

Am 29.07.2013 22:34, schrieb Andreas Färber:

Quoted 3 lines

FWIW I've been seeing similar garbled-Gtk-output issues on openSUSE 12.3 but didn't investigate further. -monitor stdio has so far not failed me on the same system by comparison.

-serial stdio obviously. :)

Quoted 5 lines

One reproducible test case was the openrisc kernel that Jia provided recently.

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#9 lore raw
In reply to Stefan Weil
Quoted 23 lines · Stefan Weil

Am 29.07.2013 20:05, schrieb Anthony Liguori:

Quoted 22 lines
Quoted 7 lines · Stefan Weil

Hello,

maybe most developers will already have noticed that the terminal output in QEMU's GTK user interface is broken. As far as I know, it never worked, but as there are working alternatives, I did not care much and forgot to report the issues.

Quoted 8 lines

See these snapshots which show the problems with QEMU's GTK terminals:

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo1.png

Here the first line of the QEMUmonitor is only partially visible. Tested with Cygwin/X on W64 host, QEMU running on Debian Linux. Other X servers (e.g. native X on Debian Linux) don't show this problem.

It's a GTK/Cygwin/X bug.

We use a vbox without anything particularly fancy happening. Looks like something is calculating layout incorrectly.

Quoted 8 lines
Quoted 3 lines

Regards,

Anthony Liguori

I miss a comment on the more important next two points. They are _not_ related to Cygwin / X.

Do you investigate them?

I did some investigation, and the results are not pretty. I'm using RHEL-6.4 host OS (kernel, gtk, vte etc), with fresh upstream qemu. The command line (started as a mere user --> TCG) was

./qemu-system-x86_64 -cdrom /home/virt-images/isos/Fedora-18-x86_64-Live-XFCE.iso

Please find the attached debug patch (it has a small functional change as well, I'll discuss it below).

(a) The patch extends the qemu_hexdump() function with ASCII strings. I wanted to ask you to run your tests with this patch applied, and try to correlate the hexdumps with the breakage on the screen.

However, when testing the patch myself, I ran into problems.

(b) The patch adds a qemu_set_nonblock(slave_fd) call to gd_vc_init(). I tested the patch both with and without this hunk.

The key is to produce big output for VTE. For that purpose I waited until the Fedora 18 kernel enabled paging, and then issued "info tlb".

("info tlb" should be familiar from a recent monitor bugfix, as test case / trigger, but in bleeding edge qemu the monitor is OK.)

So, if I do not add (b), the debug patch starts to spew data to stderr, and after a while qemu hangs hard, in the write() call in gd_vc_chr_write().

If I add (b), then the same happens initially, followed by qemu spinning (ie. entering and exiting rapidly, without making any progress) gd_vc_chr_write(), with write() returning -1/EAGAIN.

VTE seems to expect the owner of the slave side to run in a different process or thread. While browsing vte_terminal_io_read(), I found some throttling code in the read path, where VTE tries to keep one child process (maybe running in one tab?) to monopolize it.

I think this could explain the deadlock / busy wait behavior. In qemu both sides of the terminal are manipulated by the same thread, and both file descriptors are (should be) added to the same GLib main loop. At some point VTE would be able read the master side but refuses to, the pty buffer becomes full, the slave-side write() in gd_vc_chr_write() blocks, and VTE never gets back control to release the throttle.

This doesn't explain why qemu never recovers when the slave side is set to non-blocking mode (ie. with (b) added). I suspect that although we manage to run circles around the main loop in this case, we either never reach the master-fd read in VTE, or VTE always decides it's still too early to read.

Laszlo

Quoted 1 line

From a598fb00caf89a02eb64145cdada559f9405235b Mon Sep 17 00:00:00 2001

From: Laszlo Ersek <[email protected]>
Date: Mon, 29 Jul 2013 21:27:04 +0200
Subject: [PATCH] gd_vc_chr_write(): print hexdump, set nonblock

---
 ui/gtk.c       |   14 +++++++++++++-
 util/hexdump.c |   39 ++++++++++++++++++++++++++++++++-------
 2 files changed, 45 insertions(+), 8 deletions(-)
ui/gtk.c +13 -1
index c38146f..c88bd37 100644
@@ -35,6 +35,7 @@
 #define LOCALEDIR "po"
 
 #include "qemu-common.h"
+#include "qemu/sockets.h"
 
 #ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
 /* Work around an -Wstrict-prototypes warning in GTK headers */
@@ -1119,8 +1120,18 @@ static gboolean gd_focus_out_event(GtkWidget *widget,
 static int gd_vc_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
 {
     VirtualConsole *vc = chr->opaque;
+    int written, errno_save;
 
-    return write(vc->fd, buf, len);
+    errno = 0;
+    written = write(vc->fd, buf, len);
+    errno_save = errno;
+
+    fprintf(stderr, "%s: len=%d written=%d errno=%d\n", __FUNCTION__, len,
+            written, errno);
+    qemu_hexdump((const char *)buf, stderr, __FUNCTION__, len);
+
+    errno = errno_save;
+    return written;
 }
 
 static int nb_vcs;
@@ -1213,6 +1224,7 @@ static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSL
     vte_terminal_set_size(VTE_TERMINAL(vc->terminal), 80, 25);
 
     vc->fd = slave_fd;
+    qemu_set_nonblock(slave_fd);
     vc->chr->opaque = vc;
     vc->scrolled_window = scrolled_window;
 
util/hexdump.c +32 -7
index 969b340..994fd69 100644
@@ -13,25 +13,50 @@
  * GNU GPL, version 2 or (at your option) any later version.
  */
 
+#include <ctype.h>
 #include "qemu-common.h"
 
+static void asciiize(const char *buf, FILE *fp, size_t size, unsigned *col)
+{
+    size_t i;
+
+    while (*col < 4 + 1 + 4 * (1 + 4 * (1 + 2))) {
+        fputc(' ', fp);
+        ++*col;
+    }
+    *col = 0;
+
+    fprintf(fp, "  '");
+    for (i = 0; i < size; ++i) {
+      unsigned char c = buf[i];
+
+      fputc(isprint(c) ? c : '.', fp);
+    }
+    fprintf(fp, "'\n");
+}
+
 void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t size)
 {
     unsigned int b;
+    unsigned pos, col;
 
     for (b = 0; b < size; b++) {
-        if ((b % 16) == 0) {
+        pos = b % 16;
+
+        if (pos == 0) {
             fprintf(fp, "%s: %04x:", prefix, b);
+            col = 5;
         }
         if ((b % 4) == 0) {
-            fprintf(fp, " ");
+            col += fprintf(fp, " ");
         }
-        fprintf(fp, " %02x", (unsigned char)buf[b]);
-        if ((b % 16) == 15) {
-            fprintf(fp, "\n");
+        col += fprintf(fp, " %02x", (unsigned char)buf[b]);
+        if (pos == 15) {
+          asciiize(buf + (b - 15), fp, 16, &col);
         }
     }
-    if ((b % 16) != 0) {
-        fprintf(fp, "\n");
+    pos = b % 16;
+    if (pos != 0) {
+        asciiize(buf + (b - pos), fp, pos, &col);
     }
 }
Signature · 1 line
1.7.1
#10 lore raw

Am 30.07.2013 00:35, schrieb Laszlo Ersek:

Quoted 75 lines · Stefan Weil
Quoted 23 lines

Am 29.07.2013 20:05, schrieb Anthony Liguori:

Quoted 22 lines
Quoted 7 lines · Stefan Weil

Hello,

maybe most developers will already have noticed that the terminal output in QEMU's GTK user interface is broken. As far as I know, it never worked, but as there are working alternatives, I did not care much and forgot to report the issues.

Quoted 8 lines

See these snapshots which show the problems with QEMU's GTK terminals:

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo1.png

Here the first line of the QEMUmonitor is only partially visible. Tested with Cygwin/X on W64 host, QEMU running on Debian Linux. Other X servers (e.g. native X on Debian Linux) don't show this problem.

It's a GTK/Cygwin/X bug.

We use a vbox without anything particularly fancy happening. Looks like something is calculating layout incorrectly.

Quoted 7 lines
Quoted 3 lines

Regards,

Anthony Liguori

I miss a comment on the more important next two points. They are _not_ related to Cygwin / X.

Do you investigate them?

I did some investigation, and the results are not pretty. I'm using RHEL-6.4 host OS (kernel, gtk, vte etc), with fresh upstream qemu. The command line (started as a mere user --> TCG) was

./qemu-system-x86_64 -cdrom /home/virt-images/isos/Fedora-18-x86_64-Live-XFCE.iso

Please find the attached debug patch (it has a small functional change as well, I'll discuss it below).

(a) The patch extends the qemu_hexdump() function with ASCII strings. I wanted to ask you to run your tests with this patch applied, and try to correlate the hexdumps with the breakage on the screen.

However, when testing the patch myself, I ran into problems.

(b) The patch adds a qemu_set_nonblock(slave_fd) call to gd_vc_init(). I tested the patch both with and without this hunk.

The key is to produce big output for VTE. For that purpose I waited until the Fedora 18 kernel enabled paging, and then issued "info tlb".

("info tlb" should be familiar from a recent monitor bugfix, as test case / trigger, but in bleeding edge qemu the monitor is OK.)

So, if I do not add (b), the debug patch starts to spew data to stderr, and after a while qemu hangs hard, in the write() call in gd_vc_chr_write().

If I add (b), then the same happens initially, followed by qemu spinning (ie. entering and exiting rapidly, without making any progress) gd_vc_chr_write(), with write() returning -1/EAGAIN.

VTE seems to expect the owner of the slave side to run in a different process or thread. While browsing vte_terminal_io_read(), I found some throttling code in the read path, where VTE tries to keep one child process (maybe running in one tab?) to monopolize it.

I think this could explain the deadlock / busy wait behavior. In qemu both sides of the terminal are manipulated by the same thread, and both file descriptors are (should be) added to the same GLib main loop. At some point VTE would be able read the master side but refuses to, the pty buffer becomes full, the slave-side write() in gd_vc_chr_write() blocks, and VTE never gets back control to release the throttle.

Quoted 7 lines

This doesn't explain why qemu never recovers when the slave side is set to non-blocking mode (ie. with (b) added). I suspect that although we manage to run circles around the main loop in this case, we either never reach the master-fd read in VTE, or VTE always decides it's still too early to read.

Laszlo

Thanks for your analysis. For me, it confirms that terminal emulation with GTK is currently unusable.

Here is one more obvious bug (tested on Linux):

1. Run qemu-system-i386 -L pc-bios with GTK UI.
2. Select "Show tabs".
3. Unselect "Show tabs".

In 3, blank lines are added on top and on the bottom of the BIOS boot text, so the screen in 3 is higher than in 1 although both should be identical.

Stefan

#11 lore raw
In reply to Stefan Weil

Am 29.07.2013 18:04, schrieb Stefan Weil:

Quoted 31 lines

Hello,

maybe most developers will already have noticed that the terminal output in QEMU's GTK user interface is broken. As far as I know, it never worked, but as there are working alternatives, I did not care much and forgot to report the issues.

See these snapshots which show the problems with QEMU's GTK terminals:

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo1.png

Here the first line of the QEMUmonitor is only partially visible. Tested with Cygwin/X on W64 host, QEMU running on Debian Linux. Other X servers (e.g. native X on Debian Linux) don't show this problem.

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo2.png

This shows crippled output of "help" in the QEMU monitor (look for "default frequency" at the bottom of the page). Tested with several X servers.

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo3.png

This shows crippled output in the QEMU serial console. The Linux kernel boot messages are hardly readable. Tested with several X servers, x86 and mips kernels, GTK 2 and GTK 3.

Quoted 4 lines

Regards,

StefanW.

This is just a reminder that the GTK terminal is still broken in QEMU 1.7. It only seems to work with KVM and in the monitor window, but it is unusable in serial consoles which are typically needed for embedded system emulation (ARM, MIPS, ...).

For GTK, it's not a regression because it never worked. All known hosts are affected. The serial console remains usable with SDL or stdio.

See this link for more details:
http://lists.nongnu.org/archive/html/qemu-devel/2013-07/msg05740.html

Regards,
Stefan

PS. For MinGW, I compile QEMU without console support because there is no VTE for that platform.

#12 lore raw

Am 14.11.2013 22:32, schrieb Stefan Weil:

Quoted 44 lines

Am 29.07.2013 18:04, schrieb Stefan Weil:

Quoted 31 lines

Hello,

maybe most developers will already have noticed that the terminal output in QEMU's GTK user interface is broken. As far as I know, it never worked, but as there are working alternatives, I did not care much and forgot to report the issues.

See these snapshots which show the problems with QEMU's GTK terminals:

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo1.png

Here the first line of the QEMUmonitor is only partially visible. Tested with Cygwin/X on W64 host, QEMU running on Debian Linux. Other X servers (e.g. native X on Debian Linux) don't show this problem.

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo2.png

This shows crippled output of "help" in the QEMU monitor (look for "default frequency" at the bottom of the page). Tested with several X servers.

http://qemu.weilnetz.de/test/bugs/qemu-gtk-demo3.png

This shows crippled output in the QEMU serial console. The Linux kernel boot messages are hardly readable. Tested with several X servers, x86 and mips kernels, GTK 2 and GTK 3.

Quoted 4 lines

Regards,

StefanW.

This is just a reminder that the GTK terminal is still broken in QEMU 1.7. It only seems to work with KVM and in the monitor window, but it is unusable in serial consoles which are typically needed for embedded system emulation (ARM, MIPS, ...).

For GTK, it's not a regression because it never worked. All known hosts are affected. The serial console remains usable with SDL or stdio.

Quoted 8 lines

See this link for more details:
http://lists.nongnu.org/archive/html/qemu-devel/2013-07/msg05740.html

Regards,
Stefan

PS. For MinGW, I compile QEMU without console support because there is no VTE for that platform.

Sorry, I used Anthony's old e-mail address, please fix when replying.

Here is another bug with GTK (any host), this time in the framebuffer window:

run qemu-system-i386 (BIOS only), enable tabs in the menu, disable tabs,compare the initial window with the BIOS messages with the final one - they differ in height.

Stefan