Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# allowlisted using a toolchain that requires it, causing the A/B-test to
# always fail.
[toolchain]
channel = "1.95.0"
channel = "1.96.0"
targets = ["x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl"]
profile = "minimal"

4 changes: 4 additions & 0 deletions src/firecracker/src/api_server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ impl ApiServer {
&METRICS.latencies_us.diff_create_snapshot,
"create diff snapshot",
)),
// ADR 0045 off-pause flush — no dedicated latency metric.
SnapshotType::Msync | SnapshotType::MsyncAndState => None,
},
VmmAction::LoadSnapshot(_) => {
Some((&METRICS.latencies_us.load_snapshot, "load snapshot"))
Expand Down Expand Up @@ -277,6 +279,7 @@ mod tests {
snapshot_type: SnapshotType::Diff,
snapshot_path: PathBuf::new(),
mem_file_path: PathBuf::new(),
vmstate_only: false,
})),
start_time_us,
);
Expand All @@ -290,6 +293,7 @@ mod tests {
snapshot_type: SnapshotType::Diff,
snapshot_path: PathBuf::new(),
mem_file_path: PathBuf::new(),
vmstate_only: false,
})),
start_time_us,
);
Expand Down
30 changes: 30 additions & 0 deletions src/firecracker/src/api_server/request/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ fn parse_put_snapshot_load(body: &Body) -> Result<ParsedRequest, RequestError> {
network_overrides: snapshot_config.network_overrides,
vsock_override: snapshot_config.vsock_override,
clock_realtime: snapshot_config.clock_realtime,
shared: snapshot_config.shared,
uffd_base_file: snapshot_config.uffd_base_file,
};

// Construct the `ParsedRequest` object.
Expand Down Expand Up @@ -147,6 +149,7 @@ mod tests {
snapshot_type: SnapshotType::Diff,
snapshot_path: PathBuf::from("foo"),
mem_file_path: PathBuf::from("bar"),
vmstate_only: false,
};
assert_eq!(
vmm_action_from_request(parse_put_snapshot(&Body::new(body), Some("create")).unwrap()),
Expand All @@ -161,6 +164,23 @@ mod tests {
snapshot_type: SnapshotType::Full,
snapshot_path: PathBuf::from("foo"),
mem_file_path: PathBuf::from("bar"),
vmstate_only: false,
};
assert_eq!(
vmm_action_from_request(parse_put_snapshot(&Body::new(body), Some("create")).unwrap()),
VmmAction::CreateSnapshot(expected_config)
);

let body = r#"{
"snapshot_path": "foo",
"mem_file_path": "bar",
"vmstate_only": true
}"#;
let expected_config = CreateSnapshotParams {
snapshot_type: SnapshotType::Full,
snapshot_path: PathBuf::from("foo"),
mem_file_path: PathBuf::from("bar"),
vmstate_only: true,
};
assert_eq!(
vmm_action_from_request(parse_put_snapshot(&Body::new(body), Some("create")).unwrap()),
Expand Down Expand Up @@ -191,6 +211,8 @@ mod tests {
network_overrides: vec![],
vsock_override: None,
clock_realtime: false,
shared: false,
uffd_base_file: None,
};
let mut parsed_request = parse_put_snapshot(&Body::new(body), Some("load")).unwrap();
assert!(
Expand Down Expand Up @@ -223,6 +245,8 @@ mod tests {
network_overrides: vec![],
vsock_override: None,
clock_realtime: false,
shared: false,
uffd_base_file: None,
};
let mut parsed_request = parse_put_snapshot(&Body::new(body), Some("load")).unwrap();
assert!(
Expand Down Expand Up @@ -255,6 +279,8 @@ mod tests {
network_overrides: vec![],
vsock_override: None,
clock_realtime: false,
shared: false,
uffd_base_file: None,
};
let mut parsed_request = parse_put_snapshot(&Body::new(body), Some("load")).unwrap();
assert!(
Expand Down Expand Up @@ -296,6 +322,8 @@ mod tests {
}],
vsock_override: None,
clock_realtime: false,
shared: false,
uffd_base_file: None,
};
let mut parsed_request = parse_put_snapshot(&Body::new(body), Some("load")).unwrap();
assert!(
Expand Down Expand Up @@ -325,6 +353,8 @@ mod tests {
network_overrides: vec![],
vsock_override: None,
clock_realtime: false,
shared: false,
uffd_base_file: None,
};
let parsed_request = parse_put_snapshot(&Body::new(body), Some("load")).unwrap();
assert_eq!(
Expand Down
29 changes: 28 additions & 1 deletion src/firecracker/swagger/firecracker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1621,9 +1621,19 @@ definitions:
enum:
- Full
- Diff
- Msync
- MsyncAndState
description:
Type of snapshot to create. It is optional and by default, a full
snapshot is created.
snapshot is created. `Msync` flushes a MAP_SHARED file-backed guest
memory to its backing memfile via msync(MS_SYNC) without writing the
machine state; `MsyncAndState` also writes the state file.
vmstate_only:
type: boolean
description:
Write only the microVM state file and skip the guest-memory leg
entirely (mem_file_path is ignored). Incompatible with the
Msync/MsyncAndState snapshot types. Optional and defaults to false.

NetworkOverride:
type: object
Expand Down Expand Up @@ -1710,6 +1720,23 @@ definitions:
elapsed since the snapshot was taken. When false (default), kvmclock resumes
from where it was at snapshot time. This option may be extended to other clock
sources and CPU architectures in the future."
shared:
type: boolean
description:
When set to true and the memory is restored from a file, map the guest
memory MAP_SHARED so guest writes flush back to the backing memfile (the
page-readable source for post-copy live migration). No effect for the UFFD
backend. Optional; defaults to false (MAP_PRIVATE).
uffd_base_file:
type: string
description:
Unified-memory-substrate base backing (engrams ADR 0045 v2b). When set
with the Uffd memory backend, guest memory is created as MAP_PRIVATE of
this shmem file instead of anonymous, and the UFFD registration uses
MISSING|MINOR. The external handler resolves base-identical pages with
UFFDIO_CONTINUE (page-cache sharing across same-template microVMs) and
divergent pages with UFFDIO_COPY; guest writes COW natively. Invalid
with the File backend. Optional.


TokenBucket:
Expand Down
3 changes: 2 additions & 1 deletion src/vmm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ serde = { version = "1.0.228", features = ["derive", "rc"] }
serde_json = "1.0.149"
slab = "0.4.12"
thiserror = "2.0.18"
userfaultfd = "0.9.0"
# linux5_13: RegisterMode::MINOR for the ADR 0045 substrate (v2b) registration.
userfaultfd = { version = "0.9.0", features = ["linux5_13"] }
utils = { path = "../utils" }
uuid = "1.23.1"
vhost = { version = "0.15.0", features = ["vhost-user-frontend"] }
Expand Down
Loading
Loading