Skip to contentSkip to conversation

ui/gtk: prevent QEMU lock up

PATCH In review Volker Rümelin 2 participants 3 messages Jul 25, 2021 – Jul 26, 2021

lore
Share & tools
lore
#0 lore raw

v2 cover ui/gtk: prevent QEMU lock up

Since commit 8eb13bbbac ("ui/gtk: vte: fix sending multiple characeters") it's very easy to lock up QEMU with the GTK ui. If you configure a guest with a serial device and the guest doesn't listen on this device, QEMU will lock up after entering two characters in the serial console.

v2:
Gerd suggested to use the chr_accept_input() callback function instead of a write retry timer and to drop patch 2/2.

Volker Rümelin (1):
  ui/gtk: add a keyboard fifo to the VTE consoles

 include/ui/gtk.h |  4 ++++
 ui/gtk.c         | 42 +++++++++++++++++++++++++++++++++---------

 2 files changed, 37 insertions(+), 9 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH v2 1/1 ui/gtk: add a keyboard fifo to the VTE consoles

Since commit 8eb13bbbac ("ui/gtk: vte: fix sending multiple characeters") it's very easy to lock up QEMU with the GTK ui. If you configure a guest with a serial device and the guest doesn't listen on this device, QEMU will lock up after entering two characters in the serial console. That's because current code uses a busy loop for the chardev write retries and the busy loop doesn't terminate in this case.

To fix this problem add a fifo to the VTE consoles and use the chr_accept_input() callback function to write the remaining characters in the queue to the chardev.

The fifo has a size of 4096 bytes, so one can copy and paste a fairly large URL or file path.

Fixes 8eb13bbbac ("ui/gtk: vte: fix sending multiple characeters")
---
 include/ui/gtk.h |  4 ++++
 ui/gtk.c         | 42 +++++++++++++++++++++++++++++++++---------
 2 files changed, 37 insertions(+), 9 deletions(-)
include/ui/gtk.h +4 -0
index 9516670ebc..80d6bbd9b5 100644
@@ -25,6 +25,9 @@
 #include "ui/egl-helpers.h"
 #include "ui/egl-context.h"
 #endif
+#ifdef CONFIG_VTE
+#include "qemu/fifo8.h"
+#endif
 
 #define MAX_VCS 10
 
@@ -62,6 +65,7 @@ typedef struct VirtualVteConsole {
     GtkWidget *scrollbar;
     GtkWidget *terminal;
     Chardev *chr;
+    Fifo8 out_fifo;
     bool echo;
 } VirtualVteConsole;
 #endif
ui/gtk.c +33 -9

79 lines not on this page · raw message

Signature · 1 line
2.26.2
#2 lore raw
In reply to Volker Rümelin

Hi,

Quoted 9 lines

Since commit 8eb13bbbac ("ui/gtk: vte: fix sending multiple characeters") it's very easy to lock up QEMU with the GTK ui. If you configure a guest with a serial device and the guest doesn't listen on this device, QEMU will lock up after entering two characters in the serial console.

v2:
Gerd suggested to use the chr_accept_input() callback function instead of a write retry timer and to drop patch 2/2.

Very nice and easy to read patch now.

Queued up for 6.1.

thanks,
Gerd