KVM: Implement ring-based dirty memory tracking

KVM currently uses large bitmaps to track dirty memory.  These bitmaps
are copied to userspace when userspace queries KVM for its dirty page
information. The use of bitmaps is sufficient for live-migration
method, as large parts of memory are be dirtied from one log-dirty
pass to another.  However, in a checkpointing system, the number of
dirty pages is small and in fact it is often bounded---the VM is paused
when it has dirtied a pre-defined number of pages. Traversing a large,
sparsely populated bitmap to find set bits is time-consuming, as is
copying the bitmap to user-space.

The preferred data structure for performant checkpointing solutions is
a dense list of guest frame numbers (GFN). This patch series stores
the dirty list in kernel memory that can be memory mapped into
userspace to allow speedy harvesting.

Signed-off-by: Lei Cao <lei.cao@stratus.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 files changed