-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Support for VMGenID device on x86 microVMs #4487
Conversation
This is still a draft, since it depends on #4428 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4487 +/- ##
==========================================
+ Coverage 82.04% 82.14% +0.09%
==========================================
Files 253 255 +2
Lines 31072 31278 +206
==========================================
+ Hits 25492 25692 +200
- Misses 5580 5586 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
e488135
to
9f43105
Compare
3f3190c
to
af19d42
Compare
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.
still going through the code but here are some initial comments
Changes from v1 to v2:
|
93d08c1
to
109355e
Compare
Changes from v2 to v3:
|
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 PR seems fine to me. The only thing to make it a bit better would be to split first commit into several commits smth like:
update mmio_restore_args
add acpi_device_manager
add vmgenid
- ...
@ShadowCurse regarding splitting the first commit in parts, I believe that splitting out the MMIO restore argument changes it makes sense. I don't see much value in splitting out the ACPI device manager though. Without the VMGenID changes, this would be just adding an empty struct (without any implementation at all). I would rather keep them together. |
Changes from v3 to v4:
|
Use a reference to the GuestMemoryMmap rather than the object itself when restoring MMIO devices. This will avoid us a few clone() operations later on when we add support for restoring VMGenID, where we will need to pass information about the memory as well. Signed-off-by: Babis Chalios <[email protected]>
Add support for the Virtual Machine Generation ID (VMGenID) device that allows notifying the guest about snapshot resume events. The device itself allocates one page of guest memory and an IRQ line. It stores a 16 bytes cryptographically random number (generation ID) at the beginning of this page. Once the microVM resumes from a snapshot, it writes a new 16-byte generation ID and sends an interrupt to the device. Also add support for the Generic Event Device, an ACPI device which handles IRQ lines allocated to ACPI devices and routes them as ACPI notifications to the devices the belong to. VMGenID state is saved in Firecracker snapshots. This renders the current snapshot format incompatible with all previous snapshot versions. Bump snapshot version to 2.0.0 to reflect that. Signed-off-by: Babis Chalios <[email protected]>
We now reserve one IRQ for the VMGenID device, so we have one less IRQ available for VirtIO devices. Signed-off-by: Babis Chalios <[email protected]>
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.
LGTM, I would however like to get a 2nd opinion on the kernels_unfiltered
from @pb8o
At the moment, we filter out 6.1 guest kernel in all tests apart from PTP on Graviton. Add a new filter that allows select any kernel that exists in our CI artifacts folder and use it to create a pytest fixture for guest kernel 6.1, which works independently of the platform we run on. Signed-off-by: Babis Chalios <[email protected]>
Add an integration test that launches a microVM, snapshots it repeatedly and checks for the existence of the message that the kernel emits every time it receives the VMGenID notification. Signed-off-by: Babis Chalios <[email protected]>
In test_vulnerabilities.py we have various tests that check whether a condition holds after resuming from a snapshot. These checks seem to consistently fail if we take a snapshot before letting the guest kernel boot. Introduce an ssh command to ensure that the guest has booted before taking the snapshot so that we avoid the issue. Signed-off-by: Babis Chalios <[email protected]>
Extend our current documentation for snapshotting and entropy recommendations with context about VMGenID. Mention the available VMGenID features depending on Linux version and also provide recommendations for entropy on VM clones based on VMGenID availability. Also, add CHANGELOG entry for VMGenID support. Signed-off-by: Babis Chalios <[email protected]>
Changes
Add support for Virtual Machine Generation ID for x86 microVMs. This also adds support for the ACPI Generic Event Device which routes interrupts for ACPI devices. VMGenID provides to the guest a 16-byte cryptographically random number which changes every time the microVM resumes from a snapshot.
Reason
VMGenID is used by the Linux kernel to re-seed its internal PRNG whenever a VM resumes from a snapshot. With Linux 6.8, Linux VMGenID driver will also emit a uevent to guest user-space every time the generation ID changes (i.e. the VM resumes from a snapshot).
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md
.PR Checklist
PR.
CHANGELOG.md
.TODO
s link to an issue.contribution quality standards.
rust-vmm
.