All of lore.kernel.org
 help / color / mirror / Atom feed
From: youquan_song@linux.intel.com
To: linux-kernel@vger.kernel.org
Cc: youquan.song@intel.com
Subject: [PATCH 2.6.25-rc3] processor_idle: fixed CPU 'active state' stably  remain C0 by cat /proc
Date: Fri, 29 Feb 2008 01:42:17 -0800 (PST)	[thread overview]
Message-ID: <4848.172.16.116.56.1204278137.squirrel@linux.intel.com> (raw)

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

             reply	other threads:[~2008-02-29  9:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-29  9:42 youquan_song [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-03-03  8:53 [PATCH 2.6.25-rc3] processor_idle: fixed CPU 'active state' stably remain C0 by cat /proc youquan_song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4848.172.16.116.56.1204278137.squirrel@linux.intel.com \
    --to=youquan_song@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=youquan.song@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.