Skip to content

Commit 09b1c0e

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 <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
1 parent 6d1e9e3 commit 09b1c0e

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
@@ -30,16 +30,26 @@ impl CpuProfile {
3030
pub(in crate::x86_64) fn data(&self, amx: bool) -> Option<CpuProfileData> {
3131
let mut data: CpuProfileData = match self {
3232
Self::Host => None,
33-
Self::Skylake => todo!(),
34-
Self::SapphireRapids => todo!(),
33+
Self::Skylake => Some(
34+
serde_json::from_slice(include_bytes!("cpu_profiles/skylake.json"))
35+
.inspect_err(|e| {
36+
error!("BUG: could not deserialize CPU profile. Got error: {:?}", e)
37+
})
38+
.expect("should be able to deserialize pre-generated data"),
39+
),
40+
Self::SapphireRapids => Some(
41+
serde_json::from_slice(include_bytes!("cpu_profiles/sapphire-rapids.json"))
42+
.inspect_err(|e| {
43+
error!("BUG: could not deserialize CPU profile. Got error: {:?}", e)
44+
})
45+
.expect("should be able to deserialize pre-generated data"),
46+
),
3547
}?;
3648

3749
if !amx {
3850
// In this case we will need to wipe out the AMX tile state components (if they are included in the profile)
3951
for adj in data.adjustments.iter_mut() {
4052
if adj.0.sub_leaf.start() != adj.0.sub_leaf.end() {
41-
// The generated profiles produce as many sub-leaf entries as possible, and only use ranges for
42-
// values not found.
4353
continue;
4454
}
4555
let sub_leaf = *adj.0.sub_leaf.start();

0 commit comments

Comments
 (0)