Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Prarit Bhargava and committed by
Len Brown
5ea7647b 8173c336

+10 -5
+10 -5
tools/power/x86/turbostat/turbostat.c
··· 2921 2921 fp = fopen_or_die("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", "r"); 2922 2922 2923 2923 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 + } 2926 2929 2927 2930 fclose(fp); 2928 2931 ··· 2947 2944 fp = fopen_or_die("/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us", "r"); 2948 2945 2949 2946 retval = fscanf(fp, "%lld", &cpuidle_cur_sys_lpi_us); 2950 - if (retval != 1) 2951 - err(1, "SYS LPI"); 2952 - 2947 + if (retval != 1) { 2948 + fprintf(stderr, "Disabling Low Power Idle System output\n"); 2949 + BIC_NOT_PRESENT(BIC_SYS_LPI); 2950 + return -1; 2951 + } 2953 2952 fclose(fp); 2954 2953 2955 2954 return 0;