LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 2.6.25-rc3] processor_idle: fixed CPU 'active state' stably  remain C0 by cat /proc
@ 2008-02-29  9:42 youquan_song
  0 siblings, 0 replies; only message in thread
From: youquan_song @ 2008-02-29  9:42 UTC (permalink / raw)
  To: linux-kernel; +Cc: youquan.song

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.

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-29  9:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-29  9:42 [PATCH 2.6.25-rc3] processor_idle: fixed CPU 'active state' stably remain C0 by cat /proc youquan_song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).