All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] iothread: Stop threads before main() quits
Date: Tue, 13 Sep 2016 16:58:19 +0800	[thread overview]
Message-ID: <20160913085819.GA22052@lemon> (raw)
In-Reply-To: <20160913083914.GA2710@stefanha-x1.localdomain>

On Tue, 09/13 09:39, Stefan Hajnoczi wrote:
> On Thu, Sep 08, 2016 at 05:28:51PM +0800, Fam Zheng wrote:
> > Right after main_loop ends, we release various things but keep iothread
> > alive. The latter is not prepared to the sudden change of resources.
> > 
> > Specifically, after bdrv_close_all(), virtio-scsi dataplane get a
> > surprise at the empty BlockBackend:
> > 
> > (gdb) bt
> >     at /usr/src/debug/qemu-2.6.0/hw/scsi/virtio-scsi.c:543
> >     at /usr/src/debug/qemu-2.6.0/hw/scsi/virtio-scsi.c:577
> > 
> > It is because the d->conf.blk->root is set to NULL, then
> > blk_get_aio_context() returns qemu_aio_context, whereas s->ctx is still
> > pointing to the iothread:
> > 
> >     hw/scsi/virtio-scsi.c:543:
> > 
> >     if (s->dataplane_started) {
> >         assert(blk_get_aio_context(d->conf.blk) == s->ctx);
> >     }
> > 
> > To fix this, let's stop iothreads before doing bdrv_close_all().
> 
> Did you consider blk_add_remove_bs_notifier()?  It gets called during
> bdrv_close_all() and would let virtio-scsi survive any other case where
> the same thing happens.

There is already another case (eject):

https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg02243.html

And I don't know how to fix it with blk_add_remove_bs_notifier. Could you
elaborate?

Fam

  reply	other threads:[~2016-09-13  8:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08  9:28 [Qemu-devel] [PATCH] iothread: Stop threads before main() quits Fam Zheng
2016-09-08  9:34 ` Paolo Bonzini
2016-09-09  2:57   ` Fam Zheng
2016-09-09  8:48     ` Paolo Bonzini
2016-09-13  8:39 ` Stefan Hajnoczi
2016-09-13  8:58   ` Fam Zheng [this message]
2016-09-13  8:39 ` Stefan Hajnoczi

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=20160913085819.GA22052@lemon \
    --to=famz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.