-
Notifications
You must be signed in to change notification settings - Fork 129
KVM Dirty log ring interface #344
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
base: main
Are you sure you want to change the base?
Conversation
roypat
left a comment
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.
please squash your commits so that we do not have later commits be fixups for previous commits.
|
Also, do we need to do anything about KVM_CAP_DIRTY_LOG_RING_WITH_BITMAP? |
As for this, Now, whether Send and Sync will actually be useful is a different matter, because I'm assuming you want them to be able to harvest the dirty ring while the vcpu is still running, but with the current API in this PR, you can only get a &mut reference to the ring buffer structure, which you cannot send to another thread anyway. So in this case, you'd need some API that lets you take ownership of the KvmDirtyRingLog structure (maybe store the one that gets created at vcpu creation time in an option, and then have a function that just wraps .take() on that option, keeping in mind that we must never allow safe code to get two owned versions of it for the same vcpu). |
|
Also sorry for the late response, we were all preparing for / traveling to KVM Forum last week! |
Turns out we do, and if it is supported, we also need to enable KVM_CAP_DIRTY_LOG_RING_ACQ_REL prior to enabling _WITH_BITMAP. Correct me if I'm wrong. |
66f0d63 to
362f0f5
Compare
|
Why is enable_cap not available in aarch64? |
11c85a5 to
ec0da8b
Compare
|
b00ead3 to
483342a
Compare
|
The enable_cap doctest uses KVM_CAP_SPLIT_IRQCHIP as an example, which is x86 only. This breaks the test and I disabled the enable_cap call in the test on other arches. |
I needed Send and Sync to move the Vcpus to separate threads, but I only implemented what the rust compiler suggested and am still looking for a better solution for this unrelated problem. |
6ccb6da to
1d09123
Compare
Please still squash your commits (and there's also conflicts, although GitHub isn't telling me what they are for some reason 🤔) |
|
So you want everything squashed into 1 commit? |
I will tentatively say "yes" (sorry, been a while since I looked at the actual changes here). But please have a look and see if there's anything that can be logically separated into their own commits (e.g. preliminary refactors, or changes to tests). |
|
I did change quite a few things so I already rebased it to seperate the commits logically, but if you require a single large commit I can change it as well. I can't really see the conflicts either, I suspect it is just because the commit introducing the DirtyLogRing cap has already been merged to main, while this PR contains my unmerged one. |
ec352ad to
851fe82
Compare
|
@roypat I squashed everything as requested. |
84007a9 to
3449081
Compare
|
Hi @davidkleymann , thanks for your work on this feature! I was testing it out and noticed that no VcpuExit is currently defined for |
that is a good catch, thanks! This should definitely be added in this PR :) |
Implement dirty log ring interface with `enable_dirty_log_ring` and `dirty_log_ring_iter` methods. Enable `VmFd` `enable_cap` and ioctl imports on all architectures. Add memory fences in iterator for proper synchronization on weak memory consistency architectures. Signed-off-by: David Kleymann <[email protected]>
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) from `0b1cb86` to `fc4584d`. - [Commits](rust-vmm/rust-vmm-ci@0b1cb86...fc4584d) --- updated-dependencies: - dependency-name: rust-vmm-ci dependency-version: fc4584d8b805be4e8193d43d9ba6519f9a0f43a5 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]>
Make the function more fail-safe. Signed-off-by: Philipp Schuster <[email protected]> On-behalf-of: SAP [email protected]
No longer needed since the Rust edition 2024 upgrade. Signed-off-by: Philipp Schuster <[email protected]> On-behalf-of: SAP [email protected]
No longer needed since the Rust edition 2024 upgrade. Signed-off-by: Philipp Schuster <[email protected]> On-behalf-of: SAP [email protected]
Failed because of needless fn main() in doctest Signed-off-by: Philipp Schuster <[email protected]> On-behalf-of: SAP [email protected]
Turns out that there is a flaw in upstream kvm-bindings that wasn't caught so far. Some parts of the serde feature also need the fam-wrappers feature. This was first discovered here [0] [1]. [0] rust-vmm#350 [1] https://buildkite.com/rust-vmm/kvm-ci/builds/1463/steps/canvas?jid=01995738-26ed-4e8c-9e14-c3f23d6de434 Signed-off-by: Philipp Schuster <[email protected]> On-behalf-of: SAP [email protected]
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) from `fc4584d` to `6f7d365`. - [Commits](rust-vmm/rust-vmm-ci@fc4584d...6f7d365) --- updated-dependencies: - dependency-name: rust-vmm-ci dependency-version: 6f7d3656a84b771f381ddf0b120062dcbacb4c04 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]>
Two bare links and two broken intra-doc links. Signed-off-by: Patrick Roy <[email protected]>
They were all related to testing specific features, but since the CI by default now uses cargo-all-features, this is redundant. Leave custom-tests.json around, as removing it would mean we also have to modify the buildkite pipeline definition itself, and that's always a bit messy to coordinate with the merging of PRs. Signed-off-by: Patrick Roy <[email protected]>
Test cases introduced by SBI related changes require SBI_V01 to be enabled during kernel compilation. At the point of `042b206` already incorporates `c41370c`, which is capable of covering this case. Signed-off-by: Ruoqing He <[email protected]>
Summary of the PR
Add support for dirty page tracking via the Dirty ring interface. Adds KvmDirtyLogRing structure for keeping track of the indices and the base pointer to the shared memory buffer. Implements iterating over dirty pages, thereby harvesting them. Implements reset_dirty_rings on VmFd to trigger recycling of dirty ring buffer elements by the kernel after processing. Adds the dirty_log_ring field to VcpuFd.
This is a draft that needs some review and improvements, I'm hereby asking for suggestions for improving the following remaining weaknesses:
More info on the interface:
https://www.kernel.org/doc/html/latest/virt/kvm/api.html#kvm-cap-dirty-log-ring-kvm-cap-dirty-log-ring-acq-rel
Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafecode is properly documented.