qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] migration: Allow ram_save_cleanup to be called with empty state
Date: Fri, 15 Sep 2017 15:02:32 +0800	[thread overview]
Message-ID: <20170915070232.GF17199@lemon> (raw)
In-Reply-To: <20170915065627.GQ3617@pxdev.xzpeter.org>

On Fri, 09/15 14:56, Peter Xu wrote:
> On Fri, Sep 15, 2017 at 02:49:07PM +0800, Fam Zheng wrote:
> > On Fri, 09/15 14:41, Peter Xu wrote:
> > > On Fri, Sep 15, 2017 at 01:44:02PM +0800, Fam Zheng wrote:
> > > > So that we can do cleanup unconditionally at the end of main().
> > > > 
> > > > Signed-off-by: Fam Zheng <famz@redhat.com>
> > > > ---
> > > >  migration/ram.c | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > > 
> > > > diff --git a/migration/ram.c b/migration/ram.c
> > > > index e18b3e2d4f..37e6a71241 100644
> > > > --- a/migration/ram.c
> > > > +++ b/migration/ram.c
> > > > @@ -1365,6 +1365,9 @@ static void ram_save_cleanup(void *opaque)
> > > >      RAMState **rsp = opaque;
> > > >      RAMBlock *block;
> > > >  
> > > > +    if (!rsp || !*rsp) {
> > > > +        return;
> > > > +    }
> > > >      /* caller have hold iothread lock or is in a bh, so there is
> > > >       * no writing race against this migration_bitmap
> > > >       */
> > > > -- 
> > > > 2.13.5
> > > > 
> > > 
> > > Instead of take special care on RAM, how about check in
> > > migrate_fd_cancel(), and return directly if migration_is_idle()?
> > 
> > This is not from migrate_fd_cancel(), but from qemu_savevm_state_cleanup(), so
> > that doesn't work.
> 
> Yeh I see the point.  But my logic still stands - we don't need to
> cleanup anything if the migration is not really there.
> 
> I'm thinking whether we can put qemu_savevm_state_cleanup() into
> migrate_fd_cancel() in some way, though I am still not 100% sure on
> the colo part.  Anyway, I feel like a bit confusing we have two
> cleanup functions.

I agree, but I don't know what is the best way to clean this up: savevm and
migration seem a little independent from each other.

Fam

  reply	other threads:[~2017-09-15  7:02 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 [this message]
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
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=20170915070232.GF17199@lemon \
    --to=famz@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=peterx@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 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).