Skip to contentSkip to conversation

cpuidle/powernv: Enter fastsleep on checking if deep idle states are allowed

PATCH In review Preeti U Murthy 3 participants 5 messages Sep 12, 2014 – Jan 30, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpuidle/powernv: Enter fastsleep on checking if deep idle states are allowed

Today the procfs interface /proc/sys/kernel/powersave-nap is used to control entry into deep idle states beyond snooze. Check for the value of this parameter before entering fastsleep. We already do this check for nap in power7_idle().

---

 drivers/cpuidle/cpuidle-powernv.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/cpuidle/cpuidle-powernv.c +6 -0
index a64be57..b8ba52e 100644
@@ -69,6 +69,12 @@ static int fastsleep_loop(struct cpuidle_device *dev,
 	unsigned long old_lpcr = mfspr(SPRN_LPCR);
 	unsigned long new_lpcr;
 
+	/*
+	 * Verify if snooze is the only valid cpuidle state
+	 */
+	if (!(powersave_nap > 0))
+		return index;
+
 	if (unlikely(system_state < SYSTEM_RUNNING))
 		return index;
 
#1 lore raw
Quoted 17 lines · Preeti U Murthy

Today the procfs interface /proc/sys/kernel/powersave-nap is used to control entry into deep idle states beyond snooze. Check for the value of this parameter before entering fastsleep. We already do this check for nap in power7_idle().

---

 drivers/cpuidle/cpuidle-powernv.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/cpuidle/cpuidle-powernv.c +0 -0
index a64be57..b8ba52e 100644
@@ -69,6 +69,12 @@ static int fastsleep_loop(struct cpuidle_device *dev,
 	unsigned long old_lpcr = mfspr(SPRN_LPCR);

drivers/cpuidle/cpuidle-powernv.c static int fastsleep_loop(struct cpuidle_device *dev, · line 79

Quoted 10 lines
drivers/cpuidle/cpuidle-powernv.c +6 -0
 	unsigned long new_lpcr;
 
+	/*
+	 * Verify if snooze is the only valid cpuidle state
+	 */
+	if (!(powersave_nap > 0))
+		return index;
+
 	if (unlikely(system_state < SYSTEM_RUNNING))
 		return index;

Doesn't the above mean we are just going to keep trying to go into fastsleep again and again? Or does the idle code work out that it didn't work based on the fact that we didn't sleep for the right period?

We were talking about getting rid of powersave_nap altogether, but I think we decided we couldn't, I forget.

cheers

#2 lore raw
Quoted 20 lines · Michael Ellerman
Quoted 19 lines · Preeti U Murthy

Today the procfs interface /proc/sys/kernel/powersave-nap is used to control entry into deep idle states beyond snooze. Check for the value of this parameter before entering fastsleep. We already do this check for nap in power7_idle().

---

 drivers/cpuidle/cpuidle-powernv.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/cpuidle/cpuidle-powernv.c +0 -0
index a64be57..b8ba52e 100644
@@ -69,6 +69,12 @@ static int fastsleep_loop(struct cpuidle_device *dev,
 	unsigned long old_lpcr = mfspr(SPRN_LPCR);
 	unsigned long new_lpcr;
 
Quoted 12 lines

drivers/cpuidle/cpuidle-powernv.c static int fastsleep_loop(struct cpuidle_device *dev, · line 79

Quoted 8 lines
drivers/cpuidle/cpuidle-powernv.c +6 -0
+	/*
+	 * Verify if snooze is the only valid cpuidle state
+	 */
+	if (!(powersave_nap > 0))
+		return index;
+
 	if (unlikely(system_state < SYSTEM_RUNNING))
 		return index;

Doesn't the above mean we are just going to keep trying to go into fastsleep again and again? Or does the idle code work out that it didn't work based on the fact that we didn't sleep for the right period?

Thats right. The idle code figures that its judgment to enter fastsleep was not correct and applies a correction factor to its future decisions . This correction factor is intended to influence the cpuidle governor's decision on choosing an idle state for the cpu based on the history of wakeups. Hence a shallower idle state will be chosen here on in the above circumstance.

Quoted 3 lines

We were talking about getting rid of powersave_nap altogether, but I think we decided we couldn't, I forget.

Isn't this a helpful knob to disable cpuidle at runtime? Currently we check the value of powersave_nap before entering both nap and fastsleep.

Regards
Preeti U Murthy

Quoted 9 lines

cheers

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

#3 lore raw
Quoted 7 lines · Preeti U Murthy
Quoted 1 line

We were talking about getting rid of powersave_nap altogether, but I

think we

Quoted 1 line

decided we couldn't, I forget.

Isn't this a helpful knob to disable cpuidle at runtime? Currently we check the value of powersave_nap before entering both nap and fastsleep.

It's useful when diagnosing some problems that can be caused by idle states.

Cheers,
Ben.

#4 lore raw
In reply to Preeti U Murthy
Quoted 34 lines · Preeti U Murthy
Quoted 20 lines · Michael Ellerman
Quoted 19 lines · Preeti U Murthy

Today the procfs interface /proc/sys/kernel/powersave-nap is used to control entry into deep idle states beyond snooze. Check for the value of this parameter before entering fastsleep. We already do this check for nap in power7_idle().

---

 drivers/cpuidle/cpuidle-powernv.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/cpuidle/cpuidle-powernv.c +0 -0
index a64be57..b8ba52e 100644
@@ -69,6 +69,12 @@ static int fastsleep_loop(struct cpuidle_device *dev,
 	unsigned long old_lpcr = mfspr(SPRN_LPCR);
 	unsigned long new_lpcr;
 
Quoted 12 lines

drivers/cpuidle/cpuidle-powernv.c static int fastsleep_loop(struct cpuidle_device *dev, · line 79

Quoted 8 lines
drivers/cpuidle/cpuidle-powernv.c +6 -0
+	/*
+	 * Verify if snooze is the only valid cpuidle state
+	 */
+	if (!(powersave_nap > 0))
+		return index;
+
 	if (unlikely(system_state < SYSTEM_RUNNING))
 		return index;

Doesn't the above mean we are just going to keep trying to go into fastsleep again and again? Or does the idle code work out that it didn't work based on the fact that we didn't sleep for the right period?

Quoted 6 lines

Thats right. The idle code figures that its judgment to enter fastsleep was not correct and applies a correction factor to its future decisions . This correction factor is intended to influence the cpuidle governor's decision on choosing an idle state for the cpu based on the history of wakeups. Hence a shallower idle state will be chosen here on in the above circumstance.

On second thoughts, I feel that this is not the best way to disable deep idle states. Going down this path means the governor should identify that fastsleep is not being entered into and take corrective action from then on. If the governor is buggy, we pointlessly enter and exit fastsleep_loop() during long idle periods.

So a better way to disable fastsleep during runtime is through the disable flag in sysfs. To disable deep idle states at bootup one could use powersave=off kernel cmd line parameter.

The functionality provided by powersave_nap and smt_snooze_delay (to quote another example) carried value during the days that powernv did not have a cpuidle driver. We retain them so as to not break userspace, although they do not carry value today. Any future users of these parameters should be avoided IMO. Hence I retract this patch.

Regards
Preeti U Murthy

Quoted 25 lines
Quoted 4 lines

We were talking about getting rid of powersave_nap altogether, but I think we decided we couldn't, I forget.

Isn't this a helpful knob to disable cpuidle at runtime? Currently we check the value of powersave_nap before entering both nap and fastsleep.

Regards
Preeti U Murthy

Quoted 9 lines

cheers

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev