All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-stable@nongnu.org, Juan Quintela <quintela@redhat.com>,
	qemu-devel@nongnu.org,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/3] migration: Cancel migration at exit
Date: Fri, 15 Sep 2017 16:37:21 +0800	[thread overview]
Message-ID: <20170915083721.GT3617@pxdev.xzpeter.org> (raw)
In-Reply-To: <20170915082026.GG17199@lemon>

On Fri, Sep 15, 2017 at 04:20:26PM +0800, Fam Zheng wrote:

[...]

> > >  void qmp_migrate_set_cache_size(int64_t value, Error **errp)
> > >  {
> > >      MigrationState *s = migrate_get_current();
> > > diff --git a/vl.c b/vl.c
> > > index fb1f05b937..abbe61f40b 100644
> > > --- a/vl.c
> > > +++ b/vl.c
> > > @@ -87,6 +87,7 @@ int main(int argc, char **argv)
> > >  #include "sysemu/blockdev.h"
> > >  #include "hw/block/block.h"
> > >  #include "migration/misc.h"
> > > +#include "migration/savevm.h"
> > >  #include "migration/snapshot.h"
> > >  #include "migration/global_state.h"
> > >  #include "sysemu/tpm.h"
> > > @@ -4799,6 +4800,8 @@ int main(int argc, char **argv, char **envp)
> > >      iothread_stop_all();
> > >  
> > >      pause_all_vcpus();
> > > +    migrate_cancel();
> > 
> > IIUC this is an async cancel, so when reach here the migration thread
> > can still be alive.  Then...
> > 
> > > +    qemu_savevm_state_cleanup();
> > 
> > ... Here calling qemu_savevm_state_cleanup() may be problematic if
> > migration thread has not yet quitted.
> > 
> > I'm thinking whether we should make migrate_fd_cancel() wait until the
> > migration thread finishes (state change to CANCELLED).  Then the
> > migration thread will do the cleanup, and here we can avoid calling
> > qemu_savevm_state_cleanup() as well.
> 
> But if the migration thread is stuck and CANCELLED is never reached, we'll hang
> here?

Maybe we can add timeout. Anyway, if it gets stuck, I do see it a
migration bug, and in that case I'm not sure force return after
timeout would be anything wiser.

Dave/Juan may have better idea though.

-- 
Peter Xu

  reply	other threads:[~2017-09-15  8:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-15  5:44 [Qemu-devel] [PATCH 0/3] migration: Fix crash by cleaning up before quit Fam Zheng
2017-09-15  5:44 ` [Qemu-devel] [PATCH 1/3] migration: Allow ram_save_cleanup to be called with empty state Fam Zheng
2017-09-15  6:41   ` Peter Xu
2017-09-15  6:49     ` Fam Zheng
2017-09-15  6:56       ` Peter Xu
2017-09-15  7:02         ` Fam Zheng
2017-09-15  7:58           ` Peter Xu
2017-09-15  5:44 ` [Qemu-devel] [PATCH 2/3] migration: Cancel migration at exit Fam Zheng
2017-09-15  8:03   ` Peter Xu
2017-09-15  8:20     ` Fam Zheng
2017-09-15  8:37       ` Peter Xu [this message]
2017-09-15  8:42       ` Dr. David Alan Gilbert
2017-09-15  8:52         ` Fam Zheng
2017-09-15  9:22           ` Dr. David Alan Gilbert
2017-09-18  7:31             ` Peter Xu
2017-09-18 10:00               ` Dr. David Alan Gilbert
2017-09-19  8:26                 ` Peter Xu
2017-09-15  5:44 ` [Qemu-devel] [PATCH 3/3] iotests: Add "quit during block migration" case 195 Fam Zheng
2017-09-15 17:29   ` Eric Blake

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=20170915083721.GT3617@pxdev.xzpeter.org \
    --to=peterx@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=famz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=quintela@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.