mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-22 04:25:21 +00:00
block_util: Mark dirty pages manually with "VolatileSlice::as_ptr()"
As discussed in the working PR in the upstream vm-memory crate repo, some special functions (e.g. return raw pointers to the wrapped guest memory) require manual dirty page tracking from their users (e.g.the VMM). One of the special functions is `VolatileSlice::as_ptr(), which is used in our code base for supporting async block I/O. This patch manually mark dirty for guest pages touched while reading from block devices. Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
7839e121f6
commit
1b87f332b0
@ -36,7 +36,8 @@ use versionize::{VersionMap, Versionize, VersionizeResult};
|
||||
use versionize_derive::Versionize;
|
||||
use virtio_bindings::bindings::virtio_blk::*;
|
||||
use vm_memory::{
|
||||
bitmap::AtomicBitmap, ByteValued, Bytes, GuestAddress, GuestMemory, GuestMemoryError,
|
||||
bitmap::AtomicBitmap, bitmap::Bitmap, ByteValued, Bytes, GuestAddress, GuestMemory,
|
||||
GuestMemoryError,
|
||||
};
|
||||
use vm_virtio::DescriptorChain;
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
@ -335,6 +336,12 @@ impl Request {
|
||||
// Queue operations expected to be submitted.
|
||||
match request_type {
|
||||
RequestType::In => {
|
||||
for (data_addr, data_len) in &self.data_descriptors {
|
||||
mem.get_slice(*data_addr, *data_len as usize)
|
||||
.map_err(ExecuteError::GetHostAddress)?
|
||||
.bitmap()
|
||||
.mark_dirty(0, *data_len as usize);
|
||||
}
|
||||
disk_image
|
||||
.read_vectored(offset, iovecs, user_data)
|
||||
.map_err(ExecuteError::AsyncRead)?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user