From: Eduardo Habkost <ehabkost@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
qemu-devel@nongnu.org, Marcel Apfelbaum <marcel@redhat.com>,
Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [PULL 01/12] vl: Clean up user-creatable objects when exiting
Date: Tue, 26 Sep 2017 09:24:27 -0300 [thread overview]
Message-ID: <20170926122427.GC4115@localhost.localdomain> (raw)
In-Reply-To: <6990d924-47e0-0445-c769-c1128035640d@de.ibm.com>
On Tue, Sep 26, 2017 at 12:14:23PM +0200, Christian Borntraeger wrote:
> This patch triggers the following crash on shutdown:
>
>
> Stack trace of thread 61598:
> #0 0x000003ff8990915e pthread_join (libpthread.so.0)
> #1 0x00000000014ddfda qemu_thread_join (qemu-system-s390x)
> #2 0x00000000011bbd68 iothread_stop (qemu-system-s390x)
> #3 0x00000000011bbe36 iothread_instance_finalize (qemu-system-s390x)
> #4 0x000000000135b4a4 object_deinit (qemu-system-s390x)
> #5 0x000000000135b548 object_finalize (qemu-system-s390x)
> #6 0x000000000135cc02 object_unref (qemu-system-s390x)
> #7 0x000000000135e61a object_finalize_child_property (qemu-system-s390x)
> #8 0x000000000135b16a object_property_del_all (qemu-system-s390x)
> #9 0x000000000135b536 object_finalize (qemu-system-s390x)
> #10 0x000000000135cc02 object_unref (qemu-system-s390x)
> #11 0x000000000135e61a object_finalize_child_property (qemu-system-s390x)
> #12 0x000000000135b2ea object_property_del_child (qemu-system-s390x)
> #13 0x000000000135b44a object_unparent (qemu-system-s390x)
> #14 0x0000000001362754 user_creatable_cleanup (qemu-system-s390x)
> #15 0x00000000011d012a main (qemu-system-s390x)
> #16 0x000003ff8972289a __libc_start_main (libc.so.6)
> #17 0x0000000001017646 _start (qemu-system-s390x)
It seems to be reproducible with:
$ echo quit | ./x86_64-softmmu/qemu-system-x86_64 -object iothread,id=iothread0 -monitor stdio -display none
QEMU 2.10.50 monitor - type 'help' for more information
(qemu) quit
qemu: qemu_thread_join: No such process
Aborted (core dumped)
iothread_stop() is being called twice for the same thread:
Thread 1 "qemu-system-x86" hit Breakpoint 3, qemu_thread_join (thread=thread@entry=0x10118e198) at /home/ehabkost/rh/proj/virt/qemu/util/qemu-thread-posix.c:543
543 {
(gdb) bt
#0 0x00000001005dc980 in qemu_thread_join (thread=thread@entry=0x10118e198) at /home/ehabkost/rh/proj/virt/qemu/util/qemu-thread-posix.c:543
#1 0x000000010034a12c in iothread_stop (object=<optimized out>, opaque=<optimized out>) at /home/ehabkost/rh/proj/virt/qemu/iothread.c:96
#2 0x0000000100509117 in do_object_child_foreach (obj=obj@entry=0x10118e390, fn=fn@entry=0x10034a0f0 <iothread_stop>, opaque=opaque@entry=0x0, recurse=recurse@entry=false) at /home/ehabkost/rh/proj/virt/qemu/qom/object.c:843
#3 0x000000010050a7a7 in object_child_foreach (obj=obj@entry=0x10118e390, fn=fn@entry=0x10034a0f0 <iothread_stop>, opaque=opaque@entry=0x0) at /home/ehabkost/rh/proj/virt/qemu/qom/object.c:858
#4 0x000000010034a3be in iothread_stop_all () at /home/ehabkost/rh/proj/virt/qemu/iothread.c:331
#5 0x000000010021da4d in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at /home/ehabkost/rh/proj/virt/qemu/vl.c:4886
(gdb) c
Continuing.
Thread 1 "qemu-system-x86" hit Breakpoint 3, qemu_thread_join (thread=thread@entry=0x10118e198) at /home/ehabkost/rh/proj/virt/qemu/util/qemu-thread-posix.c:543
543 {
(gdb) bt
#0 0x00000001005dc980 in qemu_thread_join (thread=thread@entry=0x10118e198) at /home/ehabkost/rh/proj/virt/qemu/util/qemu-thread-posix.c:543
#1 0x000000010034a12c in iothread_stop (object=object@entry=0x10118e170, opaque=opaque@entry=0x0) at /home/ehabkost/rh/proj/virt/qemu/iothread.c:96
#2 0x000000010034a175 in iothread_instance_finalize (obj=0x10118e170) at /home/ehabkost/rh/proj/virt/qemu/iothread.c:111
#3 0x000000010050a90a in object_deinit (type=0x1010dd860, obj=<optimized out>) at /home/ehabkost/rh/proj/virt/qemu/qom/object.c:453
#4 0x000000010050a90a in object_finalize (data=0x10118e170) at /home/ehabkost/rh/proj/virt/qemu/qom/object.c:467
#5 0x000000010050a90a in object_unref (obj=0x10118e170) at /home/ehabkost/rh/proj/virt/qemu/qom/object.c:902
#6 0x000000010050a99d in object_property_del_all (obj=0x10118e390) at /home/ehabkost/rh/proj/virt/qemu/qom/object.c:404
#7 0x000000010050a99d in object_finalize (data=0x10118e390) at /home/ehabkost/rh/proj/virt/qemu/qom/object.c:466
#8 0x000000010050a99d in object_unref (obj=0x10118e390) at /home/ehabkost/rh/proj/virt/qemu/qom/object.c:902
#9 0x0000000100509915 in object_property_del_child (obj=0x101180900, child=0x10118e390, errp=<optimized out>) at /home/ehabkost/rh/proj/virt/qemu/qom/object.c:427
#10 0x000000010021da87 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at /home/ehabkost/rh/proj/virt/qemu/vl.c:4897
>
>
> command line parameters are long (one of my test systems)
>
> -name guest=zhyp137,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-7-zhyp137/master-key.aes -machine s390-ccw-virtio-2.11,accel=kvm,usb=off,dump-guest-core=off,loadparm=PROMPT -m 2048 -realtime mlock=off -smp 4,sockets=4,cores=1,threads=1 -object iothread,id=iothread1 -object iothread,id=iothread2 -object iothread,id=iothread3 -object iothread,id=iothread4 -object iothread,id=iothread5 -object iothread,id=iothread6 -object iothread,id=iothread7 -object iothread,id=iothread8 -object iothread,id=iothread9 -object iothread,id=iothread10 -object iothread,id=iothread11 -object iothread,id=iothread12 -object iothread,id=iothread13 -object iothread,id=iothread14 -object iothread,id=iothread15 -object iothread,id=iothread16 -object iothread,id=iothread17 -object iothread,id=iothread18 -object iothread,id=iothread19 -object iothread,id=iothread20 -uuid 4c3ae636-529d-4d90-b203-c8d3d150f0d0 -display none -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-7-zhyp137/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot strict=on -drive file=/var/lib/libvirt/qemu/image.zhyp137,format=qcow2,if=none,id=drive-virtio-disk0,serial=skel,cache=none -device virtio-blk-ccw,iothread=iothread1,scsi=off,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive file=/var/lib/libvirt/qemu/image.zhyp137.old,format=qcow2,if=none,id=drive-virtio-disk1,serial=old,cache=none -device virtio-blk-ccw,iothread=iothread1,scsi=off,devno=fe.0.0001,drive=drive-virtio-disk1,id=virtio-disk1 -netdev tap,fd=24,id=hostnet0,vhost=on,vhostfd=26 -device virtio-net-ccw,netdev=hostnet0,id=net0,mac=52:54:00:d1:cd:1c,devno=fe.0.000d -chardev pty,id=charconsole0 -device sclpconsole,chardev=charconsole0,id=console0 -device virtio-balloon-ccw,id=balloon0,devno=fe.3.ffba -drive driver=null-aio,id=null1,if=none,size=1500G -device virtio-blk-ccw,scsi=off,drive=null1,serial=null1,iothread=iothread16 -drive driver=null-aio,id=null2,if=none,size=1500G -device virtio-blk-ccw,scsi=off,drive=null2,serial=null2,iothread=iothread17 -drive driver=null-aio,id=null3,if=none,size=1500G -device virtio-blk-ccw,scsi=off,drive=null3,serial=null3,iothread=iothread18 -drive driver=null-aio,id=null4,if=none,size=1500G -device virtio-blk-ccw,scsi=off,drive=null4,serial=null4,iothread=iothread19 -drive driver=null-aio,id=null5,if=none,size=1500G -device virtio-blk-ccw,scsi=off,drive=null5,serial=null5,iothread=iothread20,num-queues=10 -gdb tcp::1409 -msg timestamp=on
>
> On 09/19/2017 10:18 PM, Eduardo Habkost wrote:
> > Delete all user-creatable objects in /objects when exiting QEMU, so they
> > can perform cleanup actions.
> >
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > Message-Id: <20170824192315.5897-2-ehabkost@redhat.com>
> > Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> > Tested-by: Zack Cornelius <zack.cornelius@kove.net>
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
> > include/qom/object_interfaces.h | 8 ++++++++
> > qom/object_interfaces.c | 5 +++++
> > vl.c | 1 +
> > 3 files changed, 14 insertions(+)
> >
> > diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h
> > index d63c1c28f8..d23e11bc53 100644
> > --- a/include/qom/object_interfaces.h
> > +++ b/include/qom/object_interfaces.h
> > @@ -147,4 +147,12 @@ int user_creatable_add_opts_foreach(void *opaque,
> > */
> > void user_creatable_del(const char *id, Error **errp);
> >
> > +/**
> > + * user_creatable_cleanup:
> > + *
> > + * Delete all user-creatable objects and the user-creatable
> > + * objects container.
> > + */
> > +void user_creatable_cleanup(void);
> > +
> > #endif
> > diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
> > index 3bb8959f09..6824a88caa 100644
> > --- a/qom/object_interfaces.c
> > +++ b/qom/object_interfaces.c
> > @@ -193,6 +193,11 @@ void user_creatable_del(const char *id, Error **errp)
> > object_unparent(obj);
> > }
> >
> > +void user_creatable_cleanup(void)
> > +{
> > + object_unparent(object_get_objects_root());
> > +}
> > +
> > static void register_types(void)
> > {
> > static const TypeInfo uc_interface_info = {
> > diff --git a/vl.c b/vl.c
> > index 9e62e92aea..ad49314608 100644
> > --- a/vl.c
> > +++ b/vl.c
> > @@ -4887,6 +4887,7 @@ int main(int argc, char **argv, char **envp)
> > audio_cleanup();
> > monitor_cleanup();
> > qemu_chr_cleanup();
> > + user_creatable_cleanup();
> > /* TODO: unref root container, check all devices are ok */
> >
> > return 0;
> >
--
Eduardo
next prev parent reply other threads:[~2017-09-26 12:24 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-19 20:18 [Qemu-devel] [PULL 00/12] Machine/CPU/NUMA queue, 2017-09-19 Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 01/12] vl: Clean up user-creatable objects when exiting Eduardo Habkost
2017-09-26 10:14 ` Christian Borntraeger
2017-09-26 12:24 ` Eduardo Habkost [this message]
2017-09-26 13:00 ` [Qemu-devel] [PATCH] iothread: Make iothread_stop() idempotent Eduardo Habkost
2017-09-26 13:08 ` Christian Borntraeger
2017-09-29 13:47 ` Christian Borntraeger
2017-09-29 14:13 ` Paolo Bonzini
2017-09-29 15:57 ` Peter Maydell
2017-09-19 20:18 ` [Qemu-devel] [PULL 02/12] osdep: Define QEMU_MADV_REMOVE Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 03/12] hostmem-file: Add "discard-data" option Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 04/12] qom: cpus: split cpu_generic_init() on feature parsing and cpu creation parts Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 05/12] cpu: make cpu_generic_init() abort QEMU on error Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 06/12] vl.c: convert cpu_model to cpu type and set of global properties before machine_init() Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 07/12] pc: use generic cpu_model parsing Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 08/12] arm: drop intermediate cpu_model -> cpu type parsing and use cpu type directly Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 09/12] numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 10/12] NUMA: Replace MAX_NODES with nb_numa_nodes in for loop Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 11/12] hw/acpi-build: Fix SRAT memory building in case of node 0 without RAM Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 12/12] MAINTAINERS: Update git URLs for my trees Eduardo Habkost
2017-09-20 18:16 ` [Qemu-devel] [PULL 00/12] Machine/CPU/NUMA queue, 2017-09-19 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170926122427.GC4115@localhost.localdomain \
--to=ehabkost@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=imammedo@redhat.com \
--cc=marcel@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).