diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2021-02-16 11:52:16 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2021-02-16 11:52:16 -0300 |
commit | c1bd8a2b9fbc304995fb03356f878579e50d3dd8 (patch) | |
tree | c5599739225f20c52f56c189bed786d68de64368 /tools/power/x86/turbostat/turbostat.c | |
parent | a89dbc9b988f3ba8700df3c58614744de0c5043f (diff) | |
parent | 105f75ebf9519c239c96f9b16e16520f45fea72b (diff) |
Merge branch 'perf/urgent' into perf/core
To get some fixes that didn't made into 5.11.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/power/x86/turbostat/turbostat.c')
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 389ea5209a83..a7c4f0772e53 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -1834,12 +1834,15 @@ int get_mp(int cpu, struct msr_counter *mp, unsigned long long *counterp) int get_epb(int cpu) { char path[128 + PATH_BYTES]; + unsigned long long msr; int ret, epb = -1; FILE *fp; sprintf(path, "/sys/devices/system/cpu/cpu%d/power/energy_perf_bias", cpu); - fp = fopen_or_die(path, "r"); + fp = fopen(path, "r"); + if (!fp) + goto msr_fallback; ret = fscanf(fp, "%d", &epb); if (ret != 1) @@ -1848,6 +1851,11 @@ int get_epb(int cpu) fclose(fp); return epb; + +msr_fallback: + get_msr(cpu, MSR_IA32_ENERGY_PERF_BIAS, &msr); + + return msr & 0xf; } void get_apic_id(struct thread_data *t) |