[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 2/5] migration: Create MigrationState active field
From: |
Juan Quintela |
Subject: |
Re: [PATCH v3 2/5] migration: Create MigrationState active field |
Date: |
Tue, 21 Jan 2020 12:08:27 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
"Dr. David Alan Gilbert" <address@hidden> wrote:
> * Juan Quintela (address@hidden) 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 <address@hidden>
>
> 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.
Trying to redo this as something more reasonable.
Problem that I was trying to do is being sure that we know in what state
we are. Real migration states are:
- NOT_STARTED: We haven't even started
- SETUP: We have started with local stuff but haven't yet transmitted
anything
- ACTIVE: Migration is donig well, we are trasnmitting data
- FINISHED: We have finished migration (COMPLETED/FAILED/CANCELLED/CANCELLING)
- COLO: Yet a completelly different can of worms
To make things even more interesting, we export ->state, so code can do
whatever they want with that variable.
What do we need in a lot of places:
- migration_is_running() (i.e. channel is still open).
And we go left and right to be sure what is going on.
>> @@ -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.
As said, I will try to move that to inside migrate_set_state()
thanks, Juan.
- [PATCH v3 0/5] Fix multifd + cancel + multifd, Juan Quintela, 2020/01/16
- [PATCH v3 1/5] multifd: Make sure that we don't do any IO after an error, Juan Quintela, 2020/01/16
- [PATCH v3 2/5] migration: Create MigrationState active field, Juan Quintela, 2020/01/16
- [PATCH v3 3/5] migration: Don't wait in semaphore for thread we know has finished, Juan Quintela, 2020/01/16
- [PATCH v3 5/5] migration-test: Make sure that multifd and cancel works, Juan Quintela, 2020/01/16
- [PATCH v3 4/5] qemu-file: Don't do IO after shutdown, Juan Quintela, 2020/01/16