lib/librte_power: set new frequecy on turbo_disable

Message ID 1555084647-75896-1-git-send-email-lee.daly@intel.com
State Accepted, archived
Headers show
Series
  • lib/librte_power: set new frequecy on turbo_disable
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Daly, Lee April 12, 2019, 3:57 p.m.
This patch will ensure the correct max frequency of a core is set in
the lcore_power_info struct when disabling turbo, while using the
intel pstate driver.

Fixes: e6c6dc0f96c8 ("power: add p-state driver compatibility")
Cc: liang.j.ma@intel.com
Cc: stable@dpdk.org

Signed-off-by: Lee Daly <lee.daly@intel.com>
---
 lib/librte_power/power_pstate_cpufreq.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Hunt, David April 15, 2019, 9:21 a.m. | #1
On 12/4/2019 4:57 PM, Lee Daly wrote:
> This patch will ensure the correct max frequency of a core is set in
> the lcore_power_info struct when disabling turbo, while using the
> intel pstate driver.
>
> Fixes: e6c6dc0f96c8 ("power: add p-state driver compatibility")
> Cc: liang.j.ma@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Lee Daly <lee.daly@intel.com>
> ---
>   lib/librte_power/power_pstate_cpufreq.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_power/power_pstate_cpufreq.c b/lib/librte_power/power_pstate_cpufreq.c
> index 336c13869..d2ac75123 100644
> --- a/lib/librte_power/power_pstate_cpufreq.c
> +++ b/lib/librte_power/power_pstate_cpufreq.c
> @@ -810,7 +810,15 @@ power_pstate_disable_turbo(unsigned int lcore_id)
>   
>   	pi->turbo_enable = 0;
>   
> -
> +	if ((pi->turbo_available) && (pi->curr_idx <= 1)) {
> +		/* Try to set freq to max by default coming out of turbo */
> +		if (power_pstate_cpufreq_freq_max(lcore_id) < 0) {
> +			RTE_LOG(ERR, POWER,
> +				"Failed to set frequency of lcore %u to max\n",
> +				lcore_id);
> +			return -1;
> +		}
> +	}
>   	return 0;
>   }
>   


Acked-by: David Hunt <david.hunt@intel.com>
Liang, Ma April 15, 2019, 4:11 p.m. | #2
Acked-by: Liang Ma <liang.j.ma@intel.com>

On 12 Apr 16:57, Lee Daly wrote:
> This patch will ensure the correct max frequency of a core is set in
> the lcore_power_info struct when disabling turbo, while using the
> intel pstate driver.
> 
> Fixes: e6c6dc0f96c8 ("power: add p-state driver compatibility")
> Cc: liang.j.ma@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Lee Daly <lee.daly@intel.com>
> ---
>  lib/librte_power/power_pstate_cpufreq.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_power/power_pstate_cpufreq.c b/lib/librte_power/power_pstate_cpufreq.c
> index 336c13869..d2ac75123 100644
> --- a/lib/librte_power/power_pstate_cpufreq.c
> +++ b/lib/librte_power/power_pstate_cpufreq.c
> @@ -810,7 +810,15 @@ power_pstate_disable_turbo(unsigned int lcore_id)
>  
>  	pi->turbo_enable = 0;
>  
> -
> +	if ((pi->turbo_available) && (pi->curr_idx <= 1)) {
> +		/* Try to set freq to max by default coming out of turbo */
> +		if (power_pstate_cpufreq_freq_max(lcore_id) < 0) {
> +			RTE_LOG(ERR, POWER,
> +				"Failed to set frequency of lcore %u to max\n",
> +				lcore_id);
> +			return -1;
> +		}
> +	}
>  	return 0;
>  }
>  
> -- 
> 2.17.1
>
Stephen Hemminger April 15, 2019, 4:36 p.m. | #3
On Mon, 15 Apr 2019 17:11:10 +0100
"Liang, Ma" <liang.j.ma@intel.com> wrote:

> >  	pi->turbo_enable = 0;
> >  
> > -
> > +	if ((pi->turbo_available) && (pi->curr_idx <= 1)) {

You (don't) need (so many) parenthesis.
Bruce Richardson April 16, 2019, 9:25 a.m. | #4
On Mon, Apr 15, 2019 at 09:36:40AM -0700, Stephen Hemminger wrote:
> On Mon, 15 Apr 2019 17:11:10 +0100
> "Liang, Ma" <liang.j.ma@intel.com> wrote:
> 
> > >  	pi->turbo_enable = 0;
> > >  
> > > -
> > > +	if ((pi->turbo_available) && (pi->curr_idx <= 1)) {
> 
> You (don't) need (so many) parenthesis.

True (but it doesn't hurt (either)) :-)
Thomas Monjalon April 22, 2019, 10:12 p.m. | #5
15/04/2019 11:21, Hunt, David:
> On 12/4/2019 4:57 PM, Lee Daly wrote:
> > This patch will ensure the correct max frequency of a core is set in
> > the lcore_power_info struct when disabling turbo, while using the
> > intel pstate driver.
> >
> > Fixes: e6c6dc0f96c8 ("power: add p-state driver compatibility")
> > Cc: liang.j.ma@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Lee Daly <lee.daly@intel.com>
> > ---
> > -
> > +	if ((pi->turbo_available) && (pi->curr_idx <= 1)) {
> > +		/* Try to set freq to max by default coming out of turbo */
> > +		if (power_pstate_cpufreq_freq_max(lcore_id) < 0) {
> > +			RTE_LOG(ERR, POWER,
> > +				"Failed to set frequency of lcore %u to max\n",
> > +				lcore_id);
> > +			return -1;
> > +		}
> > +	}
> >   	return 0;
> >   }
> 
> Acked-by: David Hunt <david.hunt@intel.com>

Applied without extra parentheses and with blank line restored.

Patch

diff --git a/lib/librte_power/power_pstate_cpufreq.c b/lib/librte_power/power_pstate_cpufreq.c
index 336c13869..d2ac75123 100644
--- a/lib/librte_power/power_pstate_cpufreq.c
+++ b/lib/librte_power/power_pstate_cpufreq.c
@@ -810,7 +810,15 @@  power_pstate_disable_turbo(unsigned int lcore_id)
 
 	pi->turbo_enable = 0;
 
-
+	if ((pi->turbo_available) && (pi->curr_idx <= 1)) {
+		/* Try to set freq to max by default coming out of turbo */
+		if (power_pstate_cpufreq_freq_max(lcore_id) < 0) {
+			RTE_LOG(ERR, POWER,
+				"Failed to set frequency of lcore %u to max\n",
+				lcore_id);
+			return -1;
+		}
+	}
 	return 0;
 }