ACK: [PATCH] cpufreq: skip frequency claimed maximum test with intel_pstate
Colin Ian King
colin.king at canonical.com
Fri Apr 15 08:28:01 UTC 2016
On 15/04/16 08:25, Alex Hung wrote:
> On SandyBridge+, intel_pstate is used and it will not provide
> scaling_available_frequencies[1]. As a result, comparison fails
> with following errors:
>
> "cpu 0 has claimed frequency of 3200000, higher than max freq of 0".
>
> [1] https://bugzilla.kernel.org/show_bug.cgi?id=57141
>
> Signed-off-by: Alex Hung <alex.hung at canonical.com>
> ---
> src/cpu/cpufreq/cpufreq.c | 27 ++++++++++++++++-----------
> 1 file changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
> index a1cb78a..8ab5292 100644
> --- a/src/cpu/cpufreq/cpufreq.c
> +++ b/src/cpu/cpufreq/cpufreq.c
> @@ -712,6 +712,9 @@ static int cpufreq_test_claimed_max(fwts_framework *fw)
> if (!max)
> continue;
>
> + if (!cpu->n_freqs)
> + continue;
> +
> present = true;
>
> if (max > cpu->freqs[cpu->n_freqs-1].Hz) {
> @@ -778,21 +781,23 @@ static int parse_cpu_info(fwts_framework *fw,
> cpu_mkpath(path, sizeof(path), cpu, "scaling_available_frequencies");
> str = fwts_get(path);
>
> - for (tmp = str, i = 0; ; tmp = NULL) {
> - char *tok = strtok(tmp, " ");
> - if (!tok)
> - break;
> - if (!isdigit(tok[0]))
> - continue;
> - cpu->freqs[i++].Hz = strtoull(tok, NULL, 10);
> + /* cpu driver like intel_pstate has no scaling_available_frequencies */
> + if (str != NULL) {
> + for (tmp = str, i = 0; ; tmp = NULL) {
> + char *tok = strtok(tmp, " ");
> + if (!tok)
> + break;
> + if (!isdigit(tok[0]))
> + continue;
> + cpu->freqs[i++].Hz = strtoull(tok, NULL, 10);
> + }
> + cpu->n_freqs = i;
> + qsort(cpu->freqs, cpu->n_freqs, sizeof(cpu->freqs[0]),
> + cpu_freq_compare);
> }
>
> free(str);
>
> - cpu->n_freqs = i;
> - qsort(cpu->freqs, cpu->n_freqs, sizeof(cpu->freqs[0]),
> - cpu_freq_compare);
> -
> return FWTS_OK;
> }
>
>
Acked-by: Colin Ian King <colin.king at canonical.com>
More information about the fwts-devel
mailing list