Skip to content
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

Reset dirty log on full snapshot path #4379

Closed
wants to merge 1 commit into from

Conversation

Msknsngla
Copy link
Contributor

Changes

  • Added the get_dirty_bitmap on the full snapshot path

Reason

  • The full snapshot path doesn’t call Vmm:get_dirty_bitmap thus doesn’t call KVM_GET_DIRTY_LOG which doesn’t reset dirty pages.

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

  • If a specific issue led to this PR, this PR closes the issue.
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • API changes follow the Runbook for Firecracker API changes.
  • User-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.
  • New TODOs link to an issue.
  • Commits meet contribution quality standards.

  • This functionality cannot be added in rust-vmm.

@Msknsngla
Copy link
Contributor Author

Created a draft PR to check of the logic is correct, if so will create the PR with some refactoring.

Comment on lines +252 to +257
SnapshotType::Full => {
let dirty_bitmap = vmm.get_dirty_bitmap().map_err(DirtyBitmap)?;
vmm.guest_memory()
.dump_dirty(&mut file, &dirty_bitmap)
.map_err(Memory)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm misunderstanding (@pb8o please let me know).

This replicates the behavior of diff snapshots, it won't output the non-dirty pages.

It should output all pages when taking a full snapshot e.g.

Suggested change
SnapshotType::Full => {
let dirty_bitmap = vmm.get_dirty_bitmap().map_err(DirtyBitmap)?;
vmm.guest_memory()
.dump_dirty(&mut file, &dirty_bitmap)
.map_err(Memory)
}
SnapshotType::Full => {
// Reset dirty pages.
let _ = vmm.get_dirty_bitmap().map_err(DirtyBitmap)?;
// Dump all pages.
vmm.guest_memory()
.dump(&mut file)
.map_err(Memory)
}

See https://github.com/firecracker-microvm/firecracker/blob/main/src/vmm/src/vstate/memory.rs#L271:L337

@JonathanWoollett-Light
Copy link
Contributor

Replaced by #4385

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants