Skip to content

sysfs: tolerate EFBIG when reading cpufreq stats/trans_table#852

Open
kevinpark1217 wants to merge 1 commit into
prometheus:masterfrom
kevinpark1217:cpufreq-trans-table-efbig
Open

sysfs: tolerate EFBIG when reading cpufreq stats/trans_table#852
kevinpark1217 wants to merge 1 commit into
prometheus:masterfrom
kevinpark1217:cpufreq-trans-table-efbig

Conversation

@kevinpark1217

@kevinpark1217 kevinpark1217 commented Jul 23, 2026

Copy link
Copy Markdown

The kernel disables the export of stats/trans_table when the rendered table exceeds PAGE_SIZE, and reads then fail with EFBIG (drivers/cpufreq/cpufreq_stats.c, show_trans_table). This is the normal state on CPUs with many frequency states, e.g. NVIDIA Jetson/Tegra. SystemCpufreq() tolerates only ENOENT/EPERM at this read, so it fails wholesale on such hardware — downstream, node_exporter's cpufreq collector fails on every scrape (collector failed … trans_table: file too large) and all cpufreq metrics for the node are lost. Same root cause as grafana/alloy#6132.

Fix: treat EFBIG like an absent file, matching the existing ENOENT/EPERM tolerance for this optional stats file.

Verified on a Jetson Orin Nano: SystemCpufreq() fails with file too large before this change and returns all 6 policy entries after. go test ./sysfs/ passes. No new unit test: EFBIG is a kernel-runtime error that can't be represented by the fixture files — this takes the same branch as the existing ENOENT/EPERM handling.

cc @SuperQ

The kernel refuses to export stats/trans_table when the table exceeds
PAGE_SIZE ("cpufreq transition table exceeds PAGE_SIZE. Disabling",
drivers/cpufreq/cpufreq_stats.c) and reads then fail with EFBIG. This
is common on CPUs with many frequency states, e.g. NVIDIA Jetson
(Tegra): SystemCpufreq() fails wholesale, which surfaces in
node_exporter as the cpufreq collector failing on every scrape and
losing all cpufreq metrics for the node.

Treat EFBIG like an absent file, matching the existing ENOENT/EPERM
tolerance for this optional stats file.

Verified on a Jetson Orin Nano: SystemCpufreq() fails with "file too
large" before this change and returns all 6 policy entries after.

Signed-off-by: Kevin Park <kevin.park1217@gmail.com>
@kevinpark1217
kevinpark1217 force-pushed the cpufreq-trans-table-efbig branch from b69b0c7 to a29d281 Compare July 23, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant