On Tue, 6 Mar 2018 18:47:47 +0100 Thomas Huth <th...@redhat.com> wrote:
> On 06.03.2018 18:28, Mark Cave-Ayland wrote: > > On 06/03/18 16:48, Thomas Huth wrote: > > > >> Something in the recent commits introduced a new way to cause unexpected > >> aborts of QEMU: > >> > >> $ ppc64-softmmu/qemu-system-ppc64 -monitor stdio > >> QEMU 2.11.50 monitor - type 'help' for more information > >> (qemu) device_add macio-newworld > >> Unexpected error in qemu_chr_fe_init() at > >> /home/thuth/devel/qemu/chardev/char-fe.c:222: > >> Device 'serial0' is in use > >> Aborted (core dumped) > >> > >> Of course it does not make sense to add a macio-newworld device on the > >> pseries machine, but QEMU should not abort in this case - it should just > >> print an error message and continue afterwards. Any ideas how to fix > >> this? > > > > So the backtrace from git master looks like this: > > > > Thread 1 "qemu-system-ppc" received signal SIGABRT, Aborted. > > __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 > > > > > > 51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. > > > > > > (gdb) bt > > > > > > #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 > > > > #1 0x00007fffdbd6e3fa in __GI_abort () at abort.c:89 > > > > > > #2 0x0000555555de6d86 in error_handle_fatal (errp=0x555556bdfb90 > > <error_abort>, err=0x555556ef5a00) at util/error.c:38 > > > > #3 0x0000555555de6eb6 in error_setv (errp=0x555556bdfb90 <error_abort>, > > src=0x555556031ad0 "chardev/char-fe.c", line=222, func=0x555556031c50 > > <__func__.18713> "qemu_chr_fe_init", err_class=ERROR_CLASS_GENERIC_ERROR, > > fmt=0x555556031b50 "Device '%s' is in use", ap=0x7fffffffd010, > > suffix=0x0) at util/error.c:71 > > > > #4 0x0000555555de7097 in error_setg_internal (errp=0x555556bdfb90 > > <error_abort>, src=0x555556031ad0 "chardev/char-fe.c", line=222, > > func=0x555556031c50 <__func__.18713> "qemu_chr_fe_init", > > fmt=0x555556031b50 "Device '%s' is in use") at util/error.c:95 > > > > > > #5 0x0000555555d673fc in qemu_chr_fe_init (b=0x555557aef590, > > s=0x555556de2290, errp=0x555556bdfb90 <error_abort>) at > > chardev/char-fe.c:222 > > #6 0x0000555555af5467 in set_chr (obj=0x555557aeef80, v=0x555557960c20, > > name=0x555555f65fc5 "chrA", opaque=0x555556658410 <escc_properties+432>, > > errp=0x555556bdfb90 <error_abort>) at hw/core/qdev-properties-system.c:216 > > #7 0x0000555555cb326a in object_property_set (obj=0x555557aeef80, > > v=0x555557960c20, name=0x555555f65fc5 "chrA", errp=0x555556bdfb90 > > <error_abort>) at qom/object.c:1109 > > #8 0x0000555555cb6232 in object_property_set_qobject > > (obj=0x555557aeef80, value=0x555557960bf0, name=0x555555f65fc5 "chrA", > > errp=0x555556bdfb90 <error_abort>) at qom/qom-qobject.c:27 > > #9 0x0000555555cb32af in object_property_set_str (obj=0x555557aeef80, > > value=0x555556de23c0 "serial0", name=0x555555f65fc5 "chrA", > > errp=0x555556bdfb90 <error_abort>) at qom/object.c:1117 > > #10 0x0000555555af5d94 in qdev_prop_set_chr (dev=0x555557aeef80, > > name=0x555555f65fc5 "chrA", value=0x555556de2290) at > > hw/core/qdev-properties-system.c:427 > > #11 0x0000555555b350a8 in macio_instance_init (obj=0x555557aec3c0) at > > hw/misc/macio/macio.c:347 > > > > > > It seems that the error is being raised when setting the property rather > > than during realize so I'm not sure what I can do to handle this. Any > > thoughts? > > Does the device need to be hot-pluggable or even user_creatable at all? FWIW, the crash also happens when the device is passed on the command line: $ ppc64-softmmu/qemu-system-ppc64 -device macio-newworld Unexpected error in qemu_chr_fe_init() at /home/greg/Work/qemu/qemu-spapr/chardev/char-fe.c:222: qemu-system-ppc64: -device macio-newworld: Device 'serial0' is in use Aborted (core dumped) > It seems like it is also using serial_hds[] directly, so that is a good > indication that it is *not* user creatable. So maybe the easiest fix is > to simply set > > dc->user_creatable = false; > > in macio_class_init() ? > > Thomas > >