-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add snapsafety features to VMClock device #5564
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
6818148 to
81dbeb2
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5564 +/- ##
=======================================
Coverage 83.23% 83.24%
=======================================
Files 277 277
Lines 29265 29310 +45
=======================================
+ Hits 24359 24399 +40
- Misses 4906 4911 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5487e22 to
115a1d6
Compare
Add support for vm_generation_counter and notifications. Keep this separately for now, since currently upstream bindings don't include it. We will recreate this for Linux headers once they are released. Signed-off-by: Babis Chalios <[email protected]>
Add support for `vm_generation_counter` field in VMClock ABI. This field is similar to `disruption_marker` but it's only updated on snapshot loading events (not in live migration). It is meant to provide the guest with snapshot safety notifications. Moreover, add support for the notification capability. This capability require us to send an ACPI notification every time we change the seq_count field to a new even value. This essentially means that we need to send a notification upon resuming from a snapshot just before resuming vCPUs. Signed-off-by: Babis Chalios <[email protected]>
Extend VMClock integration tests to also account for the vm_generation_counter field and notification support flag. Signed-off-by: Babis Chalios <[email protected]>
Expose VMClock device to guest via DT and enable compiling the vmclock for ARM architectures. Keep VMClock tests only on x86 until we get support from the guest kernel. Signed-off-by: Babis Chalios <[email protected]>
Add support to apply patches while build kernels for our CI. For the time being we use this to apply patches for snapshot safety VMClock extensions [1] (backported to 5.10 and 6.1 AL kernels). [1] https://lkml.org/lkml/2025/12/3/653 Signed-off-by: Babis Chalios <[email protected]>
Enable CONFIG_PTP_1588_CLOCK_VMCLOCK for both 5.10 and 6.1 kernels Signed-off-by: Babis Chalios <[email protected]>
We now apply backported patches that add support for VMClock on Aarch64 systems via DT bindings, so enable tests for Aarch64 as well. Moreover, backported patches add support for the poll() system calls family, so enable the relevant test. Signed-off-by: Babis Chalios <[email protected]>
115a1d6 to
99d68b0
Compare
| pub const VMCLOCK_FLAG_TIME_ESTERROR_VALID: u64 = 32; | ||
| pub const VMCLOCK_FLAG_TIME_MAXERROR_VALID: u64 = 64; | ||
| pub const VMCLOCK_FLAG_TIME_MONOTONIC: u64 = 128; | ||
| pub const VMCLOCK_FLAG_VM_GEN_COUNTER_PRESENT: u64 = 256; |
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.
should we add this to our bindgen patches?
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, at the moment we should be doing that, in theory. In the future, when the ABI changes are merged in Linux mainline we won't need to. And this change will disappear. So, IOW, I think it doesn't matter how we apply this change now, because in the future we will just recreate the bindings and that's it. If we have this in our patches, the patches won't apply. Which isn't a big deal, we can re-create the patch, so either way works for me.
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.
yeah, my concern is that if we need to regenerate the bindings we may inadvertently lose these manual changes as there's no patch to apply 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.
if we do that, the Firecracker won't compile so we'll find out. If I add it as bindgen patches, we won't be able to recreate the bindings next time. Choose your poison :P (either way works for me)
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.
fair, but I'd rather keep the generated files fully auto-generated. But it's no strong opinion, hopefully this is all temporary anyways.
| # Undo any patches previsouly applied, so that we can build the same kernel with different | ||
| # configs, e.g. no-acpi | ||
| git reset --hard $(get_tag $KERNEL_VERSION) | ||
| git clean -f -d | ||
|
|
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.
should we just create a temporary branch for the build? iow replace
- git checkout $(get_tag $KERNEL_VERSION)
+ git checkout -B tmp $(get_tag $KERNEL_VERSION)
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.
That should work as well and it's much cleaner. I'll give it a try
| # Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. | ||
| # | ||
| CONFIG_PTP_1588_CLOCK_KVM=y | ||
| CONFIG_PTP_1588_CLOCK_VMCLOCK=y |
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 think we should have this in our patches on top of this base config, otherwise we risk removing these when we rebase the config.
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.
Problem is that our patches apply in the Linux tree and this config doesn't exist inside it. We would need a separate set of patches which apply in the configs, right?
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 am not following. We're adding patches to the linux tree to support this device on aarch64. Why wouldn't the configs apply to it?
We do this after checking out the tree and applying the patches:
# Concatenate all config files into one. olddefconfig will then resolve
# as needed. Later values override earlier ones.
cat "$@" >.config
make olddefconfig
So having it here or in vmclock.config should be equivalent, right?
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.
oh right. I had forgotten about the extra configs we're keeping. I though you meant having it as part of the linux kernel source code pathces (the one I just added). Sure, I'll move it there.
We created a CI bucket that includes VMClock kernels with backported patches for the snapshot safety features. Signed-off-by: Babis Chalios <[email protected]>
Changes
Implement snapshot safety features for VMClock device as described in this Linux patchset: https://lore.kernel.org/lkml/[email protected]/.
Expose the
vm_generation_counterfield in thevmclock_abi. Also, implement the notification feature. This simply means that during snapshot resume we bumpvm_gneration_counterand inject an interrupt to the guest before resuming vCPUs.Reason
Provide a means for the guest userspace to know that the microVM has been loaded from a snpahost
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
tools/devtool checkbuild --allto verify that the PR passesbuild checks on all supported architectures.
tools/devtool checkstyleto verify that the PR passes theautomated style checks.
how they are solving the problem in a clear and encompassing way.
in the PR.
CHANGELOG.md.Runbook for Firecracker API changes.
integration tests.
TODO.rust-vmm.