-
Notifications
You must be signed in to change notification settings - Fork 2.2k
snapshot-editor: expanding CLI to support tsc set/clear commands #5581
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?
snapshot-editor: expanding CLI to support tsc set/clear commands #5581
Conversation
Add set/clear TSC CLI subcommands and wire them into snapshot-editor. Signed-off-by: Tomas Srnka <tomas.srnka@gmail.com>
Document snapshot-editor TSC set/clear commands with usage examples. Signed-off-by: Tomas Srnka <tomas.srnka@gmail.com>
Rewrite TSC set/clear to always modify the input vmstate file in-place. Update docs and changelog to reflect in-place behavior. Signed-off-by: Tomas Srnka <tomas.srnka@gmail.com>
Add a unit test that sets and clears TSC values in-place. Verify vCPU metadata updates when reloading the vmstate. Signed-off-by: Tomas Srnka <tomas.srnka@gmail.com>
Allow MissingFrequency to be dead_code on x86_64 to avoid warnings. Signed-off-by: Tomas Srnka <tomas.srnka@gmail.com>
Insert a blank line after the Added heading so mdformat style passes. Signed-off-by: Tomas Srnka <tomas.srnka@gmail.com>
|
Hi @tomassrnka, can you elaborate on the way snapshot restore fails for you? |
Note that TSC scaling requires H/W support. And in case you use nested virtualization the host kernel needs to be 5.15 or later. So we need to understand your failure mode. |
|
The real-world scenario we’re hitting is the following: We create a snapshot on a C4 instance on GCP and can successfully restore it on an N4 instance. However, restoring a snapshot created on N4 back onto C4 fails due to the TSC constraint:
Both C4 and N4 instances use the same CPU family (Intel Xeon Scalable – Emerald Rapids / Granite Rapids), so this was initially unexpected. Unless a new TSC value is read from the destination host and the snapshot is adjusted accordingly, the restore cannot succeed. As a result, we introduced two new calls in snapshot-editor that allow modifying the TSC values inside the snapshot before restore. The error we observe without this adjustment is:
In other words, restoring on a CPU with a higher TSC works, but not the other way around. |
Changes
snapshot-editor tsc set/clearto edit per-vCPUtsc_khzvalues in vmstate snapshotssnapshot-editor tsc set --vmstate-path <file> --tsc-khz 2500000;snapshot-editor tsc clear --vmstate-path <file>--tsc-khzelsewhere)Reason
clear stale TSC values and stamp the target TSC so snapshots resume cleanly
Testing
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.