You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With virtual memory, seemingly consecutive I/O virtual memory regions
may actually be fragmented across multiple pages in our userspace
mapping. Existing `descriptor_utils::Reader::new()` (and `Writer`)
implementations (e.g. in virtiofsd or vm-virtio/virtio-queue) use
`GuestMemory::get_slice()` to turn guest memory address ranges into
valid slices in our address space; but with this fragmentation, it is
easily possible that a range no longer corresponds to a single slice.
To fix this, add a `get_slices()` method that iterates over potentially
multiple slices instead of a single one. We should probably also
deprecate `get_slice()`, but I’m hesitant to do it in the same
commit/PR.
(We could also try to use `try_access()` as an existing internal
iterator instead of this new external iterator, which would require
adding lifetimes to `try_access()` so the region and thus slices derived
from it could be moved outside of the closure. However, that will not
work for virtual memory that we are going to introduce later: It will
have a dirty bitmap that is independent of the one in guest memory
regions, so its `try_access()` function will need to dirty it after the
access. Therefore, the access must happen in that closure and the
reference to the region must not be moved outside.)
Signed-off-by: Hanna Czenczek <[email protected]>
0 commit comments