Skip to contentSkip to conversation

QEMU monitor banner printed multiple times

Qemu-devel Thomas Huth 2 participants 2 messages Apr 25, 2018

lore
Share & tools
lore
#0 lore raw

Hi,

I just noticed that sometimes, the QEMU monitor banner is printed multiple times when you press "CTRL-a c" to enter the monitor:

$ x86_64-softmmu/qemu-system-x86_64 -no-shutdown -nographic \
    -nodefaults -virtioconsole mon:stdio
QEMU 2.12.0 monitor - type 'help' for more information
QEMU 2.12.0 monitor - type 'help' for more information
QEMU 2.12.0 monitor - type 'help' for more information
QEMU 2.12.0 monitor - type 'help' for more information
(qemu) q
QEMU 2.12.0 monitor - type 'help' for more information
(qemu)
$

That looks quite ugly. Anybody got an idea how to fix this?

Thomas

#1 lore raw

Hi

Quoted 16 lines · Thomas Huth

Hi,

I just noticed that sometimes, the QEMU monitor banner is printed multiple times when you press "CTRL-a c" to enter the monitor:

$ x86_64-softmmu/qemu-system-x86_64 -no-shutdown -nographic \
    -nodefaults - mon:stdio
QEMU 2.12.0 monitor - type 'help' for more information
QEMU 2.12.0 monitor - type 'help' for more information
QEMU 2.12.0 monitor - type 'help' for more information
QEMU 2.12.0 monitor - type 'help' for more information
(qemu) q
QEMU 2.12.0 monitor - type 'help' for more information
(qemu)
$
Quoted 1 line

That looks quite ugly. Anybody got an idea how to fix this?

virtio console creates many extra events.

It's not so trivial to fix given how mux works.

What seems easy and probably safe is the following change:

monitor.c +4 -3
index 39f8ee17ba..6f4646bf0c 100644
@@ -4411,8 +4411,10 @@ static void monitor_event(void *opaque, int event)
         break;
 
     case CHR_EVENT_OPENED:
-        monitor_printf(mon, "QEMU %s monitor - type 'help' for more "
-                       "information\n", QEMU_VERSION);
+        if (!mon->reset_seen) {
+            monitor_printf(mon, "QEMU %s monitor - type 'help' for more "
+                           "information\n", QEMU_VERSION);
+        }
 
 
-- 

Marc-André Lureau