On Tue, Jun 28, 2016 at 07:33:51PM +0200, Paolo Bonzini wrote: > From: Marc-André Lureau <marcandre.lur...@redhat.com> > > This helps to remove various chardev resources leaks when leaving qemu. > > Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> > Message-Id: <1466105332-10285-2-git-send-email-marcandre.lur...@redhat.com> > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > qemu-char.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/qemu-char.c b/qemu-char.c > index 84f49ac..016badb 100644 > --- a/qemu-char.c > +++ b/qemu-char.c > @@ -4549,6 +4549,15 @@ void qmp_chardev_remove(const char *id, Error **errp) > qemu_chr_delete(chr); > } > > +static void qemu_chr_cleanup(void) > +{ > + CharDriverState *chr; > + > + QTAILQ_FOREACH(chr, &chardevs, next) { > + qemu_chr_delete(chr); > + } > +} > + > static void register_types(void) > { > register_char_driver("null", CHARDEV_BACKEND_KIND_NULL, NULL, > @@ -4595,6 +4604,8 @@ static void register_types(void) > * is specified > */ > qemu_add_machine_init_done_notifier(&muxes_realize_notify); > + > + atexit(qemu_chr_cleanup); > } > > type_init(register_types); > -- > 2.7.4 > > >
With this patch, I now get qemu: qemu_mutex_destroy: Device or resource busy and a SIGABRT when my arm tcg kvm-unit-tests guest exits (I haven't tried any other guest types yet) Thanks, drew