Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

fix: Call KVM_KVMCLOCK_CTRL not only after pause but also before snapshot resume#5494

Merged
zulinx86 merged 1 commit intofirecracker-microvm:mainfrom
zulinx86:kvmclock_ctrl_before_resume
Oct 29, 2025
Merged

fix: Call KVM_KVMCLOCK_CTRL not only after pause but also before snapshot resume#5494
zulinx86 merged 1 commit intofirecracker-microvm:mainfrom
zulinx86:kvmclock_ctrl_before_resume

Conversation

@zulinx86
Copy link
Contributor

@zulinx86zulinx86 commentedOct 28, 2025
edited
Loading

Fixes#5322.

Changes

  • Call KVM_KVMCLOCK_CTRL not only after pause but also before snapshot resume

Reason

KVM_KVMCLOCK_CTRL ioctl setspvclock_set_guest_stopped_request flag ofkvm_vcpu_arch1. On the next guest time update, if the flag is set, KVM ORs inPVCLOCK_GUEST_STOPPED andkvm_setup_guest_pvclock() pushes thehv_clock into the guest's pvclock page2. If thehv_clock has not been written to the guest's pvclock page when taking a snapshot, it is not saved in the snapshot memory (i.e.PVCLOCK_GUEST_STOPPED isn't set in resumed VMs). So we should call KVM_KVMCLOCK_CTRL ioctl before resuming a VM rather than after pausing a VM. That covers both the pause-and-resume case and the restore-and-resume case.

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

  • I have read and understandCONTRIBUTING.md.
  • I have runtools/devtool checkbuild --all to verify that the PR passes
    build checks on all supported architectures.
  • I have runtools/devtool checkstyle to verify that the PR passes the
    automated style checks.
  • I have described what is done in these changes, why they are needed, and
    how they are solving the problem in a clear and encompassing way.
  • [ ] I have updated any relevant documentation (both in code and in the docs)
    in the PR.
  • I have mentioned all user-facing changes inCHANGELOG.md.
  • If a specific issue led to this PR, this PR closes the issue.
  • [ ] When making API changes, I have followed the
    Runbook for Firecracker API changes.
  • I have tested all new and changed functionalities in unit tests and/or
    integration tests.
  • [ ] I have linked an issue to every newTODO.

  • This functionality cannot be added inrust-vmm.

@codecov
Copy link

codecovbot commentedOct 28, 2025
edited
Loading

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.84%. Comparing base (cc20162) to head (0894dbc).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@##             main    #5494   +/-   ##=======================================  Coverage   82.84%   82.84%           =======================================  Files         269      269             Lines       27737    27737           =======================================  Hits        22978    22978             Misses       4759     4759
FlagCoverage Δ
5.10-m5n.metal83.01% <100.00%> (+<0.01%)⬆️
5.10-m6a.metal82.28% <100.00%> (+<0.01%)⬆️
5.10-m6g.metal79.66% <100.00%> (-0.02%)⬇️
5.10-m6i.metal83.01% <100.00%> (+0.01%)⬆️
5.10-m7a.metal-48xl82.27% <100.00%> (+<0.01%)⬆️
5.10-m7g.metal79.66% <100.00%> (-0.02%)⬇️
5.10-m7i.metal-24xl82.99% <100.00%> (+0.01%)⬆️
5.10-m7i.metal-48xl82.98% <100.00%> (+<0.01%)⬆️
5.10-m8g.metal-24xl79.66% <100.00%> (-0.01%)⬇️
5.10-m8g.metal-48xl79.66% <100.00%> (-0.02%)⬇️
6.1-m5n.metal83.04% <100.00%> (+<0.01%)⬆️
6.1-m6a.metal82.31% <100.00%> (+<0.01%)⬆️
6.1-m6g.metal79.66% <100.00%> (-0.01%)⬇️
6.1-m6i.metal83.04% <100.00%> (+<0.01%)⬆️
6.1-m7a.metal-48xl82.30% <100.00%> (+<0.01%)⬆️
6.1-m7g.metal79.66% <100.00%> (-0.01%)⬇️
6.1-m7i.metal-24xl83.05% <100.00%> (+<0.01%)⬆️
6.1-m7i.metal-48xl83.05% <100.00%> (+<0.01%)⬆️
6.1-m8g.metal-24xl79.66% <100.00%> (-0.01%)⬇️
6.1-m8g.metal-48xl79.66% <100.00%> (-0.01%)⬇️

Flags with carried forward coverage won't be shown.Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zulinx86zulinx86force-pushed thekvmclock_ctrl_before_resume branch from301f879 toff48e0eCompareOctober 28, 2025 13:53
@zulinx86zulinx86force-pushed thekvmclock_ctrl_before_resume branch fromff48e0e to3fc6bf3CompareOctober 28, 2025 14:05
@zulinx86zulinx86enabled auto-merge (rebase)October 28, 2025 14:06
@zulinx86zulinx86 added the Status: Awaiting reviewIndicates that a pull request is ready to be reviewed labelOct 28, 2025
@zulinx86zulinx86force-pushed thekvmclock_ctrl_before_resume branch 2 times, most recently from64f27a2 to0dfdc66CompareOctober 28, 2025 15:51
kalyazin
kalyazin previously approved these changesOct 28, 2025
@Manciukic
Copy link
Contributor

To double check what's the impact on the resume path, I've kicked off a BK A/B build:https://buildkite.com/firecracker/performance-a-b-tests/builds/736

@zulinx86
Copy link
ContributorAuthor

To double check what's the impact on the resume path, I've kicked off a BK A/B build:https://buildkite.com/firecracker/performance-a-b-tests/builds/736

thanks!

@zulinx86zulinx86force-pushed thekvmclock_ctrl_before_resume branch 2 times, most recently from07cf216 toab0f55eCompareOctober 29, 2025 08:56
@zulinx86zulinx86 changed the titlefix: Move KVM_KVMCLOCK_CTRL from after pause to before resumefix: Call KVM_KVMCLOCK_CTRL not only after pause but also before snapshot resumeOct 29, 2025
KVM_KVMCLOCK_CTRL ioctl sets `pvclock_set_guest_stopped_request` flag of`kvm_vcpu_arch` [1]. On the next guest time update, if the flag is set,KVM ORs in `PVCLOCK_GUEST_STOPPED` and `kvm_setup_guest_pvclock()`pushes the `hv_clock` into the guest's pvclock page [2]. If the`hv_clock` has not been written to the guest's pvclock page when takinga snapshot, it is not saved in the snapshot memory (i.e.`PVCLOCK_GUEST_STOPPED` isn't set in resumed VMs). So we should callKVM_KVMCLOCK_CTRL ioctl before resuming a VM in addition to afterpausing a VM.[1]:https://elixir.bootlin.com/linux/v6.16.3/source/arch/x86/kvm/x86.c#L5734[2]:https://elixir.bootlin.com/linux/v6.16.3/source/arch/x86/kvm/x86.c#L3286-L3295Signed-off-by: Takahiro Itazuri <itazur@amazon.com>
@zulinx86zulinx86force-pushed thekvmclock_ctrl_before_resume branch fromab0f55e to0894dbcCompareOctober 29, 2025 09:00
@zulinx86zulinx86 merged commitd33011c intofirecracker-microvm:mainOct 29, 2025
8 checks passed
@zulinx86zulinx86 deleted the kvmclock_ctrl_before_resume branchOctober 29, 2025 10:57
maggie-lou added a commit to buildbuddy-io/buildbuddy that referenced this pull requestOct 30, 2025
Also includes this patch:firecracker-microvm/firecracker#5494I'm interested in these bug fixes since v1.11.0 (which we were onpreviously):firecracker-microvm/firecracker#5122firecracker-microvm/firecracker#5260We should also look into enabling PCI. From their release notes:> In our micro-benchmarks, we measured up to 50% better latency forblock and network, up to 70% better block throughput, and up to 25%higher network throughput (results depend on instance type and kernel).Also I had previously cherry-picked a firecracker patch that fixed someof the rcu_sched failures. It was formally merged into the firecrackerrepo[here](firecracker-microvm/firecracker#5494) andthis final version has some implementation differences from the patchwe'd applied. I can't directly apply the updated patch on v1.11.0 due tosome merge conflicts, but it applies cleanly on top of v1.13.0
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ManciukicManciukicManciukic left review comments

@kalyazinkalyazinkalyazin approved these changes

@xmarcalxxmarcalxAwaiting requested review from xmarcalxxmarcalx is a code owner

@pb8opb8oAwaiting requested review from pb8opb8o is a code owner

+1 more reviewer

@bchaliosbchaliosbchalios approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

Status: Awaiting reviewIndicates that a pull request is ready to be reviewed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug] Kernel panic when resuming from a memory snapshot

4 participants

@zulinx86@Manciukic@kalyazin@bchalios

[8]ページ先頭

©2009-2026 Movatter.jp