All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Thomas Huth <thuth@redhat.com>,
	qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>
Subject: Re: [PATCH v5 5/6] migration/postcopy: Release fd before going into 'postcopy-pause'
Date: Wed, 21 Oct 2020 19:56:25 +0100	[thread overview]
Message-ID: <20201021185625.GH3671@work-vm> (raw)
In-Reply-To: <20201019225720.172743-6-peterx@redhat.com>

* Peter Xu (peterx@redhat.com) wrote:
> Logically below race could trigger with the old code:
> 
>           test program                        migration thread
>           ------------                        ----------------
>        wait_until('postcopy-pause')
>                                           postcopy_pause()
>                                             set_state('postcopy-pause')
>        do_postcopy_recover()
>          arm s->to_dst_file with new fd
>                                             release s->to_dst_file [1]
> 
> Here [1] could have released the just-installed recoverying channel.  Then the
> migration could hang without really resuming.
> 
> Instead, it should be very safe to release the fd before setting the state into
> 'postcopy-pause', because there's no reason for any other thread to touch it
> during 'postcopy-active'.
> 
> Dave reported a very rare postcopy recovery hang that the migration-test
> program waited for the migration to complete in migrate_postcopy_complete().
> We do suspect it's the same thing that we're gonna fix here.  Hard to tell.
> However since we've noticed this, fix this irrelevant of the hang report.
> 
> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Cc: Juan Quintela <quintela@redhat.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  migration/migration.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index 0b4fcff01f..50df6251b7 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -3182,9 +3182,6 @@ static MigThrError postcopy_pause(MigrationState *s)
>      while (true) {
>          QEMUFile *file;
>  
> -        migrate_set_state(&s->state, s->state,
> -                          MIGRATION_STATUS_POSTCOPY_PAUSED);
> -
>          /* Current channel is possibly broken. Release it. */
>          assert(s->to_dst_file);
>          qemu_mutex_lock(&s->qemu_file_lock);
> @@ -3195,6 +3192,9 @@ static MigThrError postcopy_pause(MigrationState *s)
>          qemu_file_shutdown(file);
>          qemu_fclose(file);
>  
> +        migrate_set_state(&s->state, s->state,
> +                          MIGRATION_STATUS_POSTCOPY_PAUSED);
> +
>          error_report("Detected IO failure for postcopy. "
>                       "Migration paused.");
>  
> -- 
> 2.26.2
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



  reply	other threads:[~2020-10-21 19:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 22:57 [PATCH v5 0/6] migration/postcopy: Sync faulted addresses after network recovered Peter Xu
2020-10-19 22:57 ` [PATCH v5 1/6] migration: Pass incoming state into qemu_ufd_copy_ioctl() Peter Xu
2020-10-19 22:57 ` [PATCH v5 2/6] migration: Introduce migrate_send_rp_message_req_pages() Peter Xu
2020-10-19 22:57 ` [PATCH v5 3/6] migration: Maintain postcopy faulted addresses Peter Xu
2020-10-21 14:23   ` Dr. David Alan Gilbert
2020-10-21 15:50     ` Peter Xu
2020-10-21 17:42       ` Dr. David Alan Gilbert
2020-10-21 18:04         ` Peter Xu
2020-10-19 22:57 ` [PATCH v5 4/6] migration: Sync requested pages after postcopy recovery Peter Xu
2020-10-21 14:37   ` Dr. David Alan Gilbert
2020-10-19 22:57 ` [PATCH v5 5/6] migration/postcopy: Release fd before going into 'postcopy-pause' Peter Xu
2020-10-21 18:56   ` Dr. David Alan Gilbert [this message]
2020-10-19 22:57 ` [PATCH v5 6/6] migration-test: Only hide error if !QTEST_LOG Peter Xu

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=20201021185625.GH3671@work-vm \
    --to=dgilbert@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=thuth@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.