On Tue, Jul 28, 2015 at 2:11 PM, Cornelia Huck <cornelia.h...@de.ibm.com> wrote: > On Tue, 28 Jul 2015 14:30:28 +0200 > Paolo Bonzini <pbonz...@redhat.com> wrote: > >> diff --git a/async.c b/async.c >> index 9ca7095..efce14b 100644 >> --- a/async.c >> +++ b/async.c >> @@ -233,6 +233,7 @@ aio_ctx_finalize(GSource *source) >> AioContext *ctx = (AioContext *) source; >> >> qemu_bh_delete(ctx->notify_dummy_bh); >> + thread_pool_free(ctx->thread_pool); >> >> qemu_mutex_lock(&ctx->bh_lock); >> while (ctx->first_bh) { >> @@ -246,7 +247,6 @@ aio_ctx_finalize(GSource *source) >> } >> qemu_mutex_unlock(&ctx->bh_lock); >> >> - thread_pool_free(ctx->thread_pool); >> aio_set_event_notifier(ctx, &ctx->notifier, NULL); >> event_notifier_cleanup(&ctx->notifier); >> rfifolock_destroy(&ctx->lock);
My v2 patch includes something similar so that thread_pool_free() is called before freeing BHs. We can take this patch on top of my v1. >> diff --git a/hw/block/dataplane/virtio-blk.c >> b/hw/block/dataplane/virtio-blk.c >> index 3db139b..6106e46 100644 >> --- a/hw/block/dataplane/virtio-blk.c >> +++ b/hw/block/dataplane/virtio-blk.c >> @@ -223,8 +223,8 @@ void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane >> *s) >> virtio_blk_data_plane_stop(s); >> blk_op_unblock_all(s->conf->conf.blk, s->blocker); >> error_free(s->blocker); >> - object_unref(OBJECT(s->iothread)); >> qemu_bh_delete(s->bh); >> + object_unref(OBJECT(s->iothread)); >> g_free(s); >> } >> > > With this applied on top of Stefan's AioContext patches, both > managedsave and device_del with dataplane devices work for me. > > Tested-by: Cornelia Huck <cornelia.h...@de.ibm.com> Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com>