misc: Upgrade to use the vm-memory crate w/ dirty-page-tracking

As the first step to complete live-migration with tracking dirty-pages
written by the VMM, this commit patches the dependent vm-memory crate to
the upstream version with the dirty-page-tracking capability. Most
changes are due to the updated `GuestMemoryMmap`, `GuestRegionMmap`, and
`MmapRegion` structs which are taking an additional generic type
parameter to specify what 'bitmap backend' is used.

The above changes should be transparent to the rest of the code base,
e.g. all unit/integration tests should pass without additional changes.

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen
2021-06-02 12:08:04 -07:00
committed by Rob Bradford
parent c7b794a7c5
commit b5bcdbaf48
53 changed files with 120 additions and 71 deletions

View File

@@ -16,7 +16,7 @@ use std::num::Wrapping;
use std::sync::atomic::{fence, Ordering};
use std::sync::Arc;
use vm_memory::{
Address, ByteValued, Bytes, GuestAddress, GuestMemory, GuestMemoryError, GuestMemoryMmap,
bitmap::AtomicBitmap, Address, ByteValued, Bytes, GuestAddress, GuestMemory, GuestMemoryError,
GuestUsize,
};
@@ -24,6 +24,8 @@ pub const VIRTQ_DESC_F_NEXT: u16 = 0x1;
pub const VIRTQ_DESC_F_WRITE: u16 = 0x2;
pub const VIRTQ_DESC_F_INDIRECT: u16 = 0x4;
type GuestMemoryMmap = vm_memory::GuestMemoryMmap<AtomicBitmap>;
#[derive(Debug)]
pub enum Error {
GuestMemoryError,
@@ -717,7 +719,9 @@ pub mod testing {
use std::marker::PhantomData;
use std::mem;
use vm_memory::Bytes;
use vm_memory::{Address, GuestAddress, GuestMemoryMmap, GuestUsize};
use vm_memory::{bitmap::AtomicBitmap, Address, GuestAddress, GuestUsize};
type GuestMemoryMmap = vm_memory::GuestMemoryMmap<AtomicBitmap>;
// Represents a location in GuestMemoryMmap which holds a given type.
pub struct SomeplaceInMemory<'a, T> {
@@ -960,7 +964,9 @@ pub mod testing {
pub mod tests {
use super::testing::*;
pub use super::*;
use vm_memory::{GuestAddress, GuestMemoryMmap};
use vm_memory::{bitmap::AtomicBitmap, GuestAddress};
type GuestMemoryMmap = vm_memory::GuestMemoryMmap<AtomicBitmap>;
#[test]
fn test_checked_new_descriptor_chain() {