mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 18:05:37 +00:00
migration: stop tracking ram writes when cancelling background migration
Currently, it is only done when the iteration finishes successfully. Not cleaning up the userfaultfd write protection can lead to symptoms/issues such as the process hanging in memmove or GDB not being able to attach. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> Message-Id: <20230526115908.196171-1-f.ebner@proxmox.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
a4c6275aa1
commit
3a8b81f2e6
|
@ -2400,13 +2400,6 @@ static void bg_migration_completion(MigrationState *s)
|
||||||
{
|
{
|
||||||
int current_active_state = s->state;
|
int current_active_state = s->state;
|
||||||
|
|
||||||
/*
|
|
||||||
* Stop tracking RAM writes - un-protect memory, un-register UFFD
|
|
||||||
* memory ranges, flush kernel wait queues and wake up threads
|
|
||||||
* waiting for write fault to be resolved.
|
|
||||||
*/
|
|
||||||
ram_write_tracking_stop();
|
|
||||||
|
|
||||||
if (s->state == MIGRATION_STATUS_ACTIVE) {
|
if (s->state == MIGRATION_STATUS_ACTIVE) {
|
||||||
/*
|
/*
|
||||||
* By this moment we have RAM content saved into the migration stream.
|
* By this moment we have RAM content saved into the migration stream.
|
||||||
|
@ -2788,6 +2781,13 @@ static void migration_iteration_finish(MigrationState *s)
|
||||||
|
|
||||||
static void bg_migration_iteration_finish(MigrationState *s)
|
static void bg_migration_iteration_finish(MigrationState *s)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Stop tracking RAM writes - un-protect memory, un-register UFFD
|
||||||
|
* memory ranges, flush kernel wait queues and wake up threads
|
||||||
|
* waiting for write fault to be resolved.
|
||||||
|
*/
|
||||||
|
ram_write_tracking_stop();
|
||||||
|
|
||||||
qemu_mutex_lock_iothread();
|
qemu_mutex_lock_iothread();
|
||||||
switch (s->state) {
|
switch (s->state) {
|
||||||
case MIGRATION_STATUS_COMPLETED:
|
case MIGRATION_STATUS_COMPLETED:
|
||||||
|
|
Loading…
Reference in a new issue