Skip to content

Commit ed96e07

Browse files
arch: Include Skylake and Sapphire rapids CPU profiles
We include CPU profiles corresponding to Intel Skylake and Sapphire rapids server that we generated using our WIP CPU profile generation tool. Signed-of-by: Oliver Anderson <[email protected]> On-behalf-of: SAP [email protected]
1 parent b8ad4da commit ed96e07

File tree

4 files changed

+6636
-4
lines changed

4 files changed

+6636
-4
lines changed

arch/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ libc = { workspace = true }
1919
linux-loader = { workspace = true, features = ["bzimage", "elf", "pe"] }
2020
log = { workspace = true }
2121
serde = { workspace = true, features = ["derive", "rc"] }
22+
# We currently use this for (de-)serializing CPU profile data
23+
serde_json = { workspace = true }
2224
thiserror = { workspace = true }
2325
uuid = { workspace = true }
2426
vm-memory = { workspace = true, features = ["backend-bitmap", "backend-mmap"] }

arch/src/x86_64/cpu_profile.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,26 @@ impl CpuProfile {
3535
pub(in crate::x86_64) fn data(&self, amx: bool) -> Option<CpuProfileData> {
3636
let mut data: CpuProfileData = match self {
3737
Self::Host => None,
38-
Self::Skylake => todo!(),
39-
Self::SapphireRapids => todo!(),
38+
Self::Skylake => Some(
39+
serde_json::from_slice(include_bytes!("cpu_profiles/skylake.json"))
40+
.inspect_err(|e| {
41+
error!("BUG: could not deserialize CPU profile. Got error: {:?}", e)
42+
})
43+
.expect("should be able to deserialize pre-generated data"),
44+
),
45+
Self::SapphireRapids => Some(
46+
serde_json::from_slice(include_bytes!("cpu_profiles/sapphire-rapids.json"))
47+
.inspect_err(|e| {
48+
error!("BUG: could not deserialize CPU profile. Got error: {:?}", e)
49+
})
50+
.expect("should be able to deserialize pre-generated data"),
51+
),
4052
}?;
4153

4254
if !amx {
4355
// In this case we will need to wipe out the AMX tile state components (if they are included in the profile)
4456
for adj in data.adjustments.iter_mut() {
4557
if adj.0.sub_leaf.start() != adj.0.sub_leaf.end() {
46-
// The generated profiles produce as many sub-leaf entries as possible, and only use ranges for
47-
// values not found.
4858
continue;
4959
}
5060
let sub_leaf = *adj.0.sub_leaf.start();

0 commit comments

Comments
 (0)