qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <famz@redhat.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 3/3] migration: avoid recursive AioContext locking in save_vmstate()
Date: Fri, 19 May 2017 10:07:50 +0100	[thread overview]
Message-ID: <20170519090750.GA12305@stefanha-x1.localdomain> (raw)
In-Reply-To: <20170518081846.GB4646@noname.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1852 bytes --]

On Thu, May 18, 2017 at 10:18:46AM +0200, Kevin Wolf wrote:
> Am 17.05.2017 um 19:09 hat Stefan Hajnoczi geschrieben:
> > diff --git a/migration/savevm.c b/migration/savevm.c
> > index 7f66d58..a70ba20 100644
> > --- a/migration/savevm.c
> > +++ b/migration/savevm.c
> > @@ -2153,6 +2153,14 @@ int save_vmstate(const char *name)
> >          goto the_end;
> >      }
> >  
> > +    /* The bdrv_all_create_snapshot() call that follows acquires the AioContext
> > +     * for itself.  BDRV_POLL_WHILE() does not support nested locking because
> > +     * it only releases the lock once.  Therefore synchronous I/O will deadlock
> > +     * unless we release the AioContext before bdrv_all_create_snapshot().
> > +     */
> > +    aio_context_release(aio_context);
> > +    aio_context = NULL;
> > +
> >      ret = bdrv_all_create_snapshot(sn, bs, vm_state_size, &bs);
> >      if (ret < 0) {
> >          error_report("Error while creating snapshot on '%s'",
> > @@ -2163,7 +2171,9 @@ int save_vmstate(const char *name)
> >      ret = 0;
> >  
> >   the_end:
> > -    aio_context_release(aio_context);
> > +    if (aio_context) {
> > +        aio_context_release(aio_context);
> > +    }
> >      if (saved_vm_running) {
> >          vm_start();
> >      }
> 
> It might actually even be true before this patch because the lock is
> already only taken for some parts of the function, but don't we need to
> call bdrv_drain_all_begin/end() around the whole function now?
> 
> We're stopping the VM, so hopefully no device is continuing to process
> requests, but can't we still have block jobs, NBD server requests etc.?
> 
> And the same is probably true for qemu_loadvm_state().

Yes, they currently rely on bdrv_drain_all() but that's not enough.
Thanks for the suggestion, will add a patch in v2.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2017-05-19  9:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-17 17:09 [Qemu-devel] [PATCH 0/3] block: fix 'savevm' hang with -object iothread Stefan Hajnoczi
2017-05-17 17:09 ` [Qemu-devel] [PATCH 1/3] block: count bdrv_co_rw_vmstate() requests Stefan Hajnoczi
2017-05-17 20:09   ` Eric Blake
2017-05-17 17:09 ` [Qemu-devel] [PATCH 2/3] block: use BDRV_POLL_WHILE() in bdrv_rw_vmstate() Stefan Hajnoczi
2017-05-17 20:16   ` Eric Blake
2017-05-17 20:47     ` Paolo Bonzini
2017-05-18  7:57     ` Kevin Wolf
2017-05-18  8:06       ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-05-18  8:22         ` Kevin Wolf
2017-05-18  8:05     ` Stefan Hajnoczi
2017-05-17 17:09 ` [Qemu-devel] [PATCH 3/3] migration: avoid recursive AioContext locking in save_vmstate() Stefan Hajnoczi
2017-05-17 20:24   ` Eric Blake
2017-05-18  8:18   ` Kevin Wolf
2017-05-19  9:07     ` Stefan Hajnoczi [this message]
2017-05-17 20:49 ` [Qemu-devel] [PATCH 0/3] block: fix 'savevm' hang with -object iothread Paolo Bonzini

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=20170519090750.GA12305@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@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 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).