qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Huth <thuth@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v3 2/5] migration: Create MigrationState active field
Date: Fri, 17 Jan 2020 19:35:25 +0100	[thread overview]
Message-ID: <87k15q2aoi.fsf@secure.laptop> (raw)
In-Reply-To: <20200117162612.GN3209@work-vm> (David Alan Gilbert's message of "Fri, 17 Jan 2020 16:26:12 +0000")

"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> * Juan Quintela (quintela@redhat.com) wrote:
>> Right now, there is no easy way to dectect if we have already
>> cancelled/finished/failed a migration.  This field is setup to true
>> when we start a migration, and it is set to false as soon as we stop
>> it.
>> 
>> It fixes a real bug, in ram_save_iterate() we call functions that
>> wrote to the channel even if we know that migration has stopped for
>> any reason.  This gives problems with multifd because we need to
>> synchronize various semoaphores that we don't want to take.
>> 
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>
> Why can't you use migration_is_active() in the ram.c case?
> My preference would be just to stick with something derived
> from the state rather than tacking another state bit on.

My plan was to go the other way around.
We need to use the state with atomics, I wanted a single way of deciding
if we are/or not in the middle of a migration.  Just now it is too
confusing on my opinion.

>> ---
>>  migration/migration.c | 5 +++++
>>  migration/migration.h | 5 +++++
>>  migration/ram.c       | 2 +-
>>  migration/savevm.c    | 2 ++
>>  4 files changed, 13 insertions(+), 1 deletion(-)
>> 
>> diff --git a/migration/migration.c b/migration/migration.c
>> index 990bff00c0..60bc8710b6 100644
>> --- a/migration/migration.c
>> +++ b/migration/migration.c
>> @@ -1583,6 +1583,8 @@ static void migrate_fd_cancel(MigrationState *s)
>>      QEMUFile *f = migrate_get_current()->to_dst_file;
>>      trace_migrate_fd_cancel();
>>  
>> +    s->active = false;
>> +
>>      if (s->rp_state.from_dst_file) {
>>          /* shutdown the rp socket, so causing the rp thread to shutdown */
>>          qemu_file_shutdown(s->rp_state.from_dst_file);
>> @@ -2834,6 +2836,7 @@ static void migration_completion(MigrationState *s)
>>      }
>>  
>>      if (!migrate_colo_enabled()) {
>> +        s->active = false;
>>          migrate_set_state(&s->state, current_active_state,
>>                            MIGRATION_STATUS_COMPLETED);
>
> You've not always got these two the same way around - i.e. do you change
> the state first or do you set the active state first?  I think it needs
> to be consistent.

Ok.

Thanks, Juan.



  reply	other threads:[~2020-01-17 18:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16 15:46 [PATCH v3 0/5] Fix multifd + cancel + multifd Juan Quintela
2020-01-16 15:46 ` [PATCH v3 1/5] multifd: Make sure that we don't do any IO after an error Juan Quintela
2020-01-16 18:20   ` Dr. David Alan Gilbert
2020-01-16 15:46 ` [PATCH v3 2/5] migration: Create MigrationState active field Juan Quintela
2020-01-17 16:26   ` Dr. David Alan Gilbert
2020-01-17 18:35     ` Juan Quintela [this message]
2020-01-21 11:08     ` Juan Quintela
2020-01-16 15:46 ` [PATCH v3 3/5] migration: Don't wait in semaphore for thread we know has finished Juan Quintela
2020-01-17 16:45   ` Dr. David Alan Gilbert
2020-01-21 11:10     ` Juan Quintela
2020-01-16 15:46 ` [PATCH v3 4/5] qemu-file: Don't do IO after shutdown Juan Quintela
2020-01-16 15:46 ` [PATCH v3 5/5] migration-test: Make sure that multifd and cancel works Juan Quintela
2020-01-16 15:59   ` Thomas Huth

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=87k15q2aoi.fsf@secure.laptop \
    --to=quintela@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --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 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).