Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1465802 > unrolled thread

[RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at start

Started by"Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
First post2016-08-19 03:40 +0200
Last post2016-08-25 16:20 +0200
Articles 6 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at start "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> - 2016-08-19 03:40 +0200
    Re: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at  start Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-08-24 16:50 +0200
      Re: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at  start Balbir Singh <bsingharora@gmail.com> - 2016-08-24 17:00 +0200
        Re: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at  start Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-08-24 17:10 +0200
          Re: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at  start Balbir Singh <bsingharora@gmail.com> - 2016-08-25 15:50 +0200
            Re: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at  start Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-08-25 16:20 +0200

#1465802 — [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at start

From"Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
Date2016-08-19 03:40 +0200
Subject[RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at start
Message-ID<s7GWR-7sc-15@gated-at.bofh.it>
From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

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 <ego@linux.vnet.ibm.com>
---
 drivers/cpuidle/cpuidle.c | 7 +++++++
 include/linux/cpuidle.h   | 7 ++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index c73207a..b4debc7 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -439,7 +439,14 @@ static void __cpuidle_unregister_device(struct cpuidle_device *dev)
 
 static void __cpuidle_device_init(struct cpuidle_device *dev)
 {
+	struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
+	int i;
+
 	memset(dev->states_usage, 0, sizeof(dev->states_usage));
+	for (i = 0; i < drv->state_count; i++) {
+		if (drv->states[i].disable_use_at_start)
+			dev->states_usage[i].disable = 1;
+	}
 	dev->last_residency = 0;
 }
 
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index bb31373..f3fe855 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -44,7 +44,12 @@ struct cpuidle_state {
 	int		power_usage; /* in mW */
 	unsigned int	target_residency; /* in US */
 	bool		disabled; /* disabled on all CPUs */
-
+	/*
+	 * disable_use_at_start: If true, then this idle state will be
+	 * disabled by default. It can be enabled at runtime using the
+	 * per-cpu cpuidle sysfs control file named "disable".
+	 */
+	bool            disable_use_at_start;
 	int (*enter)	(struct cpuidle_device *dev,
 			struct cpuidle_driver *drv,
 			int index);
-- 
1.9.4

[toc] | [next] | [standalone]


#1469501 — Re: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at start

FromDaniel Lezcano <daniel.lezcano@linaro.org>
Date2016-08-24 16:50 +0200
SubjectRe: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at start
Message-ID<s9HF7-3BB-17@gated-at.bofh.it>
In reply to#1465802
On 08/19/2016 12:26 AM, Gautham R. Shenoy wrote:
> From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
> 
> 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.

... for each cpu.


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

[toc] | [prev] | [next] | [standalone]


#1469509 — Re: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at start

FromBalbir Singh <bsingharora@gmail.com>
Date2016-08-24 17:00 +0200
SubjectRe: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at start
Message-ID<s9HOO-3F4-27@gated-at.bofh.it>
In reply to#1469501

On 25/08/16 00:44, Daniel Lezcano wrote:
> On 08/19/2016 12:26 AM, Gautham R. Shenoy wrote:
>> From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
>>
>> 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

[toc] | [prev] | [next] | [standalone]


#1469520 — Re: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at start

FromDaniel Lezcano <daniel.lezcano@linaro.org>
Date2016-08-24 17:10 +0200
SubjectRe: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at start
Message-ID<s9HYu-3Yy-43@gated-at.bofh.it>
In reply to#1469509
On 08/24/2016 04:48 PM, Balbir Singh wrote:
> 
> 
> On 25/08/16 00:44, Daniel Lezcano wrote:
>> On 08/19/2016 12:26 AM, Gautham R. Shenoy wrote:
>>> From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
>>>
>>> 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 ?

  -- Daniel


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

[toc] | [prev] | [next] | [standalone]


#1470158 — Re: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at start

FromBalbir Singh <bsingharora@gmail.com>
Date2016-08-25 15:50 +0200
SubjectRe: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at start
Message-ID<sa3cB-1AH-15@gated-at.bofh.it>
In reply to#1469520

On 25/08/16 01:06, Daniel Lezcano wrote:
> On 08/24/2016 04:48 PM, Balbir Singh wrote:
>>
>>
>> On 25/08/16 00:44, Daniel Lezcano wrote:
>>> On 08/19/2016 12:26 AM, Gautham R. Shenoy wrote:
>>>> From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
>>>>
>>>> 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.

[toc] | [prev] | [next] | [standalone]


#1470175 — Re: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at start

FromDaniel Lezcano <daniel.lezcano@linaro.org>
Date2016-08-25 16:20 +0200
SubjectRe: [RFC/PATCH 1/2] cpuidle: Allow idle-states to be disabled at start
Message-ID<sa3FD-204-1@gated-at.bofh.it>
In reply to#1470158
On 08/25/2016 03:46 PM, Balbir Singh wrote:
> 
> 
> On 25/08/16 01:06, Daniel Lezcano wrote:
>> On 08/24/2016 04:48 PM, Balbir Singh wrote:
>>>
>>>
>>> On 25/08/16 00:44, Daniel Lezcano wrote:
>>>> On 08/19/2016 12:26 AM, Gautham R. Shenoy wrote:
>>>>> From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
>>>>>
>>>>> 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.

Why not invert the logic ?

A knowledgeable person can look into selectively disable for production.

In addition, a kernel command line option to specify which state to
disable would be appropriate and beneficial for all existing drivers.


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web