[PATCH 2.6.25-rc3] processor_idle: fixed CPU 'active state' stably remain C0 by cat /proc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If cpuidle module is enabled by CONFIG_CPU_IDEL=y,user can check CPU idle
information by both /proc and /sys. The /proc information keep consistent
with the old kernel without cpuidle modules except the 'active state'.
Because If we enable cpuidle, kernel will not record CPU active state, 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 which when
run 'cat /proc', the "active state" change as the cpu real work.

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.

Signed-off-by: Youquan Song <youquan.song@xxxxxxxxx>
---
 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


--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux