-
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
Start dirty page tracking implementation in vm-memory. #2149
Start dirty page tracking implementation in vm-memory. #2149
Conversation
0e20ced
to
d6f1935
Compare
I may have gotten it backwards - I was thinking that Firecracker will continue consuming |
The dependency to vm-memory from upstream is kept in the local proxy crate |
d6f1935
to
46bf383
Compare
46bf383
to
baa0a01
Compare
Why not create a new implementor for |
FWIW I also understood the coupling in the way @aghecenco described it above. |
The goal here is to do as few changes as possible to the interfaces we currently use in Firecracker with the hope that tracking will be available in upstream. The Firecracker code uses both the GuestMemory interface and also the GuestMemoryMmap backend directly. If we implement a new backend like GuestMemoryMmapTracked we would need to do more changes in Firecracker. The approach in this PR is less invasive and completely transparent to Firecracker as we re-export all the stuff from upstream and we override only what's needed to support our usecase. |
de40fbc
to
fe74a58
Compare
- Import mmap.rs from rust-vmm/vm-memory v0.2.2. - Added markers where write access needs to mark dirty bits in bitmap. Signed-off-by: Andrei Sandu <[email protected]>
fe74a58
to
919410c
Compare
919410c
to
ba4635c
Compare
ba4635c
to
31b92ea
Compare
Signed-off-by: Andrei Sandu <[email protected]>
- update Cargo.toml for all crates - implement AsSlice interface for GuestRegionMmap. Signed-off-by: Andrei Sandu <[email protected]>
Signed-off-by: Andrei Sandu <[email protected]>
31b92ea
to
d086a32
Compare
// Windows needs a dedicated test where it will retrieve the allocation | ||
// granularity to determine a proper offset (other than 0) that can be | ||
// used for the backing file. Refer to Microsoft docs here: | ||
// https://docs.microsoft.com/en-us/windows/desktop/api/memoryapi/nf-memoryapi-mapviewoffile |
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.
I don't think we should we keep this indication.
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.
You are right.
// Portions Copyright 2017 The Chromium OS Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the THIRD-PARTY file. |
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.
nit: is this still the case?
// Copyright (C) 2019 Alibaba Cloud Computing. All rights reserved. | ||
// | ||
// Portions Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
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.
nit: For this local file where we add dirty tracking support, these two might be better reversed.
pub fn new(byte_size: usize, page_size: usize) -> Self { | ||
// Bit size is the number of bits in the bitmap, always at least 1 (to store the state of | ||
// the '0' address). | ||
let bit_size = std::cmp::max(1, byte_size / page_size); |
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.
nit:
let bit_size = std::cmp::max(1, byte_size / page_size); | |
let num_pages = std::cmp::max(1, byte_size / page_size); |
for clarity.
// TODO: This implementation is temporary. | ||
// We need to return None here once we refactor vsock. |
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.
Let's add an issue to track 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.
Created #2153
Reason for This PR
Bootstrap implementation for dirty page tracking in vm-memory - #1997
Thanks @alexandruag for providing insight/PoC on the proxy crate approach.
Description of Changes
Create a "proxy" crate that Firecracker will use as a dependency for all current vm-memory imports. This crate will export local GuestMemoryMmap and GuestRegionMap implementations that will contain dirty page tracking functionality. All other re-exports will be fetched from upstream vm-memory.
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
[Author TODO: Meet these criteria.]
[Reviewer TODO: Verify that these criteria are met. Request changes if not]
git commit -s
).unsafe
code is properly documented.firecracker/swagger.yaml
.CHANGELOG.md
.