hal/temperature: correct sysfs-hwmon temperature fallback for Arc Pro… - #149
Open
thevisad wants to merge 1 commit into
Open
hal/temperature: correct sysfs-hwmon temperature fallback for Arc Pro…#149thevisad wants to merge 1 commit into
thevisad wants to merge 1 commit into
Conversation
thevisad
requested review from
AshwinKumarKulkarni,
aravindksg,
saik-intel and
savery42
as code owners
August 2, 2026 13:13
Contributor
|
Related to #146 |
…ysfs hwmon fallback On the Arc Pro B70 (Battlemage, xe) Level Zero sysman enumerates no GPU/Memory temperature sensor, so xpu-smi reports temperature as N/A even though the values are published on the world-readable PCI hwmon node (labels pkg/vram). Add a validated sysfs fallback. - getCoreTemp/getMemoryTemp route through a pure decideTempSource helper: use Level Zero on success; fall back to the hwmon node when Level Zero reports the sensor unsupported or denies access to an unprivileged process; propagate any other result so device-loss and runtime errors are never masked by a stale value. - getTempPerTile falls back only when no matching-type sensor was enumerated, not merely when the tile map is empty. - Discovery scans all hwmon* nodes and selects by tempN_label, caching the exact tempN_input path; strict temp<N>_label matching; every read validated against physical bounds through one shared path. - Pure logic lives in an internal xpum::hwmon utility, off the exported class. - doctest coverage for the decision matrix, parsing, bounds and discovery; portable std::filesystem, no POSIX-only headers. The Level Zero path is unchanged when a sensor is present. Validated on Arc Pro B70 (xe, kernel 7.0.0-28-generic, Level Zero 1.27.0): xpu-smi stats reports core and memory temperature matching the raw hwmon values. Signed-off-by: thevisad <373694+thevisad@users.noreply.github.com>
thevisad
force-pushed
the
xpum-temp-hwmon
branch
from
August 3, 2026 11:21
cf3f931 to
4d8a702
Compare
20 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
xpu-smireports GPU Core and Memory Temperature asN/Aon the Intel Arc Pro B70 (Battlemage,xedriver): Level Zero sysman enumerates no GPU/Memory temperature sensor on this device, even though the
readings are published on the PCI device's hwmon node (labels
pkg/vram). This PR adds a correct,validated sysfs-hwmon fallback so temperature is reported on such devices, while leaving behaviour
byte-identical where Level Zero already provides a sensor.
What it does
getCoreTemp/getMemoryTempfall back to sysfs only when Level Zero reports the sensor typeunsupported (no matching sensor was enumerated); any other Level Zero result is propagated, so
device-loss / permission / state errors are never masked. The routing decision is a pure, unit-tested
helper (
decideTempSource).getTempPerTileuses the fallback only when no matching-type sensor was enumerated, not merely when thetile map is empty (
perTileShouldFallback).resolveSysfsHwmonscans allhwmon*subdirs and caches the exacttempN_inputpath per label;strict
temp<N>_labelfilename matching; every stream open is verified.milli→Celsius → physical-validity bounds). The lowerbound is absolute zero, not a device-specific
0 Cfloor, so a legitimate subzero reading on anothermatching system is not wrongly rejected.
xpum::hwmonutility (hwmon_temperature_utils.{h,cpp}) shared bytemperature.cppand the tests, without expanding the exportedtemperatureclass / DLL surface.Testing
SUCCESS→L0 /UNSUPPORTED→sysfs /DEVICE_LOST,PERMISSIONS,UNKNOWN→propagate; strict filename parse; value bounds; multi-hwmondiscovery incl. labelled node not first; two roots don't cross-resolve). Full
meson test: 9/9 suites.xe, kernel7.0.0-28-generic, Level Zero1.27.0):xpu-smi statsreportsCore 51 / Mem 52, matching raw sysfs
pkg=51000/vram=52000; VR staysN/A.Scope / limitations
xe. The fallback is condition-based, notPCI-ID-gated: it activates when Level Zero exposes no matching sensor and the hwmon node provides the
expected label. Not generalized to multiple tiles/subdevices; VR temperature is not in sysfs and stays
N/A.std::filesystem).Windows was not build-tested. The doctest test targets require a
doctestpackage in CI.Fixes:
Relates-To:
Type of change
Affected components
hal— Hardware Abstraction Layerial— Interface / Application Layeroal— OS Abstraction Layerxpumd— XPU Manager Daemoncli/smici/ build systemChecklist
Signed-off-by(DCO)