cpufreqd: Use new sys:msr scheme for P-state control

Replace non-existent /dev/cpu/{n}/msr path with /scheme/sys/msr/{cpu}/{msr}
now that the kernel exposes MSR access via the sys scheme.
This commit is contained in:
2026-05-20 13:40:45 +03:00
parent 56be23ce6e
commit 7999a896d0
@@ -58,8 +58,12 @@ fn read_acpi_pss(cpu: u32) -> Vec<PState> {
}
fn write_msr(cpu: u32, msr: u32, val: u64) -> bool {
fs::OpenOptions::new().write(true).open(format!("/dev/cpu/{}/msr", cpu)).ok()
.map(|mut f| f.write_all(&val.to_ne_bytes()).is_ok()).unwrap_or(false)
let path = format!("/scheme/sys/msr/{}/{:x}", cpu, msr);
fs::OpenOptions::new().write(true).open(&path).ok()
.and_then(|mut f| {
let hex_val = format!("{:016x}", val);
f.write_all(hex_val.as_bytes()).ok()
}).is_some()
}
fn measure_load(cpu: u32, prev: &mut (u64, u64)) -> f64 {