[v1,2/4] test/power: add turbo mode to freq check function
Checks
Commit Message
With the intel_pstate driver and turbo enabled, the top frequency in
the frequency array is the P1+1, i.e. 2300001, whereas the frequency
shown in scaling_cur_freq could be a lot higher.
This patch adds a flag to the check_cur_freq function so that we can
specify if a frequency is greater than expected (turbo mode), in which
case the check should be successful.
Fixes: aeaeaf5f2d62 ("test/power: add cases for turbo feature")
Cc: stable@dpdk.org
Signed-off-by: David Hunt <david.hunt@intel.com>
---
app/test/test_power_cpufreq.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
Comments
On 22-Apr-21 3:40 PM, David Hunt wrote:
> With the intel_pstate driver and turbo enabled, the top frequency in
> the frequency array is the P1+1, i.e. 2300001, whereas the frequency
> shown in scaling_cur_freq could be a lot higher.
>
> This patch adds a flag to the check_cur_freq function so that we can
> specify if a frequency is greater than expected (turbo mode), in which
> case the check should be successful.
>
> Fixes: aeaeaf5f2d62 ("test/power: add cases for turbo feature")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> ---
> app/test/test_power_cpufreq.c | 27 +++++++++++++++------------
> 1 file changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/app/test/test_power_cpufreq.c b/app/test/test_power_cpufreq.c
> index 52f58ef8b2..33a68cf645 100644
> --- a/app/test/test_power_cpufreq.c
> +++ b/app/test/test_power_cpufreq.c
> @@ -48,7 +48,7 @@ static uint32_t total_freq_num;
> static uint32_t freqs[TEST_POWER_FREQS_NUM_MAX];
>
> static int
> -check_cur_freq(unsigned lcore_id, uint32_t idx)
> +check_cur_freq(unsigned int lcore_id, uint32_t idx, int turbo)
Nitpicking, but stdbool exists :) it would be nice to use bool type for
bool variables, not int.
22/04/2021 18:13, Burakov, Anatoly:
> On 22-Apr-21 3:40 PM, David Hunt wrote:
> > --- a/app/test/test_power_cpufreq.c
> > +++ b/app/test/test_power_cpufreq.c
> > @@ -48,7 +48,7 @@ static uint32_t total_freq_num;
> > static uint32_t freqs[TEST_POWER_FREQS_NUM_MAX];
> >
> > static int
> > -check_cur_freq(unsigned lcore_id, uint32_t idx)
> > +check_cur_freq(unsigned int lcore_id, uint32_t idx, int turbo)
>
> Nitpicking, but stdbool exists :) it would be nice to use bool type for
> bool variables, not int.
Dave, I think you missed this comment.
On 12/5/2021 4:34 PM, Thomas Monjalon wrote:
> 22/04/2021 18:13, Burakov, Anatoly:
>> On 22-Apr-21 3:40 PM, David Hunt wrote:
>>> --- a/app/test/test_power_cpufreq.c
>>> +++ b/app/test/test_power_cpufreq.c
>>> @@ -48,7 +48,7 @@ static uint32_t total_freq_num;
>>> static uint32_t freqs[TEST_POWER_FREQS_NUM_MAX];
>>>
>>> static int
>>> -check_cur_freq(unsigned lcore_id, uint32_t idx)
>>> +check_cur_freq(unsigned int lcore_id, uint32_t idx, int turbo)
>> Nitpicking, but stdbool exists :) it would be nice to use bool type for
>> bool variables, not int.
> Dave, I think you missed this comment.
>
Thanks for the reminder Thomas, I've just pushed a new version replacing
the int with a bool.
Regards,
Dave.
@@ -48,7 +48,7 @@ static uint32_t total_freq_num;
static uint32_t freqs[TEST_POWER_FREQS_NUM_MAX];
static int
-check_cur_freq(unsigned lcore_id, uint32_t idx)
+check_cur_freq(unsigned int lcore_id, uint32_t idx, int turbo)
{
#define TEST_POWER_CONVERT_TO_DECIMAL 10
#define MAX_LOOP 100
@@ -90,7 +90,10 @@ check_cur_freq(unsigned lcore_id, uint32_t idx)
/ TEST_ROUND_FREQ_TO_N_100000;
freq_conv = freq_conv * TEST_ROUND_FREQ_TO_N_100000;
- ret = (freqs[idx] == freq_conv ? 0 : -1);
+ if (turbo)
+ ret = (freqs[idx] <= freq_conv ? 0 : -1);
+ else
+ ret = (freqs[idx] == freq_conv ? 0 : -1);
if (ret == 0)
break;
@@ -183,7 +186,7 @@ check_power_get_freq(void)
}
/* Check the current frequency */
- ret = check_cur_freq(TEST_POWER_LCORE_ID, count);
+ ret = check_cur_freq(TEST_POWER_LCORE_ID, count, 0);
if (ret < 0)
return -1;
@@ -233,7 +236,7 @@ check_power_set_freq(void)
}
/* Check the current frequency */
- ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1);
+ ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1, 0);
if (ret < 0)
return -1;
@@ -269,7 +272,7 @@ check_power_freq_down(void)
}
/* Check the current frequency */
- ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1);
+ ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1, 0);
if (ret < 0)
return -1;
@@ -288,7 +291,7 @@ check_power_freq_down(void)
}
/* Check the current frequency */
- ret = check_cur_freq(TEST_POWER_LCORE_ID, 1);
+ ret = check_cur_freq(TEST_POWER_LCORE_ID, 1, 0);
if (ret < 0)
return -1;
@@ -324,7 +327,7 @@ check_power_freq_up(void)
}
/* Check the current frequency */
- ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 2);
+ ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 2, 0);
if (ret < 0)
return -1;
@@ -343,7 +346,7 @@ check_power_freq_up(void)
}
/* Check the current frequency */
- ret = check_cur_freq(TEST_POWER_LCORE_ID, 0);
+ ret = check_cur_freq(TEST_POWER_LCORE_ID, 0, 1);
if (ret < 0)
return -1;
@@ -371,7 +374,7 @@ check_power_freq_max(void)
}
/* Check the current frequency */
- ret = check_cur_freq(TEST_POWER_LCORE_ID, 0);
+ ret = check_cur_freq(TEST_POWER_LCORE_ID, 0, 1);
if (ret < 0)
return -1;
@@ -399,7 +402,7 @@ check_power_freq_min(void)
}
/* Check the current frequency */
- ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1);
+ ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1, 0);
if (ret < 0)
return -1;
@@ -433,7 +436,7 @@ check_power_turbo(void)
}
/* Check the current frequency */
- ret = check_cur_freq(TEST_POWER_LCORE_ID, 0);
+ ret = check_cur_freq(TEST_POWER_LCORE_ID, 0, 1);
if (ret < 0)
return -1;
@@ -452,7 +455,7 @@ check_power_turbo(void)
}
/* Check the current frequency */
- ret = check_cur_freq(TEST_POWER_LCORE_ID, 1);
+ ret = check_cur_freq(TEST_POWER_LCORE_ID, 1, 0);
if (ret < 0)
return -1;