diff options
author | Andrey Gruzdev <andrey.gruzdev@virtuozzo.com> | 2021-04-01 12:22:25 +0300 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2021-04-07 18:37:28 +0100 |
commit | eeccb99c9d28484303f721e94c5084e9c29a3d03 (patch) | |
tree | bdd58066e9701094a592aa2343a8528f7a08a5b2 /migration/migration.c | |
parent | 1a8e44a89f1976e06300393337f78d561f95b339 (diff) |
migration: Pre-fault memory before starting background snasphot
This commit solves the issue with userfault_fd WP feature that
background snapshot is based on. For any never poluated or discarded
memory page, the UFFDIO_WRITEPROTECT ioctl() would skip updating
PTE for that page, thereby loosing WP setting for it.
So we need to pre-fault pages for each RAM block to be protected
before making a userfault_fd wr-protect ioctl().
Fixes: 278e2f551a095b234de74dca9c214d5502a1f72c (migration: support
UFFD write fault processing in ram_save_iterate())
Signed-off-by: Andrey Gruzdev <andrey.gruzdev@virtuozzo.com>
Reported-by: David Hildenbrand <david@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20210401092226.102804-4-andrey.gruzdev@virtuozzo.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
dgilbert:
Bodged ifdef __linux__ on ram_write_tracking_prepare, should really
go in a stub
Diffstat (limited to 'migration/migration.c')
-rw-r--r-- | migration/migration.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/migration/migration.c b/migration/migration.c index be4729e7c8..8ca034136b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3827,6 +3827,14 @@ static void *bg_migration_thread(void *opaque) update_iteration_initial_status(s); + /* + * Prepare for tracking memory writes with UFFD-WP - populate + * RAM pages before protecting. + */ +#ifdef __linux__ + ram_write_tracking_prepare(); +#endif + qemu_savevm_state_header(s->to_dst_file); qemu_savevm_state_setup(s->to_dst_file); |