Skip to content

Commit 5ea7647

Browse files
praritlenb
authored andcommitted
tools/power turbostat: Warn on bad ACPI LPIT data
On some systems /sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us or /sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us return a file error because of bad ACPI LPIT data from a misconfigured BIOS. turbostat interprets this failure as a fatal error and outputs turbostat: CPU LPI: No data available If the ACPI LPIT sysfs files return an error output a warning instead of a fatal error, disable the ACPI LPIT evaluation code, and continue. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 8173c33 commit 5ea7647

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

‎tools/power/x86/turbostat/turbostat.c‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2921,8 +2921,11 @@ int snapshot_cpu_lpi_us(void)
29212921
fp = fopen_or_die("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", "r");
29222922

29232923
retval = fscanf(fp, "%lld", &cpuidle_cur_cpu_lpi_us);
2924-
if (retval != 1)
2925-
err(1, "CPU LPI");
2924+
if (retval != 1) {
2925+
fprintf(stderr, "Disabling Low Power Idle CPU output\n");
2926+
BIC_NOT_PRESENT(BIC_CPU_LPI);
2927+
return -1;
2928+
}
29262929

29272930
fclose(fp);
29282931

@@ -2944,9 +2947,11 @@ int snapshot_sys_lpi_us(void)
29442947
fp = fopen_or_die("/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us", "r");
29452948

29462949
retval = fscanf(fp, "%lld", &cpuidle_cur_sys_lpi_us);
2947-
if (retval != 1)
2948-
err(1, "SYS LPI");
2949-
2950+
if (retval != 1) {
2951+
fprintf(stderr, "Disabling Low Power Idle System output\n");
2952+
BIC_NOT_PRESENT(BIC_SYS_LPI);
2953+
return -1;
2954+
}
29502955
fclose(fp);
29512956

29522957
return 0;

0 commit comments

Comments
 (0)