-serial stdio broken
I guess e1c09175bc00dd8dfb2ad1b26e1858dcdc109b59 or 998bbd74b9d813b14a3a3b5009a5d5a48c7dce51 broke -serial stdio for all targets:
qemu -serial stdio -monitor stdio
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': No such file or directory
Quoted 7 lines · Blue Swirl
I guess
e1c09175bc00dd8dfb2ad1b26e1858dcdc109b59or998bbd74b9d813b14a3a3b5009a5d5a48c7dce51broke -serial stdio for all targets:
qemu -serial stdio -monitor stdio
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': No such file or directory
e1c09175bc00dd8dfb2ad1b26e1858dcdc109b59 is first bad commit commit e1c09175bc00dd8dfb2ad1b26e1858dcdc109b59
Author: Gerd Hoffmann <[email protected]> Date: Tue Dec 8 13:11:44 2009 +0100
zap serial_monitor_mux
The logic in this code obviously predates the multiple monitor capability of qemu and looks increasingly silly these days.
I think the intention of this piece of code is to get a reasonable default for the -nographic case: have monitor and serial line muxed on stdio.
With the new default_serial and default_monitor variables we have now doing just that became much easier ;)
:100644 100644 0d3f5e6687934a94e8586a13b2f5b7432065c430e3e035f45349c8a2a86317dc46575c899acc8321 M vl.c
git revert e1c09175bc00dd8dfb2ad1b26e1858dcdc109b59 Auto-merged vl.c
CONFLICT (content): Merge conflict in vl.c
Automatic revert failed. After resolving the conflicts, mark the corrected paths with 'git add <paths>' or 'git rm <paths>' and commit the result.
My attempt to merge (attached) does not compile:
/src/qemu/vl.c: In function 'serial_monitor_mux':
/src/qemu/vl.c:4795: error: 'DEV_MONITOR' undeclared (first use in this function)
/src/qemu/vl.c:4795: error: (Each undeclared identifier is reported only once /src/qemu/vl.c:4795: error: for each function it appears in.)
Please fix ASAP, this happens to break my test setup completely.
From 6cd63368ca954d4a87de0e8bade735e631a546c6 Mon Sep 17 00:00:00 2001
From: Blue Swirl <[email protected]>
Date: Sun, 13 Dec 2009 09:32:18 +0000
Subject: [PATCH] Revert "zap serial_monitor_mux"
This reverts commit e1c09175bc00dd8dfb2ad1b26e1858dcdc109b59. It broke -serial stdio -monitor stdio case.
Conflicts:
vl.c
--- vl.c | 36 ++++++++++++++++++++++++++++++++++-- 1 files changed, 34 insertions(+), 2 deletions(-)
vl.c +34 -2
@@ -4786,6 +4786,33 @@ static int foreach_device_config(int type, int (*func)(const char *cmdline))return 0 ; } +static void serial_monitor_mux (void ) +{ +struct device_config *mon0, *serial; +const char *devname; + + QTAILQ_FOREACH(mon0, &device_configs, next) { +if (mon0->type !=DEV_MONITOR ) +continue ; +if (strcmp (mon0->cmdline,"stdio" ) !=0 ) +return ; +break ; + } + QTAILQ_FOREACH(serial, &device_configs, next) { +if (serial->type !=DEV_SERIAL ) +continue ; + devname = serial->cmdline; +if (devname && !strcmp (devname,"mon:stdio" )) { +QTAILQ_REMOVE (&device_configs, mon0, next); +break ; + }else if (devname && !strcmp (devname,"stdio" )) { +QTAILQ_REMOVE (&device_configs, mon0, next); + serial->cmdline ="mon:stdio" ; +break ; + } + } +} +static int serial_parse (const char *devname) {static int index =0 ;
@@ -5691,10 +5718,12 @@ int main(int argc, char **argv, char **envp) }if (display_type ==DT_NOGRAPHIC ) { +if (default_serial) +add_device_config (DEV_SERIAL ,"stdio" );if (default_parallel)add_device_config (DEV_PARALLEL ,"null" ); -if (default_serial && default_monitor) { -add_device_config (DEV_SERIAL ,"mon:stdio" ); +if (default_monitor) +add_device_config (DEV_MONITOR ,"stdio" ); }else if (default_virtcon && default_monitor) {add_device_config (DEV_VIRTCON ,"mon:stdio" ); }else {
@@ -5866,6 +5895,9 @@ int main(int argc, char **argv, char **envp)register_savevm_live ("ram" ,0 ,3 ,NULL , ram_save_live,NULL , ram_load,NULL ); +/* Maintain compatibility with multiple stdio monitors */ +serial_monitor_mux (); +if (nb_numa_nodes >0 ) {int i;
Signature · 1 line
1.5.6.5
Quoted 5 lines · Blue Swirl
Quoted 4 lines · Blue Swirl
I guess
e1c09175bc00dd8dfb2ad1b26e1858dcdc109b59or998bbd74b9d813b14a3a3b5009a5d5a48c7dce51broke -serial stdio for all targets:
qemu -serial stdio -monitor stdio
Oh. It is actually used on the command line. Hmm.
First, you can use '-serial mon:stdio' instead.
Second, with 'qemu -nographic' you don't need to specify this at all because that is the default.
What is gone now is the automagic conversion of '-serial stdio -monitor stdio' into '-serial mon:stdio' because I didn't expect people actually using that on the command line (see commit message). Also this kind of post-processing is pretty horrible thing for the command line parser code. Thus I would pretty much prefer to not re-introduce this ...
Can you live with one of the alternatives outlined above?
cheers,
Gerd
Quoted 13 lines · Gerd Hoffmann
Quoted 7 lines · Blue Swirl
Quoted 5 lines · Blue Swirl
I guess
e1c09175bc00dd8dfb2ad1b26e1858dcdc109b59or998bbd74b9d813b14a3a3b5009a5d5a48c7dce51broke -serial stdio for all targets:
qemu -serial stdio -monitor stdioOh. It is actually used on the command line. Hmm.
First, you can use '-serial mon:stdio' instead.
Quoted 8 lines
Second, with 'qemu -nographic' you don't need to specify this at all because that is the default.
What is gone now is the automagic conversion of '-serial stdio -monitor stdio' into '-serial mon:stdio' because I didn't expect people actually using that on the command line (see commit message). Also this kind of post-processing is pretty horrible thing for the command line parser code. Thus I would pretty much prefer to not re-introduce this ...
It looks like vl.c was a poor place to do the mux choice. I just wonder why mux option can't be automatically enabled for stdio in qemu-char.c:qemu_chr_parse_compat() or somewhere nearby.
Quoted 1 line
Can you live with one of the alternatives outlined above?
I removed -monitor stdio from all my tests, now they work.
Quoted 3 lines
It looks like
vl.cwas a poor place to do the mux choice. I just wonder why mux option can't be automatically enabled for stdio in qemu-char.c:qemu_chr_parse_compat() or somewhere nearby.
The mux driver grabs the 'Ctrl-a' hotkey, so I wouldn't enable that unconditionally because the chardev isn't transparent any more with mux enabled.
It also wouldn't really help with command line parsing.
cheers,
Gerd
Quoted 6 lines · Blue Swirl
I guess
e1c09175bc00dd8dfb2ad1b26e1858dcdc109b59or998bbd74b9d813b14a3a3b5009a5d5a48c7dce51broke -serial stdio for all targets:
qemu -serial stdio -monitor stdio
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': No such file or directory
-serial stdio on its own is broken for me (qemu from git). The error is a little bit different, so I don't think this is the same bug:
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': Invalid argument
The full command line is:
$qemudir/x86_64-softmmu/qemu-system-x86_64 \
-L $qemudir/pc-bios \
-drive file=/tmp/test.img,cache=off,if=ide \
-m 500 \
-no-reboot \
-nographic \
-serial stdio \
-no-hpet \
-net user,vlan=0,net=10.0.2.0/8 \
-net nic,model=virtio,vlan=0 \
-kernel /tmp/libguestfsUnRd8H/kernel \
-initrd /tmp/libguestfsUnRd8H/initrd \
-append 'panic=1 console=ttyS0 udevtimeout=300 noapic acpi=off printk.time=1 cgroup_disable=memory selinux=0 guestfs_vmchannel=tcp:10.0.2.2:36065 guestfs_verbose=1 'I'll look into this a bit further now.
Rich.
Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
Quoted 2 lines · Richard W.M. Jones
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': Invalid argument
Or sometimes:
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': Success
(!)
So what seems to be happening here is there is an implicit monitor being set up which grabs stdio. Because:
#define STDIO_MAX_CLIENTS 1
my own -serial stdio option subsequently fails. This is a regression over previous behaviour. I didn't specify a monitor device, because I don't want one, and previous versions of qemu didn't give me one in nographic mode.
Rich.
Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
Hi,
Quoted 9 lines
So what seems to be happening here is there is an implicit monitor being set up which grabs stdio. Because:
#define STDIO_MAX_CLIENTS 1my own -serial stdio option subsequently fails. This is a regression over previous behaviour. I didn't specify a monitor device, because I don't want one, and previous versions of qemu didn't give me one in nographic mode.
They gave you a monitor too. Try typing 'Ctrl-A c' on stdio, and you'll see. qemu tries to be more clever than you. Which sucks IMHO. But getting rid of that without adding regressions seems to be really hard ...
Easiest way to workaround this is to simply not specify '-serial stdio'.
It is the default anyway for -nographic, so you don't have to.
cheers,
Gerd
Quoted 12 lines · Gerd Hoffmann
Hi,
Quoted 9 lines
So what seems to be happening here is there is an implicit monitor being set up which grabs stdio. Because:
#define STDIO_MAX_CLIENTS 1my own -serial stdio option subsequently fails. This is a regression over previous behaviour. I didn't specify a monitor device, because I don't want one, and previous versions of qemu didn't give me one in nographic mode.
Quoted 7 lines
They gave you a monitor too. Try typing 'Ctrl-A c' on stdio, and you'll see. qemu tries to be more clever than you. Which sucks IMHO. But getting rid of that without adding regressions seems to be really hard
...Easiest way to workaround this is to simply not specify '-serial stdio'.
It is the default anyway for -nographic, so you don't have to.
I want to see the output of the serial port on stdio though. I don't care at all about the monitor.
Rich.
Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
Quoted 20 lines · Richard W.M. Jones
Quoted 18 lines · Gerd Hoffmann
Hi,Quoted 10 lines
So what seems to be happening here is there is an implicit monitor being set up which grabs stdio. Because:
#define STDIO_MAX_CLIENTS 1my own -serial stdio option subsequently fails. This is a regression over previous behaviour. I didn't specify a monitor device, because I don't want one, and previous versions of qemu didn't give me one in nographic mode.
They gave you a monitor too. Try typing 'Ctrl-A c' on stdio, and you'll see. qemu tries to be more clever than you. Which sucks IMHO. But getting rid of that without adding regressions seems to be really hard
...
Quoted 6 lines
Quoted 3 lines
Easiest way to workaround this is to simply not specify '-serial stdio'.
It is the default anyway for -nographic, so you don't have to.I want to see the output of the serial port on stdio though. I don't care at all about the monitor.
-nographic gives you that.
nographic is a terrible name. It really is, use this mode if you want to run something and only interact with it through the serial console.
Regards,
Anthony Liguori
Quoted 15 lines · Richard W.M. Jones
Quoted 3 lines · Richard W.M. Jones
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': Invalid argumentOr sometimes:
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': Success(!)
So what seems to be happening here is there is an implicit monitor being set up which grabs stdio. Because:
Quoted 7 lines
#define STDIO_MAX_CLIENTS 1my own -serial stdio option subsequently fails. This is a regression over previous behaviour. I didn't specify a monitor device, because I don't want one, and previous versions of qemu didn't give me one in nographic mode.
Your old invocation was technically incorrect but it happened to work. It now throws an error.
It's a tough call about whether such things are regressions but in this case, I really don't think it is because the old behaviour wasn't self-consistent.
Regards,
Anthony Liguori
Quoted 17 lines · Richard W.M. Jones
Quoted 7 lines · Blue Swirl
I guess
e1c09175bc00dd8dfb2ad1b26e1858dcdc109b59or998bbd74b9d813b14a3a3b5009a5d5a48c7dce51broke -serial stdio for all targets:
qemu -serial stdio -monitor stdio
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': No such file or directory-serial stdio on its own is broken for me (qemu from git). The error is a little bit different, so I don't think this is the same bug:
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': Invalid argumentThe full command line is:
Quoted 8 lines
$qemudir/x86_64-softmmu/qemu-system-x86_64 \
-L $qemudir/pc-bios \
-drive file=/tmp/test.img,cache=off,if=ide \
-m 500 \
-no-reboot \
-nographic \
-serial stdio \This is redundant. -nographic implies -serial stdio.
Regards,
Anthony Liguori
Quoted 27 lines · Anthony Liguori
Quoted 17 lines · Richard W.M. Jones
Quoted 7 lines · Blue Swirl
I guess
e1c09175bc00dd8dfb2ad1b26e1858dcdc109b59or998bbd74b9d813b14a3a3b5009a5d5a48c7dce51broke -serial stdio for all targets:
qemu -serial stdio -monitor stdio
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': No such file or directory-serial stdio on its own is broken for me (qemu from git). The error is a little bit different, so I don't think this is the same bug:
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': Invalid argumentThe full command line is:
Quoted 8 lines
$qemudir/x86_64-softmmu/qemu-system-x86_64 \ -L $qemudir/pc-bios \ -drive file=/tmp/test.img,cache=off,if=ide \ -m 500 \ -no-reboot \ -nographic \ -serial stdio \
Quoted 1 line
This is redundant. -nographic implies -serial stdio.
NB, QEMU 0.12 introduces a new flag '-nodefaults' that can be used to get rid of this imlied 'serial stdio', and all other implied devices. It is well worth using this new -nodefaults flag if you're managing qemu from an app to avoid these surprises
eg this should work as you'd expect it
qemu -nodefaults -nographic -serial stdio
Regards,
Daniel
Signature · 4 lines
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Quoted 9 lines · Daniel P. Berrange
NB, QEMU 0.12 introduces a new flag '-nodefaults' that can be used to get rid of this imlied 'serial stdio', and all other implied devices. It is well worth using this new -nodefaults flag if you're managing qemu from an app to avoid these surprises
eg this should work as you'd expect it
qemu -nodefaults -nographic -serial stdio
-nographic is basically equivalent to -serial mon:stdio,signal=on -vga none except it operates on defaults. Your invocation actually ends up being very different as it doesn't multiplex the monitor and it doesn't disable ctrl-c. Basically, your invocation is equivalent to qemu -vga none -serial stdio
The "bug" is the original invocation's addition of '-serial stdio'. That was basically ignored previously but you could imagine subtle changes in semantics (like ctrl-c behavior) that it could and arguably should have introduced.
Regards,
Anthony Liguori
Quoted 30 lines · Daniel P. Berrange
Quoted 27 lines · Anthony Liguori
Quoted 17 lines · Richard W.M. Jones
Quoted 7 lines · Blue Swirl
I guess
e1c09175bc00dd8dfb2ad1b26e1858dcdc109b59or998bbd74b9d813b14a3a3b5009a5d5a48c7dce51broke -serial stdio for all targets:
qemu -serial stdio -monitor stdio
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': No such file or directory-serial stdio on its own is broken for me (qemu from git). The error is a little bit different, so I don't think this is the same bug:
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': Invalid argumentThe full command line is:
Quoted 8 lines
$qemudir/x86_64-softmmu/qemu-system-x86_64 \ -L $qemudir/pc-bios \ -drive file=/tmp/test.img,cache=off,if=ide \ -m 500 \ -no-reboot \ -nographic \ -serial stdio \Quoted 1 line
This is redundant. -nographic implies -serial stdio.
Quoted 8 lines
NB, QEMU 0.12 introduces a new flag '-nodefaults' that can be used to get rid of this imlied 'serial stdio', and all other implied devices. It is well worth using this new -nodefaults flag if you're managing qemu from an app to avoid these surprises
eg this should work as you'd expect it
qemu -nodefaults -nographic -serial stdio
I think this is probably the way to go then.
Rich.
Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora