On Thu, Nov 26, 2020 at 06:17:28PM +0300, Andrey Gruzdev wrote:
Changes v3->v4:
* 1. Renamed migrate capability 'track-writes-ram'->'background-snapshot'.
* 2. Use array of incompatible caps to replace bulky 'if' constructs.
* 3. Moved UFFD low-level code to the separate module ('util/userfaultfd.c').
* 4. Always do UFFD wr-unprotect on cleanup; just closing file descriptor
* won't cleanup PTEs anyhow, it will release registration ranges, wait
* queues etc. but won't cleanup process MM context on MMU level.
* 5. Allow to enable 'background-snapshot' capability on Linux-only hosts.
* 6. Put UFFD code usage under '#ifdef CONFIG_LINUX' prerequisite.
* 7. Removed 'wt_' from RAMState struct.
* 8. Refactored ram_find_and_save_block() to make more clean - poll UFFD
* wr-fault events in get_queued_page(), use ram_save_host_page_pre(),
* ram_save_host_page_post() notifiers around ram_save_host_page()
* instead of bulky inline write-unprotect code.
One thing I mentioned previously but it seems still got lost is that we don't
need dirty tracking for live snapshot.
A few pointers for reference:
memory_global_dirty_log_start()
migration_bitmap_sync_precopy()
memory_region_clear_dirty_bitmap()
...
These should not be needed. But this can also be done on top.
Thanks,