lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 19 Oct 2012 14:50:46 -0700
From:	Julius Werner <jwerner@...omium.org>
To:	Daniel Lezcano <daniel.lezcano@...aro.org>
Cc:	linux-kernel@...r.kernel.org, len.brown@...el.com, khilman@...com,
	rjw@...k.pl, deepthi@...ux.vnet.ibm.com, akpm@...ux-foundation.org,
	g.trinabh@...il.com, snanda@...omium.org,
	Lists Linaro-dev <linaro-dev@...ts.linaro.org>,
	Julius Werner <jwerner@...omium.org>
Subject: [PATCH] acpi/cpuidle: reinitialize power_usage values when adding/removing C-states

When cpuidle drivers do not supply explicit power_usage values,
cpuidle/driver.c inserts dummy values instead. When a running processor
dynamically gains new C-states (e.g. after ACPI events), the power_usage
values of those states will stay uninitialized, and cpuidle governors
will never choose to enter them.

This patch ensures that the ACPI cpuidle driver sets those dummy power
values itself whenever it (re-)initializes its idle states.
Tested and verified on an Acer AC700 Chromebook, which supports the C3
state only when it switches from AC to battery power.

Signed-off-by: Julius Werner <jwerner@...omium.org>
---
 drivers/acpi/processor_idle.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index e8086c7..078e22f 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1090,6 +1090,9 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
 		state->exit_latency = cx->latency;
 		state->target_residency = cx->latency * latency_factor;
 
+		/* reinitialize this in case new states are added after boot */
+		state->power_usage = -1 - count;
+
 		state->flags = 0;
 		switch (cx->type) {
 			case ACPI_STATE_C1:
-- 
1.7.8.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