public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] cpuidle: fix new C-states not functional after AC disconnect
@ 2013-01-13 19:30 Sedat Dilek
  2013-01-13 20:36 ` Sedat Dilek
  0 siblings, 1 reply; 12+ messages in thread
From: Sedat Dilek @ 2013-01-13 19:30 UTC (permalink / raw)
  To: Thomas Schlichter; +Cc: Linux PM List, LKML, daniel.lezcano, Linux ACPI

Hi Thomas,

I read your original LKML posting in [1].

[ QUOTE ]
Currently, Daniel Lezcano seems to be working on an intrusive change of not
using the power_usage value at all for choosing a C-state:

[4] https://lkml.org/lkml/2012/12/14/155

As I could not find any of these patches in any git trees to be merged for
3.8...
[ /QUOTE ]

You can find the patches at LKML ([2] and [3]) or patchwork ([4] and [5]).

As a Linux-Next "customer" I know about Daniel's work for-next [5] but
I did not found any other GIT repository of him.
Striving through Daniel's other GIT repos I found idlestat [6] and
powerdebug [7] tools which I want to test.
( So, thank you for your email! )

Have fun!

Regards,
- Sedat -

[0] http://marc.info/?l=linux-acpi&m=135808048905350&w=2
[1] https://lkml.org/lkml/2012/12/14/153
[2] https://lkml.org/lkml/2012/12/14/149
[3] https://patchwork.kernel.org/patch/1878691/
[4] https://patchwork.kernel.org/patch/1878701/
[5] http://git.linaro.org/gitweb?p=people/dlezcano/cpuidle-next.git
[6] http://git.linaro.org/gitweb?p=people/dlezcano/idlestat.git;a=summary
[7] http://git.linaro.org/gitweb?p=people/dlezcano/powerdebug.git;a=summary

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [PATCH] cpuidle: fix new C-states not functional after AC disconnect
@ 2013-01-13 12:34 Thomas Schlichter
  2013-01-13 14:41 ` Daniel Lezcano
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas Schlichter @ 2013-01-13 12:34 UTC (permalink / raw)
  To: Len Brown, Rafael J. Wysocki, Daniel Lezcano, Linus Torvalds
  Cc: Peter De Schrijver, Andreas Müller, Julius Werner,
	linux-acpi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1329 bytes --]

Hi,

there is a long-standing regression about new C-states not working after 
disconnecting AC power from a laptop if the cpuidle driver "acpi-idle" is 
used. It was reported here:

[1] https://bugzilla.kernel.org/show_bug.cgi?id=42870  (March 5th 2012)
[2] https://bugzilla.kernel.org/show_bug.cgi?id=43349  (June 7th 2012)
[3] https://lkml.org/lkml/2012/10/16/518   (October 19th 2012)

In [1] Andreas proposed a patch that initialized the missing power_usage 
values from within acpi_idle in the same way as cpuidle does.
In [2] I proposed a patch to use the power values provided by ACPI to 
initialize the power_usage variables.
In [3] Julius proposed a patch to call the initialization function 
set_power_states()  not only once, but always when the C-states change.

Currently, Daniel Lezcano seems to be working on an intrusive change of not 
using the power_usage value at all for choosing a C-state:

[4] https://lkml.org/lkml/2012/12/14/155

As I could not find any of these patches in any git trees to be merged for 
3.8, I propose an other, least intrusive patch for the time being. It is 
attached an initializes _all_ power_usage values in the first place.

As this is a real power consumption regression since 3.2, I really ask you to 
apply anything and push it to stable, too!

Kind regards,
Thomas Schlichter

[-- Attachment #2: 0001-Get-power-info-before-updating-the-C-states.patch --]
[-- Type: text/x-patch, Size: 1016 bytes --]

>From 5296fec02cfadf10daf6395ad6b55075381b2439 Mon Sep 17 00:00:00 2001
From: Thomas Schlichter <thomas.schlichter@web.de>
Date: Sun, 2 Sep 2012 14:35:34 +0200
Subject: [PATCH 1/2] Get power info before updating the C-states

acpi_processor_get_power_info() has to be called before
acpi_processor_setup_cpuidle_states() to have the latest
information available. This fixes the missing C-state information
after AC-->DC transition.

Signed-off-by: Thomas Schlichter <thomas.schlichter@web.de>
---
 drivers/acpi/processor_idle.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index f1a5da4..17ed60b 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1149,6 +1149,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
 		}
 
 		/* Populate Updated C-state information */
+		acpi_processor_get_power_info(pr);
 		acpi_processor_setup_cpuidle_states(pr);
 
 		/* Enable all cpuidle devices */
-- 
1.7.10.4

[-- Attachment #3: 0002-cpuidle-Initialize-power_usage-for-all-C-states.patch --]
[-- Type: text/x-patch, Size: 1264 bytes --]

>From 5c635b3530d4f9b41811f7dde12e0d6f5f7dcc54 Mon Sep 17 00:00:00 2001
From: Thomas Schlichter <thomas.schlichter@web.de>
Date: Sat, 12 Jan 2013 15:30:43 +0100
Subject: [PATCH 2/2] cpuidle: Initialize power_usage for all C-states

By now, only the power_usage values of currently available C-states are
initialized in the function set_power_states(). But if the number of C-states
increases later (e.g. when using acpi_idle and unplugging the AC power from the
laptop) the power_usage values of the new C-states stay uninitialized.

Fix this by initializing all CPUIDLE_STATE_MAX C-stages in the first place.

Signed-off-by: Thomas Schlichter <thomas.schlichter@web.de>
---
 drivers/cpuidle/driver.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index c2b281a..960d98d 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -37,7 +37,7 @@ static void set_power_states(struct cpuidle_driver *drv)
 	 * an power value of -1.  So we use -2, -3, etc, for other
 	 * c-states.
 	 */
-	for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++)
+	for (i = CPUIDLE_DRIVER_STATE_START; i < CPUIDLE_STATE_MAX; i++)
 		drv->states[i].power_usage = -1 - i;
 }
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-01-31 13:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-13 19:30 [PATCH] cpuidle: fix new C-states not functional after AC disconnect Sedat Dilek
2013-01-13 20:36 ` Sedat Dilek
2013-01-13 20:44   ` Daniel Lezcano
2013-01-13 20:49     ` Sedat Dilek
2013-01-30 20:23     ` Thomas Schlichter
  -- strict thread matches above, loose matches on Subject: below --
2013-01-13 12:34 Thomas Schlichter
2013-01-13 14:41 ` Daniel Lezcano
2013-01-13 20:04   ` Rafael J. Wysocki
2013-01-18 20:34     ` Thomas Schlichter
2013-01-18 22:24       ` Thomas Schlichter
2013-01-31  3:52     ` Julius Werner
2013-01-31 13:21       ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox