Skip to content

Commit bf3b182

Browse files
authored
Merge branch 'main' into legacy-unwrap
2 parents b65d463 + a6d0d93 commit bf3b182

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+942
-1537
lines changed

.buildkite/common.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@
1414
import subprocess
1515
from pathlib import Path
1616

17+
# fmt: off
1718
DEFAULT_INSTANCES = [
18-
"c5n.metal", # Intel Skylake
19-
"m5n.metal", # Intel Cascade Lake
20-
"m6i.metal", # Intel Icelake
21-
"m6a.metal", # AMD Milan
22-
"m7a.metal-48xl", # AMD Genoa
23-
"m6g.metal", # Graviton2
24-
"m7g.metal", # Graviton3
19+
"c5n.metal", # Intel Skylake
20+
"m5n.metal", # Intel Cascade Lake
21+
"m6i.metal", # Intel Icelake
22+
"m7i.metal-24xl", # Intel Sapphire Rapids
23+
"m7i.metal-48xl", # Intel Sapphire Rapids
24+
"m6a.metal", # AMD Milan
25+
"m7a.metal-48xl", # AMD Genoa
26+
"m6g.metal", # Graviton2
27+
"m7g.metal", # Graviton3
2528
]
29+
# fmt: on
2630

2731
DEFAULT_PLATFORMS = [
2832
("al2", "linux_5.10"),

.buildkite/pipeline_cpu_template.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class BkStep(str, Enum):
3030
"c5n.metal",
3131
"m5n.metal",
3232
"m6i.metal",
33+
"m7i.metal-24xl",
34+
"m7i.metal-48xl",
3335
"m6a.metal",
3436
"m7a.metal-48xl",
3537
],
@@ -69,8 +71,9 @@ class BkStep(str, Enum):
6971
"c5n.metal",
7072
"m5n.metal",
7173
"m6i.metal",
74+
"m7i.metal-24xl",
75+
"m7i.metal-48xl",
7276
"m6a.metal",
73-
"m7a.metal-48xl",
7477
],
7578
},
7679
}

.buildkite/pipeline_cross.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"c5n.metal",
2323
"m5n.metal",
2424
"m6i.metal",
25+
"m7i.metal-24xl",
26+
"m7i.metal-48xl",
2527
"m6a.metal",
2628
"m7a.metal-48xl",
2729
]

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ and this project adheres to
2626
WAITPKG CPUID bit in CPUID normalization. The feature enables a guest to put a
2727
physical processor into an idle state, which is undesirable in a FaaS
2828
environment since that is what the host wants to decide.
29+
- [#5142](https://github.com/firecracker-microvm/firecracker/pull/5142):
30+
Clarified what CPU models are supported by each existing CPU template.
31+
Firecracker exits with an error if a CPU template is used on an unsupported
32+
CPU model.
2933

3034
### Deprecated
3135

@@ -48,6 +52,11 @@ and this project adheres to
4852
the UFFD Unix domain socket open to prevent the race condition between the
4953
guest memory mappings message and the shutdown event that was sometimes
5054
causing arrival of an empty message on the UFFD handler side.
55+
- [#5143](https://github.com/firecracker-microvm/firecracker/pull/5143): Fixed
56+
to report `process_startup_time_us` and `process_startup_time_cpu_us` metrics
57+
for `api_server` right after the API server starts, while previously reported
58+
before applying seccomp filter and starting the API server. Users may observe
59+
a bit longer startup time metrics.
5160

5261
## [1.11.0]
5362

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ We test all combinations of:
135135
| c5n.metal | al2 linux_5.10 | ubuntu 24.04 | linux_5.10 |
136136
| m5n.metal | al2023 linux_6.1 | | linux_6.1 |
137137
| m6i.metal | | | |
138+
| m7i.metal-24xl | | | |
139+
| m7i.metal-48xl | | | |
138140
| m6a.metal | | | |
139141
| m7a.metal-48xl | | | |
140142
| m6g.metal | | | |

docs/cpu_templates/cpu-templates.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ Firecracker supports two types of CPU templates:
4848

4949
At the moment the following set of static CPU templates are supported:
5050

51-
| CPU template | CPU vendor | CPU model |
52-
| ------------ | ---------- | --------------------- |
53-
| C3 | Intel | any |
54-
| T2 | Intel | any |
55-
| T2A | AMD | Milan |
56-
| T2CL | Intel | Cascade Lake or newer |
57-
| T2S | Intel | any |
58-
| V1N1 | ARM | Neoverse V1 |
51+
| CPU template | CPU vendor | CPU model |
52+
| ------------ | ---------- | ------------------------------- |
53+
| C3 | Intel | Skylake, Cascade Lake, Ice Lake |
54+
| T2 | Intel | Skylake, Cascade Lake, Ice Lake |
55+
| T2A | AMD | Milan |
56+
| T2CL | Intel | Cascade Lake, Ice Lake |
57+
| T2S | Intel | Skylake, Cascade Lake |
58+
| V1N1 | ARM | Neoverse V1 |
5959

6060
T2 and C3 templates are mapped as close as possible to AWS T2 and C3 instances
6161
in terms of CPU features. Note that on a microVM that is lauched with the C3
@@ -71,8 +71,8 @@ a performance assessment if they wish to use the T2S template. Note that
7171
Firecracker expects the host to always be running the latest version of the
7272
microcode.
7373

74-
The T2CL template is mapped to be close to Intel Cascade Lake. It is not safe to
75-
use it on Intel CPUs older than Cascade Lake (such as Skylake).
74+
The T2CL template is mapped to be close to Intel Cascade Lake. It is only safe
75+
to use it on Intel Cascade Lake and Ice Lake.
7676

7777
The only AMD template is T2A. It is considered safe to be used with AMD Milan.
7878

src/firecracker/src/api_server/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ impl ApiServer {
7070
// Set the api payload size limit.
7171
server.set_payload_max_size(api_payload_limit);
7272

73-
// Store process start time metric.
74-
process_time_reporter.report_start_time();
75-
// Store process CPU start time metric.
76-
process_time_reporter.report_cpu_start_time();
77-
7873
// Load seccomp filters on the API thread.
7974
// Execution panics if filters cannot be loaded, use --no-seccomp if skipping filters
8075
// altogether is the desired behaviour.
@@ -86,6 +81,12 @@ impl ApiServer {
8681
}
8782

8883
server.start_server().expect("Cannot start HTTP server");
84+
info!("API server started.");
85+
86+
// Store process start time metric.
87+
process_time_reporter.report_start_time();
88+
// Store process CPU start time metric.
89+
process_time_reporter.report_cpu_start_time();
8990

9091
loop {
9192
let request_vec = match server.requests() {

src/firecracker/src/api_server_adapter.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::sync::{Arc, Mutex};
88
use std::thread;
99

1010
use event_manager::{EventOps, Events, MutEventSubscriber, SubscriberOps};
11-
use vmm::logger::{ProcessTimeReporter, error, warn};
11+
use vmm::logger::{ProcessTimeReporter, error, info, warn};
1212
use vmm::resources::VmResources;
1313
use vmm::rpc_interface::{
1414
ApiRequest, ApiResponse, BuildMicrovmFromRequestsError, PrebootApiController,
@@ -175,6 +175,7 @@ pub(crate) fn run_with_api(
175175
return Err(ApiServerError::FailedToBindAndRunHttpServer(err));
176176
}
177177
};
178+
info!("Listening on API socket ({bind_path:?}).");
178179

179180
let api_kill_switch_clone = api_kill_switch
180181
.try_clone()

src/vmm/src/arch/x86_64/cpu_model.rs

Lines changed: 46 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
use std::arch::x86_64::__cpuid as host_cpuid;
5-
use std::cmp::{Eq, Ordering, PartialEq, PartialOrd};
5+
use std::cmp::{Eq, PartialEq};
66

77
/// Structure representing x86_64 CPU model.
88
#[derive(Debug, Eq, PartialEq)]
@@ -19,6 +19,42 @@ pub struct CpuModel {
1919
pub stepping: u8,
2020
}
2121

22+
/// Family / Model / Stepping for Intel Skylake
23+
pub const SKYLAKE_FMS: CpuModel = CpuModel {
24+
extended_family: 0x0,
25+
extended_model: 0x5,
26+
family: 0x6,
27+
model: 0x5,
28+
stepping: 0x4,
29+
};
30+
31+
/// Family / Model / Stepping for Intel Cascade Lake
32+
pub const CASCADE_LAKE_FMS: CpuModel = CpuModel {
33+
extended_family: 0x0,
34+
extended_model: 0x5,
35+
family: 0x6,
36+
model: 0x5,
37+
stepping: 0x7,
38+
};
39+
40+
/// Family / Model / Stepping for Intel Ice Lake
41+
pub const ICE_LAKE_FMS: CpuModel = CpuModel {
42+
extended_family: 0x0,
43+
extended_model: 0x6,
44+
family: 0x6,
45+
model: 0xa,
46+
stepping: 0x6,
47+
};
48+
49+
/// Family / Model / Stepping for AMD Milan
50+
pub const MILAN_FMS: CpuModel = CpuModel {
51+
extended_family: 0xa,
52+
extended_model: 0x0,
53+
family: 0xf,
54+
model: 0x1,
55+
stepping: 0x1,
56+
};
57+
2258
impl CpuModel {
2359
/// Get CPU model from current machine.
2460
pub fn get_cpu_model() -> Self {
@@ -27,19 +63,6 @@ impl CpuModel {
2763
let eax = unsafe { host_cpuid(0x1) }.eax;
2864
CpuModel::from(&eax)
2965
}
30-
31-
/// Check if the current CPU model is Intel Cascade Lake or later.
32-
pub fn is_at_least_cascade_lake(&self) -> bool {
33-
let cascade_lake = CpuModel {
34-
extended_family: 0,
35-
extended_model: 5,
36-
family: 6,
37-
model: 5,
38-
stepping: 7,
39-
};
40-
41-
self >= &cascade_lake
42-
}
4366
}
4467

4568
impl From<&u32> for CpuModel {
@@ -54,59 +77,22 @@ impl From<&u32> for CpuModel {
5477
}
5578
}
5679

57-
impl From<&CpuModel> for u32 {
58-
fn from(cpu_model: &CpuModel) -> Self {
59-
(u32::from(cpu_model.extended_family) << 20)
60-
| (u32::from(cpu_model.extended_model) << 16)
61-
| (u32::from(cpu_model.family) << 8)
62-
| (u32::from(cpu_model.model) << 4)
63-
| u32::from(cpu_model.stepping)
64-
}
65-
}
66-
67-
impl PartialOrd for CpuModel {
68-
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
69-
Some(u32::from(self).cmp(&u32::from(other)))
70-
}
71-
}
72-
73-
impl Ord for CpuModel {
74-
fn cmp(&self, other: &Self) -> Ordering {
75-
u32::from(self).cmp(&u32::from(other))
76-
}
77-
}
78-
7980
#[cfg(test)]
8081
mod tests {
8182
use super::*;
8283

83-
const SKYLAKE: CpuModel = CpuModel {
84-
extended_family: 0,
85-
extended_model: 5,
86-
family: 6,
87-
model: 5,
88-
stepping: 4,
89-
};
90-
91-
const CASCADE_LAKE: CpuModel = CpuModel {
92-
extended_family: 0,
93-
extended_model: 5,
94-
family: 6,
95-
model: 5,
96-
stepping: 7,
97-
};
98-
9984
#[test]
10085
fn cpu_model_from() {
10186
let skylake_eax = 0x00050654;
102-
assert_eq!(u32::from(&SKYLAKE), skylake_eax);
103-
assert_eq!(CpuModel::from(&skylake_eax), SKYLAKE);
104-
}
87+
assert_eq!(CpuModel::from(&skylake_eax), SKYLAKE_FMS);
10588

106-
#[test]
107-
fn cpu_model_ord() {
108-
assert_eq!(SKYLAKE, SKYLAKE);
109-
assert!(SKYLAKE < CASCADE_LAKE);
110-
assert!(CASCADE_LAKE > SKYLAKE);
89+
let cascade_lake_eax = 0x00050657;
90+
assert_eq!(CpuModel::from(&cascade_lake_eax), CASCADE_LAKE_FMS);
91+
92+
let ice_lake_eax = 0x000606a6;
93+
assert_eq!(CpuModel::from(&ice_lake_eax), ICE_LAKE_FMS);
94+
95+
let milan_eax = 0x00a00f11;
96+
assert_eq!(CpuModel::from(&milan_eax), MILAN_FMS);
11197
}
11298
}

0 commit comments

Comments
 (0)