diff options
author | Prarit Bhargava <prarit@redhat.com> | 2018-09-25 08:59:26 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2019-03-20 23:11:44 -0400 |
commit | 5ea7647b333f3580697edaaf2b17a2f6d29a82f1 (patch) | |
tree | d95e968c593f15d4738f3989d1982186d2e507dc /tools | |
parent | 8173c336989c1a12290cd023969df2775b2df34d (diff) |
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 9817abd215b9..442af7892402 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
@@ -2921,8 +2921,11 @@ int snapshot_cpu_lpi_us(void) | |||
2921 | fp = fopen_or_die("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", "r"); | 2921 | fp = fopen_or_die("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", "r"); |
2922 | 2922 | ||
2923 | retval = fscanf(fp, "%lld", &cpuidle_cur_cpu_lpi_us); | 2923 | retval = fscanf(fp, "%lld", &cpuidle_cur_cpu_lpi_us); |
2924 | if (retval != 1) | 2924 | if (retval != 1) { |
2925 | err(1, "CPU LPI"); | 2925 | fprintf(stderr, "Disabling Low Power Idle CPU output\n"); |
2926 | BIC_NOT_PRESENT(BIC_CPU_LPI); | ||
2927 | return -1; | ||
2928 | } | ||
2926 | 2929 | ||
2927 | fclose(fp); | 2930 | fclose(fp); |
2928 | 2931 | ||
@@ -2944,9 +2947,11 @@ int snapshot_sys_lpi_us(void) | |||
2944 | fp = fopen_or_die("/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us", "r"); | 2947 | fp = fopen_or_die("/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us", "r"); |
2945 | 2948 | ||
2946 | retval = fscanf(fp, "%lld", &cpuidle_cur_sys_lpi_us); | 2949 | retval = fscanf(fp, "%lld", &cpuidle_cur_sys_lpi_us); |
2947 | if (retval != 1) | 2950 | if (retval != 1) { |
2948 | err(1, "SYS LPI"); | 2951 | fprintf(stderr, "Disabling Low Power Idle System output\n"); |
2949 | 2952 | BIC_NOT_PRESENT(BIC_SYS_LPI); | |
2953 | return -1; | ||
2954 | } | ||
2950 | fclose(fp); | 2955 | fclose(fp); |
2951 | 2956 | ||
2952 | return 0; | 2957 | return 0; |