From: Gautham R. Shenoy <hidden> Date: 2016-08-19 03:01:05
From: "Gautham R. Shenoy" <redacted>
Hi,
The patches in these series enable support for Winkle idle state in
CPU-Idle.
The first patch is a platform-independent CPU-Idle patch that allows
CPU-Idle states to be disabled at start (Currently they are all
enabled by default).
The second patch adds the winkle enablement for powernv-cpuidle. By
default, the winkle idle-state is disabled. It can be enabled by
writing zero to the per-cpu cpuidle sysfs control file named
"disable".
This series has been lightly tested on a 2-socket POWER8 system and
the machine was pretty stable while running kernbench and ebizzy. I
didn't see any regressions with those.
I haven't yet evaluated the impact that these patches might have
on latency sensitive workloads. I hope to do that in a day or two.
On the power-savings front, I could observe 6-8% additional
power-savings when winkle state was enabled on an idle system with
SMT=on. With SMT=off, additional idle power-savings observed with
winkle enabled were greater than 15%. The numbers indicate that it
might be worth the while to pursue this!
Gautham R. Shenoy (2):
cpuidle: Allow idle-states to be disabled at start
powernv:cpuidle: Enable winkle idle state in CPU-Idle.
drivers/cpuidle/cpuidle-powernv.c | 44 ++++++++++++++++++++++++++++++++-------
drivers/cpuidle/cpuidle.c | 7 +++++++
include/linux/cpuidle.h | 7 ++++++-
3 files changed, 49 insertions(+), 9 deletions(-)
--
1.9.4
From: Gautham R. Shenoy <hidden> Date: 2016-08-19 01:34:47
From: "Gautham R. Shenoy" <redacted>
Currently all the idle states registered by a cpu-idle driver are
enabled by default. This patch adds a mechanism which allows the
driver to hint if an idle-state should start in a disabled state. The
cpu-idle core will use this hint to appropriately initialize the
usage->disable knob of the CPU device idle state.
The state can be enabled at run time by echo'ing a zero to the sysfs
"disable" control file.
Signed-off-by: Gautham R. Shenoy <redacted>
---
drivers/cpuidle/cpuidle.c | 7 +++++++
include/linux/cpuidle.h | 7 ++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
@@ -44,7 +44,12 @@ struct cpuidle_state {intpower_usage;/* in mW */unsignedinttarget_residency;/* in US */booldisabled;/* disabled on all CPUs */-+/*+*disable_use_at_start:Iftrue,thenthisidlestatewillbe+*disabledbydefault.Itcanbeenabledatruntimeusingthe+*per-cpucpuidlesysfscontrolfilenamed"disable".+*/+booldisable_use_at_start;int(*enter)(structcpuidle_device*dev,structcpuidle_driver*drv,intindex);
From: Gautham R. Shenoy <hidden> Date: 2016-08-19 02:56:50
From: "Gautham R. Shenoy" <redacted>
cpu-idle on powernv currently has support for only snooze, nap and
fastsleep states. Winkle idle state was excluded due to its large
exit-latency.
This patch adds winkle as a cpu-idle state for experimental
purposes. This state is disabled at start by default. However, should an
adventurous user want to enable it on a particular CPU(s), they can do
so by echo'ing a zero into the per-cpu sysfs cpuidle control file named
"disable" corresponding to this state.
Signed-off-by: Gautham R. Shenoy <redacted>
---
drivers/cpuidle/cpuidle-powernv.c | 44 ++++++++++++++++++++++++++++++++-------
1 file changed, 36 insertions(+), 8 deletions(-)
@@ -95,6 +94,30 @@ static int fastsleep_loop(struct cpuidle_device *dev,returnindex;}++staticintwinkle_loop(structcpuidle_device*dev,+structcpuidle_driver*drv,+intindex)+{+unsignedlongold_lpcr=mfspr(SPRN_LPCR);+unsignedlongnew_lpcr;++if(unlikely(system_state<SYSTEM_RUNNING))+returnindex;++new_lpcr=old_lpcr;+/* Do not exit powersave upon decrementer as we've setup the timer+*offload.+*/+new_lpcr&=~LPCR_PECE1;++mtspr(SPRN_LPCR,new_lpcr);+power7_winkle();++mtspr(SPRN_LPCR,old_lpcr);++returnindex;+}#endifstaticintstop_loop(structcpuidle_device*dev,
@@ -246,13 +269,6 @@ static int powernv_add_idle_states(void)"ibm,cpu-idle-state-residency-ns",residency_ns,dt_idle_states);for(i=0;i<dt_idle_states;i++){-/*-*Ifanidlestatehasexitlatencybeyond-*POWERNV_THRESHOLD_LATENCY_NSthendon'tuseit-*incpu-idle.-*/-if(latency_ns[i]>POWERNV_THRESHOLD_LATENCY_NS)-continue;/**Cpuidleacceptsexit_latencyandtarget_residencyinus.
@@ -301,6 +317,18 @@ static int powernv_add_idle_states(void)powernv_states[nr_idle_states].enter=stop_loop;stop_psscr_table[nr_idle_states]=psscr_val[i];}++if(flags[i]&OPAL_PM_WINKLE_ENABLED){+intstate_idx=nr_idle_states;++strcpy(powernv_states[state_idx].name,"Winkle");+strcpy(powernv_states[state_idx].desc,"Winkle");+powernv_states[state_idx].flags=+CPUIDLE_FLAG_TIMER_STOP;+powernv_states[state_idx].target_residency=500000;+powernv_states[state_idx].enter=winkle_loop;+powernv_states[state_idx].disable_use_at_start=true;+}#endifpowernv_states[nr_idle_states].exit_latency=((unsignedint)latency_ns[i])/1000;
From: Daniel Lezcano <hidden> Date: 2016-08-24 14:44:45
On 08/19/2016 12:26 AM, Gautham R. Shenoy wrote:
From: "Gautham R. Shenoy" <redacted>
Currently all the idle states registered by a cpu-idle driver are
enabled by default. This patch adds a mechanism which allows the
driver to hint if an idle-state should start in a disabled state. The
cpu-idle core will use this hint to appropriately initialize the
usage->disable knob of the CPU device idle state.
Why do you need to do that ?
The state can be enabled at run time by echo'ing a zero to the sysfs
"disable" control file.
From: "Gautham R. Shenoy" <redacted>
Currently all the idle states registered by a cpu-idle driver are
enabled by default. This patch adds a mechanism which allows the
driver to hint if an idle-state should start in a disabled state. The
cpu-idle core will use this hint to appropriately initialize the
usage->disable knob of the CPU device idle state.
Why do you need to do that ?
I think patch 2/2 explains the reason as it uses this infrastructure
Balbir Singh
From: Daniel Lezcano <hidden> Date: 2016-08-24 15:06:41
On 08/24/2016 04:48 PM, Balbir Singh wrote:
On 25/08/16 00:44, Daniel Lezcano wrote:
quoted
On 08/19/2016 12:26 AM, Gautham R. Shenoy wrote:
quoted
From: "Gautham R. Shenoy" <redacted>
Currently all the idle states registered by a cpu-idle driver are
enabled by default. This patch adds a mechanism which allows the
driver to hint if an idle-state should start in a disabled state. The
cpu-idle core will use this hint to appropriately initialize the
usage->disable knob of the CPU device idle state.
Why do you need to do that ?
I think patch 2/2 explains the reason as it uses this infrastructure
From: "Gautham R. Shenoy" <redacted>
Currently all the idle states registered by a cpu-idle driver are
enabled by default. This patch adds a mechanism which allows the
driver to hint if an idle-state should start in a disabled state. The
cpu-idle core will use this hint to appropriately initialize the
usage->disable knob of the CPU device idle state.
Why do you need to do that ?
I think patch 2/2 explains the reason as it uses this infrastructure
Ok, let me elaborate the question, I was not clear.
Why the userspace can't setup the system environment at boot time by
disabling the state instead of adding extra code to disable it at boot
time in the kernel and then re-enable it from userspace ?
Gautham's patches don't want to have those states enabled by default.
They are unlikely to be what production systems need, but likely
what a knowledgeable person can look into selectively enable for
experimentation.
@Gautham?
Balbir Singh.
From: Daniel Lezcano <hidden> Date: 2016-08-25 14:14:39
On 08/25/2016 03:46 PM, Balbir Singh wrote:
On 25/08/16 01:06, Daniel Lezcano wrote:
quoted
On 08/24/2016 04:48 PM, Balbir Singh wrote:
quoted
On 25/08/16 00:44, Daniel Lezcano wrote:
quoted
On 08/19/2016 12:26 AM, Gautham R. Shenoy wrote:
quoted
From: "Gautham R. Shenoy" <redacted>
Currently all the idle states registered by a cpu-idle driver are
enabled by default. This patch adds a mechanism which allows the
driver to hint if an idle-state should start in a disabled state. The
cpu-idle core will use this hint to appropriately initialize the
usage->disable knob of the CPU device idle state.
Why do you need to do that ?
I think patch 2/2 explains the reason as it uses this infrastructure
Ok, let me elaborate the question, I was not clear.
Why the userspace can't setup the system environment at boot time by
disabling the state instead of adding extra code to disable it at boot
time in the kernel and then re-enable it from userspace ?
Gautham's patches don't want to have those states enabled by default.
They are unlikely to be what production systems need, but likely
what a knowledgeable person can look into selectively enable for
experimentation.