]> git.proxmox.com Git - mirror_qemu.git/commit - softmmu/vl.c
runstate: ignore finishmigrate -> prelaunch transition
authorLaurent Vivier <lvivier@redhat.com>
Fri, 29 Nov 2019 11:51:32 +0000 (12:51 +0100)
committerJuan Quintela <quintela@redhat.com>
Mon, 20 Jan 2020 08:10:22 +0000 (09:10 +0100)
commitddad81bd28de665475a87693a93e6cf5d6fd8bab
tree04609a68c4720c90edba3dcace302f670eb24a1b
parent6a22c5444c7cf79aaa47d1bc9485cf5dfe90429b
runstate: ignore finishmigrate -> prelaunch transition

Commit 1bd71dce4bf2 tries to prevent a finishmigrate -> prelaunch
transition by exiting at the beginning of the main_loop_should_exit()
function if the state is already finishmigrate.

As the finishmigrate state is set in the migration thread it can
happen concurrently to the function. The migration thread and the
function are normally protected by the iothread mutex and thus the
state should no evolve between the start of the function and its end.

Unfortunately during the function life the lock is released by
pause_all_vcpus() just before the point we need to be sure we are
not in finishmigrate state and if the migration thread is waiting
for the lock it will take the opportunity to change the state
to finishmigrate.

The only way to be sure we are not in the finishmigrate state when
we need is to check the state after the pause_all_vcpus() function.

Fixes: 1bd71dce4bf2 ("runstate: ignore exit request in finish migrate state")
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
vl.c