Skip to contentSkip to conversation

lib/librte_power: set new frequecy on turbo_disable

PATCH In review Lee Daly 6 participants 6 messages Apr 12, 2019 – Apr 22, 2019

lore
Share & tools
lore

Lee Daly

author
#0 lore raw

PATCH 1/1 lib/librte_power: set new frequecy on turbo_disable

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")
---
 lib/librte_power/power_pstate_cpufreq.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
lib/librte_power/power_pstate_cpufreq.c +9 -1
index 336c13869..d2ac75123 100644
@@ -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;
 }
 
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 24 lines · Lee Daly

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")
---
  lib/librte_power/power_pstate_cpufreq.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)
lib/librte_power/power_pstate_cpufreq.c +2 -1
index 336c13869..d2ac75123 100644
@@ -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 */

lib/librte_power/power_pstate_cpufreq.c power_pstate_disable_turbo(unsigned int lcore_id) · line 824

Quoted 10 lines
lib/librte_power/power_pstate_cpufreq.c +7 -0
+		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 lore raw

15/04/2019 11:21, Hunt, David:

Quoted 9 lines · Lee Daly
Quoted 8 lines

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")
Quoted 16 lines
Quoted 4 lines

---

lib/librte_power/power_pstate_cpufreq.c +1 -1
-
+	if ((pi->turbo_available) && (pi->curr_idx <= 1)) {

lib/librte_power/power_pstate_cpufreq.c power_pstate_disable_turbo(unsigned int lcore_id) · line 823

Quoted 10 lines
lib/librte_power/power_pstate_cpufreq.c +8 -0
+		/* 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;
  }

Applied without extra parentheses and with blank line restored.

Acked-by on v1 1/1
#3 lore raw
In reply to Lee Daly
Quoted 37 lines · Lee Daly

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")
---
 lib/librte_power/power_pstate_cpufreq.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
lib/librte_power/power_pstate_cpufreq.c +9 -1
index 336c13869..d2ac75123 100644
@@ -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;
 }
 
Signature · 1 line
2.17.1
#4 lore raw
Quoted 4 lines · Ma

lib/librte_power/power_pstate_cpufreq.c power_pstate_disable_turbo(unsigned int lcore_id) · line 813

Quoted 4 lines
lib/librte_power/power_pstate_cpufreq.c +1 -1
 	pi->turbo_enable = 0;
 
-
+	if ((pi->turbo_available) && (pi->curr_idx <= 1)) {

You (don't) need (so many) parenthesis.

#5 lore raw
Quoted 9 lines · Stephen Hemminger
Quoted 4 lines · Ma

lib/librte_power/power_pstate_cpufreq.c power_pstate_disable_turbo(unsigned int lcore_id) · line 813

Quoted 4 lines
lib/librte_power/power_pstate_cpufreq.c +1 -1
 	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)) :-)