qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org, quintela@redhat.com, alex.bennee@linaro.org
Subject: Re: [Qemu-devel] [PATCH] migration: Cleanup during exit
Date: Thu, 28 Feb 2019 11:40:19 +0000	[thread overview]
Message-ID: <20190228114019.GB4970@work-vm> (raw)
In-Reply-To: <20190228062803.GA7471@xz-x1>

* Peter Xu (peterx@redhat.com) wrote:
> On Wed, Feb 27, 2019 at 04:49:00PM +0000, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > 
> > Currently we cleanup the migration object as we exit main after the
> > main_loop finishes; however if there's a migration running things
> > get messy and we can end up with the migration thread still trying
> > to access freed structures.
> > 
> > We now take a ref to the object around the migration thread itself,
> > so the act of dropping the ref during exit doesn't cause us to lose
> > the state until the thread quits.
> > 
> > Cancelling the migration during migration also tries to get the thread
> > to quit.
> > 
> > We do this a bit earlier; so hopefully migration gets out of the way
> > before all the devices etc are freed.
> 
> So does it mean that even with the patch it's still possible the
> migration thread will be accessing device structs that have already
> been freed which can still crash QEMU?

Possibly yes; I'm not sure how to go to the next stage and stop that
case; the consensus seems to be we don't want to explicitly block
during the exit process, so doing a join on the migration thread doesn't
seem to be wanted.

Dave

> Thanks,
> 
> -- 
> Peter Xu
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2019-02-28 11:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27 16:49 [Qemu-devel] [PATCH] migration: Cleanup during exit Dr. David Alan Gilbert (git)
2019-02-27 20:32 ` Juan Quintela
2019-02-28  6:28 ` Peter Xu
2019-02-28 11:40   ` Dr. David Alan Gilbert [this message]
2019-02-28 12:01     ` Daniel P. Berrangé
2019-02-28 12:28       ` Dr. David Alan Gilbert
2019-03-01  3:27         ` Peter Xu
2019-03-01 10:11           ` Dr. David Alan Gilbert
2019-03-04  7:52             ` Peter Xu
2019-02-28 10:49 ` Alex Bennée

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=20190228114019.GB4970@work-vm \
    --to=dgilbert@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@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).