-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
integrate vm-memory with dirty page tracking #2661
Conversation
Seems like upstream feature is not stabilized yet: rust-vmm/vm-memory#158 |
Thanks for pointing it out, that PR seems very fresh. I'm going to make this PR a draft and keep it this way until rust-vmm has a release |
vm-memory 0.6.0 was released so I'll rebase this PR soon and mark it ready for review |
PR is now ready for review |
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.
The PR looks good. I just have a couple of small comments, most of them related to the old code. As a high level comment, we usually make sure that each commit builds. I don't know of any exception so far. Can we do the same thing here while keeping the PR structure (keeping it split in multiple small commits in order to make it easy to review) ?
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.
Changes look good overall. How far are we from dropping the local vm-memory
crate from FC ?
@@ -5,6 +5,6 @@ authors = ["Amazon Firecracker team <[email protected]>"] | |||
edition = "2018" | |||
|
|||
[dependencies] | |||
vm-memory-upstream = { package = "vm-memory", version = ">=0.2.2", features = ["backend-mmap"] } | |||
vm-memory-upstream = { package = "vm-memory", version = "0.6.0", features = ["backend-mmap", "backend-bitmap"] } |
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.
So can t we use the vm-memory crate directly?
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.
My take on this is that create_guest_memory
should be placed in vmm since this is the glue code needed in order to make use of upstream vm-memory so i do not see the need to have a separate crate in fc for this
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.
see this comment: #2661 (comment)
I see there are multiple comments related to dropping the vm-memory proxy crate from Firecracker. In a nutshell, what prevents us from removing the proxy crate are the following:
In my opinion, keeping the proxy crate implementation as it is now is the best way of currently handling the situation. @sandreim @dianpopa @serban300 @alexandruag I'm more than happy to hear alternatives and please leave your thoughts here. |
691f82f
to
8a63ca0
Compare
Unfortunately, I can't do this without squashing into the first commit the commits adding modifications to the tests. WDYT @serban300 ? |
We synced offline and decided that keeping the minimal proxy crate in the Firecracker is the right thing to do, for the reasons outlined above. The PR is now ready for another review, I've addressed all of your comments @serban300 @dianpopa @sandreim |
de09c1a
to
2576452
Compare
I've changed the target branch of this PR to be |
I am noticing some block throughput degradation with this PR, so let's wait until we conclude the investigation |
dismissing review because we need further investigation for the block performance issue
This reminds me of an issue. Do you think we could try to address #2592 in this PR as well ? Or right after ? Should be easy to implement and it would confirm if the new vm-memory release offers the expected performance for |
good call! This PR does in fact unblock the performance side of the vsock issue. The error handling is not solved so I posted an update and opened an issue in rust-vmm: rust-vmm/vm-memory#171 |
Signed-off-by: alindima <[email protected]>
Signed-off-by: alindima <[email protected]>
This module exports a couple of test helpers for creating the guest memory. The first one is for creating the guest memory without guard pages. This is needed because the default `create_guest_memory` uses MmapRegionBuilder::build_raw() for setting up the memory with guard pages, which would error if the size is not a multiple of the page size. We need a test helper because We have unit tests which need a custom memory size, not a multiple of the page size. The second test helpers creates anonymous guest memory objects, that do not need a FileOffset object. It is just a little syntactic sugar that helps deduplicate test code. Signed-off-by: alindima <[email protected]>
Signed-off-by: alindima <[email protected]>
Signed-off-by: alindima <[email protected]>
8b051d2
to
fcb695e
Compare
Investigation was concluded. No issue is caused by vm-memory, so we are unblocking this PR |
Signed-off-by: alindima <[email protected]>
fcb695e
to
eb389b4
Compare
Reason for This PR
The vm-memory crate from rust-vmm has recently introduced abstractions for dirty page tracking, similar to the ones we had in Firecracker.
We need to consume them to avoid code duplication and to strip down the proxy crate we have in Firecracker.
Note that this PR is made on a feature branch.
Description of Changes
GuestMemoryMmap
object,vm_memory::create_guest_memory
. There were a lot of alternatives of creating the guest memory before this PR, which were hard to follow.vm_memory::create_guest_memory
function..with_regions()
and.with_regions_mut()
with.iter()
.GuestMemoryMmap
with calls tocreate_guest_memory
or thecreate_guest_memory_unguarded
test utility (where needed).The proxy crate is still needed to reexport the GuestMemory* types with the concrete type of
B: Option<AtomicBitmap>
. Otherwise we'd have to modify all the code that uses the GuestMemory* types, which wouldn't look nice.It's also used for exporting the
create_guest_memory()
function.rust-vmm
.License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.
PR Checklist
git commit -s
).unsafe
code is properly documented.firecracker/swagger.yaml
.CHANGELOG.md
.