Skip to contentSkip to conversation

processor_idle: fixed CPU 'active state' stably remain C0 by cat /proc

PATCH New [email protected] 1 participant 1 message Feb 29, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 processor_idle: fixed CPU 'active state' stably remain C0 by cat /proc

If cpuidle module is enabled by CONFIG_CPU_IDEL=y,user can check CPU idle information by both /proc and /sys. The two interface keep consistent except 'active state'. enabling cpuidle will not record CPU active state any more, so if we run 'cat /proc/acpi/processor/CPU*/power', we will get the 'active state' stably remain C0. This is different from user experience and the case that cpuidle disable by CONFIG_CPU_IDLE=n.

This patch will fix the bug by record the specail C state when CPU is going to enter to C state. we run 'cat /proc/acpi/processor/CPU*/power' and we will watch the CPU 'active state' change keeping the same with the cpu real work.

---
 processor_idle.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff -urNa linux-2.6.25-rc3-orginal/drivers/acpi/processor_idle.c linux-2.6.25-rc3/drivers/acpi/processor_idle.c
--- linux-2.6.25-rc3-orginal/drivers/acpi/processor_idle.c 2008-02-29
07:58:51.000000000 -0500
+++ linux-2.6.25-rc3/drivers/acpi/processor_idle.c 2008-02-29
11:56:39.000000000 -0500
@@ -1425,6 +1425,8 @@
return 0;

local_irq_disable();
+ /* Record the active C state */
+ pr->power.state = cx;

/* Do not access any ACPI IO ports in suspend path */ if (acpi_idle_suspend) {
@@ -1468,6 +1470,8 @@
return(acpi_idle_enter_c1(dev, state));

local_irq_disable();
+ /* Record the active C state */
+ pr->power.state = cx;
current_thread_info()->status &= ~TS_POLLING; /*
* TS_POLLING-cleared state must be visible before we test
@@ -1558,6 +1562,8 @@
}

local_irq_disable();
+ /* Record the active C state */
+ pr->power.state = cx;
current_thread_info()->status &= ~TS_POLLING; /*
* TS_POLLING-cleared state must be visible before we test