Skip to content

tools/power turbostat: Fix segfault and restart loop issues

David Arcari linux-pm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3tools/power turbostat: avoid segfault referencing fd_instr_count_percputools/power/x86/turbostat/turbostat.c+4 -12 replies
2/3tools/power turbostat: avoid an infinite loop of restartstools/power/x86/turbostat/turbostat.c+5 -54 replies
3/3tools/power turbostat: allow turbostat to work when aperf is not availabletools/power/x86/turbostat/turbostat.c+4 -07 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] tools/power turbostat: Fix segfault and restart loop issues

This patch series addresses three stability issues found in turbostat, primarily affecting virtualized environments where specific hardware counters (like APERF) or MSR access may be restricted or inconsistent.

Patch 1 fixes a segmentation fault caused by referencing a NULL fd_instr_count_percpu pointer. This occurs on systems where has_aperf is 0 (preventing allocation), but has_aperf_access is 1 (allowing the function call).

Patch 2 prevents an infinite loop when turbostat attempts to restart. It ensures the restart limit is checked in all error paths and removes logic that incorrectly reset the retry counter.

Patch 3 allows turbostat to proceed gracefully when APERF is unavailable. Previously, the missing counter caused delta_thread() to error out, triggering the restart mechanism.

David Arcari (3):
tools/power turbostat: avoid segfault referencing
fd_instr_count_percpu
tools/power turbostat: avoid an infinite loop of restarts tools/power turbostat: allow turbostat to work when aperf is not
available

 tools/power/x86/turbostat/turbostat.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
Signature · 1 line
2.51.0