sandbox-meter: RAPL reads each domain's energy-status MSR where powercap lists none; die zones are packages #629
Loading…
Reference in a new issue
No description provided.
Delete branch "sandbox-meter/rapl-msr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Some kernels ship without the powercap RAPL driver (Ubuntu without
linux-modules-extra, as on some rented bare-metal servers). On those hosts/sys/class/powercaplists no package even though the counters are there. This ports the MSR fallback from #618 (jouleclaw-energy) intosandbox-meter, with no dependency added: the standards do not depend on one another.What changes
rapl-msr.die_id), because Intel's RAPL MSRs are die-scope on multi-die parts. On AMD and Hygon, whose package energy counter is per package, a domain is the package. Each domain is read through the first of its CPUs whose MSRs read.sandbox-exec-microvm'sMsrRaplMeter).package-<p>-die-<d>(the kernel's name for each die's zone of a multi-die Intel package) is a package domain, and every die zone is summed. The rule accepts nothing looser.CAP_SYS_RAWIO, the message names/dev/cpu/0/msr, "Permission denied", and what reading an MSR needs.joule-meterprints which RAPL interface it reads, or why it declined.RaplPackagesgainslive_at(a fake host's powercap tree plus filesystem root) andsource().live_instays powercap-only.tests/rapl_msr_hardware.rs, andtests/rapl_hardware.rs's oracle now accepts die zones.Verified
cargo test -p sandbox-meterpasses, includingrapl_hardware4/4 andrapl_msr_hardware2/2; the MSR path is correctly not used there.cargo check --workspace --all-targetsis clean, andsandbox-exec-microvmandsandbox-teepass. Clippy is clean apart from 3 type-complexity lints that are already onmain, in untouchedtests/nvml_hardware.rs.cargo test -p sandbox-meterpasses, with both greps (ioreport liveness:,tree meter:). Clippy onsandbox-meterandsandbox-proofis clean.package-0-die-0Live, 12/12 intervals. A 300 ms burn read 8.85 J, inside the oracle's bracket.joule-meterreads 2.04 W idle and 122.25 W on all cores.joule-meterreads 26.75 W idle and 207.09 W on all cores.Not in this PR
sandbox-tee's example (examples/attested_efficiency.rs) maps onlyrapl-powercap, so on an MSR host it attestsEstimator. That fails safe.sandbox-proof(src/lib.rs) reads/sys/class/powercapitself and has no MSR path.🤖 Generated with Claude Code