Skip to contentSkip to conversation

Strange monitor/stdout issue on qemu-system-sparc/qemu-system-ppc

Qemu-devel Mark Cave-Ayland 3 participants 9 messages Jan 31, 2016 – Feb 8, 2016

lore
Share & tools
lore
#0 lore raw

Hi Daniel,

Commit d0d7708ba29cbcc343364a46bff981e0ff88366f "qemu-char: add logfile facility to all chardev backends" appears to be causing problems with the monitor and stdin/stdout on both qemu-system-sparc/qemu-system-ppc here.

On current git master I see the following behaviour changes when launching qemu-system-ppc/qemu-system-sparc directly from the command line with no parameters:

- Serial port output is now also written to stdout

- The monitor output also appears on stdout by default, rather than being enabled with CTRL-A-c. However if I enter this sequence manually on stdin then I am unable to enter or interact with the monitor.

- If I use the gtk interface to switch to the monitor terminal and attempt to type, I get multiple copies of each letter echoed back in the graphical terminal

Are there other changes that need to be made to these targets in order for the functionality to work as before?

Many thanks,

Mark.

#1 lore raw
Quoted 5 lines · Mark Cave-Ayland

Hi Daniel,

Commit d0d7708ba29cbcc343364a46bff981e0ff88366f "qemu-char: add logfile facility to all chardev backends" appears to be causing problems with the monitor and stdin/stdout on both qemu-system-sparc/qemu-system-ppc here.

