Skip to content

Commit 1e7385c

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 f803ca6 commit 1e7385c

File tree

5 files changed

+6637
-4
lines changed

5 files changed

+6637
-4
lines changed

Cargo.lock

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

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

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

0 commit comments

Comments
 (0)