-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track regions of the TVM guest physical address space #4
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Just like std::vec::Vec::insert. Signed-off-by: Andrew Bresticker <abrestic@rivosinc.com>
So that we can get a mutable iterator to the underlying vector. Also use as{,_mut}_slice() to avoid the unsafe block. Signed-off-by: Andrew Bresticker <abrestic@rivosinc.com>
copy_and_add_data_pages_builder() intializes and maps pages one-by-one so if copy_from_guest() fails in the middle of the range, we end up with a partially-mapped range of pages. Fix this by intializing the entire range first before mapping. Signed-off-by: Andrew Bresticker <abrestic@rivosinc.com>
dgreid
reviewed
Jun 28, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall looks good, just a few questions.
Thanks!
In preparation for demand-filled pages, shared memory, and emulated MMIO introduce VmRegionList which keeps track of the regions in the guest physical address space. For now the only type of region we have is the memory that's fully populated prior to VM finalization. The region list is backed by an extra page that the host must donate during TvmCreate. Note that this could also be accomplished in the page table itself by flagging PTEs. That wastes much more memory however, in particular for regions which will never be populated (MMIO) or will likely only be sparsely populated (shared memory). Signed-off-by: Andrew Bresticker <abrestic@rivosinc.com>
There's no demand faulting currently and the direction we've decided to take going forward (for both shared memory and zero-fill-on-demand pages) is to forward the page fault to the host so that it can handle it by inserting a page. Signed-off-by: Andrew Bresticker <abrestic@rivosinc.com>
abrestic-rivos
force-pushed
the
topic/vm-regions
branch
from
June 29, 2022 01:06
b290de2
to
3e7e35e
Compare
LGTM, thanks! |
dgreid
approved these changes
Jun 29, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce
VmRegionList
which tracks the distinct regions in a TVM's guest physical address space, similar in principle to KVMmemslots
. This will be used in follow-on patches to support demand faulting of zero pages and emulated MMIO (and can also be used to support shared memory).Patches 1 and 2 are minor
PageVec
fixes, patch 3 fixes an error path when mapping pages, patch 4 introduces the VM region tracking, and patch 5 removes hooks for handling demand faults when copying to/from the guest address space.