These should be fixed by https://patchwork.ozlabs.org/patch/571128/
I think (the duplicate output at least; the multiple-echoback I'm not so sure about).

thanks
-- PMM

#2 lore raw
Quoted 11 lines · Peter Maydell
Quoted 5 lines · Mark Cave-Ayland

Hi Daniel,

Commit d0d7708ba29cbcc343364a46bff981e0ff88366f "qemu-char: add logfile facility to all chardev backends" appears to be causing problems with the monitor and stdin/stdout on both qemu-system-sparc/qemu-system-ppc here.

These should be fixed by https://patchwork.ozlabs.org/patch/571128/
I think (the duplicate output at least; the multiple-echoback I'm not so sure about).

Aha! A quick test here shows that the patch fixes the serial port appearing on stdout and entering the monitor, but I still see the multiple echo problem in the GTK GUI.

I also notice that with the above commit I lose cycling through history in the GTK monitor - even with the multiple echo, instead of the up/down arrow keys cycling through the history instead I see the codes ^[[B and ^[[A being output to the window instead.

ATB,

Mark.

#3 lore raw
Quoted 8 lines · Mark Cave-Ayland

Aha! A quick test here shows that the patch fixes the serial port appearing on stdout and entering the monitor, but I still see the multiple echo problem in the GTK GUI.

I also notice that with the above commit I lose cycling through history in the GTK monitor - even with the multiple echo, instead of the up/down arrow keys cycling through the history instead I see the codes ^[[B and ^[[A being output to the window instead.

That is probably me. The echo feature was introduced for QMP, but in theory it should have been limited to that. I'll check it, thanks.

Paolo

#4 lore raw
Quoted 8 lines · Paolo Bonzini
Quoted 4 lines · Mark Cave-Ayland

I also notice that with the above commit I lose cycling through history in the GTK monitor - even with the multiple echo, instead of the up/down arrow keys cycling through the history instead I see the codes ^[[B and ^[[A being output to the window instead.

That is probably me. The echo feature was introduced for QMP, but in theory it should have been limited to that. I'll check it, thanks.

I've also seen echo, but only intermittently...

thanks
-- PMM

#5 lore raw
Quoted 11 lines · Peter Maydell
Quoted 8 lines · Paolo Bonzini
Quoted 4 lines · Mark Cave-Ayland

I also notice that with the above commit I lose cycling through history in the GTK monitor - even with the multiple echo, instead of the up/down arrow keys cycling through the history instead I see the codes ^[[B and ^[[A being output to the window instead.

That is probably me. The echo feature was introduced for QMP, but in theory it should have been limited to that. I'll check it, thanks.

I've also seen echo, but only intermittently...

That smells like uninitialized memory or something like that.

Actually I'm fairly sure I tested "-monitor vc" at least, so perhaps it's an interaction between the echo feature and "qemu-char: add logfile facility to all chardev backends". Anyway I'll look at it.

Paolo

#6 lore raw
Quoted 11 lines · Paolo Bonzini
Quoted 10 lines · Peter Maydell
Quoted 8 lines · Paolo Bonzini
Quoted 4 lines · Mark Cave-Ayland

I also notice that with the above commit I lose cycling through history in the GTK monitor - even with the multiple echo, instead of the up/down arrow keys cycling through the history instead I see the codes ^[[B and ^[[A being output to the window instead.

That is probably me. The echo feature was introduced for QMP, but in theory it should have been limited to that. I'll check it, thanks.

Quoted 7 lines
Quoted 1 line

I've also seen echo, but only intermittently...

That smells like uninitialized memory or something like that.

Actually I'm fairly sure I tested "-monitor vc" at least, so perhaps it's an interaction between the echo feature and "qemu-char: add logfile facility to all chardev backends". Anyway I'll look at it.

Yeah I think you're right. I did a little bit of testing yesterday and the echo disappeared until I remembered that I'd been testing a self-built OpenBIOS - and as soon as I reintroduced this option onto the command line, the echo magically re-appeared.

I can reproduce this consistently under qemu-system-ppc git master like this:

make distclean
STRIP= './configure' '--target-list=ppc-softmmu' '--prefix=/home/build/rel-qemu-git' '--enable-gtk' '--disable-pie'

and then specifying a -bios parameter on the command line (even if it is the same file as that normally used by QEMU):

$ ./qemu-system-ppc -bios ../share/qemu/openbios-ppc

Now try typing into the GTK monitor window and hopefully you should be able to see the problem.

ATB,

Mark.

#7 lore raw
In reply to Mark Cave-Ayland
Quoted 3 lines · Mark Cave-Ayland

Aha! A quick test here shows that the patch fixes the serial port appearing on stdout and entering the monitor, but I still see the multiple echo problem in the GTK GUI.

And this should be it; if this fixes all your problems I will submit it for inclusion.

Thanks,

Paolo

----------------- 8< ---------------
From: Paolo Bonzini <[email protected]>
Subject: [PATCH] gtk: fix uninitialized temporary VirtualConsole

Only the echo field is used in the temporary VirtualConsole, so the damage was limited. But still, if echo was incorrectly set to true, the result would be some puzzling output in VTE monitor and serial consoles.

Fixes fba958c692e47a373d15c1fd3d72b255bf76adbd
ui/gtk.c +1 -1
index c8dbd5c..e106493 100644
@@ -1612,7 +1612,7 @@ static CharDriverState *gd_vc_handler(ChardevVC *vc, Error **errp)
     chr->chr_set_echo = gd_vc_chr_set_echo;
 
     /* Temporary, until gd_vc_vte_init runs.  */
-    chr->opaque = g_new(VirtualConsole, 1);
+    chr->opaque = g_new0(VirtualConsole, 1);
 
     /* defer OPENED events until our vc is fully initialized */
     chr->explicit_be_open = true;
#8 lore raw
Quoted 29 lines · Paolo Bonzini
Quoted 3 lines · Mark Cave-Ayland

Aha! A quick test here shows that the patch fixes the serial port appearing on stdout and entering the monitor, but I still see the multiple echo problem in the GTK GUI.

And this should be it; if this fixes all your problems I will submit it for inclusion.

Thanks,

Paolo

----------------- 8< ---------------
From: Paolo Bonzini <[email protected]>
Subject: [PATCH] gtk: fix uninitialized temporary VirtualConsole

Only the echo field is used in the temporary VirtualConsole, so the damage was limited. But still, if echo was incorrectly set to true, the result would be some puzzling output in VTE monitor and serial consoles.

Fixes fba958c692e47a373d15c1fd3d72b255bf76adbd
ui/gtk.c +0 -0
index c8dbd5c..e106493 100644

ui/gtk.c static CharDriverState *gd_vc_handler(ChardevVC *vc, Error **errp) · line 1618

Quoted 8 lines
ui/gtk.c +1 -1
@@ -1612,7 +1612,7 @@ static CharDriverState *gd_vc_handler(ChardevVC *vc, Error **errp)
     chr->chr_set_echo = gd_vc_chr_set_echo;
 
     /* Temporary, until gd_vc_vte_init runs.  */
-    chr->opaque = g_new(VirtualConsole, 1);
+    chr->opaque = g_new0(VirtualConsole, 1);
 
     /* defer OPENED events until our vc is fully initialized */
     chr->explicit_be_open = true;

Hi Paolo,

Thanks for the patch, I can confirm it fixes the local echo issue for me. However I still see one more issue in the GTK monitor (I seem to be doing well here) whereby the width of the GTK console changes size.

With git master, I start up qemu-system-ppc with the GTK interface, switch to the monitor and type help which gives this output:
https://www.ilande.co.uk/tmp/help1.png. If I then type help again then the output looks like https://www.ilande.co.uk/tmp/help2.png. In effect, it looks like the width of the window is 3 characters too wide but only for the first command.

ATB,

Mark.