mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: x86@kernel.org, linux-pm@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Len Brown <len.brown@intel.com>,
	Venkatesh Pallipadi <venki@google.com>
Subject: [PATCH 7/8] ACPI: acpi_idle: touch TS_POLLING only in the non-MWAIT case
Date: Wed, 26 May 2010 22:42:30 -0400	[thread overview]
Message-ID: <34959ffadbffe1eaedcf5cc677916b2f7313dc4e.1274926772.git.len.brown@intel.com> (raw)
In-Reply-To: <1274928151-30919-1-git-send-email-lenb@kernel.org>
In-Reply-To: <e099975ca65a7f6ac7f8bc3fee84d3e03893aa31.1274926772.git.len.brown@intel.com>

From: Len Brown <len.brown@intel.com>

commit d306ebc28649b89877a22158fe0076f06cc46f60
(ACPI: Be in TS_POLLING state during mwait based C-state entry)
fixed an important power & performance issue where ACPI c2 and c3 C-states
were clearing TS_POLLING even when using MWAIT (ACPI_STATE_FFH).
That bug had been causing us to receive redundant scheduling interrups
when we had already been woken up by MONITOR/MWAIT.

Following up on that...

In the MWAIT case, we don't have to subsequently
check need_resched(), as that c heck was there
for the TS_POLLING-clearing case.

Note that not only does the cpuidle calling function
already check need_resched() before calling us, the
low-level entry into monitor/mwait calls it twice --
guaranteeing that a write to the trigger address
can not go un-noticed.

Also, in this case, we don't have to set TS_POLLING
when we wake, because we never cleared it.

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: Venkatesh Pallipadi <venki@google.com>
---
 drivers/acpi/processor_idle.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 5939e7f..a4166e2 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -881,6 +881,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
 		return(acpi_idle_enter_c1(dev, state));
 
 	local_irq_disable();
+
 	if (cx->entry_method != ACPI_CSTATE_FFH) {
 		current_thread_info()->status &= ~TS_POLLING;
 		/*
@@ -888,12 +889,12 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
 		 * NEED_RESCHED:
 		 */
 		smp_mb();
-	}
 
-	if (unlikely(need_resched())) {
-		current_thread_info()->status |= TS_POLLING;
-		local_irq_enable();
-		return 0;
+		if (unlikely(need_resched())) {
+			current_thread_info()->status |= TS_POLLING;
+			local_irq_enable();
+			return 0;
+		}
 	}
 
 	/*
@@ -918,7 +919,8 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
 	sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
 
 	local_irq_enable();
-	current_thread_info()->status |= TS_POLLING;
+	if (cx->entry_method != ACPI_CSTATE_FFH)
+		current_thread_info()->status |= TS_POLLING;
 
 	cx->usage++;
 
@@ -968,6 +970,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
 	}
 
 	local_irq_disable();
+
 	if (cx->entry_method != ACPI_CSTATE_FFH) {
 		current_thread_info()->status &= ~TS_POLLING;
 		/*
@@ -975,12 +978,12 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
 		 * NEED_RESCHED:
 		 */
 		smp_mb();
-	}
 
-	if (unlikely(need_resched())) {
-		current_thread_info()->status |= TS_POLLING;
-		local_irq_enable();
-		return 0;
+		if (unlikely(need_resched())) {
+			current_thread_info()->status |= TS_POLLING;
+			local_irq_enable();
+			return 0;
+		}
 	}
 
 	acpi_unlazy_tlb(smp_processor_id());
@@ -1032,7 +1035,8 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
 	sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
 
 	local_irq_enable();
-	current_thread_info()->status |= TS_POLLING;
+	if (cx->entry_method != ACPI_CSTATE_FFH)
+		current_thread_info()->status |= TS_POLLING;
 
 	cx->usage++;
 
-- 
1.6.0.6


  parent reply	other threads:[~2010-05-27  2:42 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-27  2:42 idle-test patches queued for upstream Len Brown
2010-05-27  2:42 ` [PATCH 1/8] cpuidle: fail to register if !CONFIG_CPU_IDLE Len Brown
2010-05-27  2:42   ` [PATCH 2/8] cpuidle: add cpuidle_unregister_driver() error check Len Brown
2010-05-27  3:14     ` Andrew Morton
2010-05-27  5:11       ` [PATCH-v2 " Len Brown
2010-05-27  5:13         ` Andrew Morton
2010-05-27  2:42   ` [PATCH 3/8] cpuidle: make cpuidle_curr_driver static Len Brown
2010-05-27  5:27     ` [PATCH-v2 " Len Brown
2010-05-27 18:40       ` Luck, Tony
2010-05-27 23:30         ` Len Brown
2010-05-27  2:42   ` [PATCH 4/8] ACPI: allow a native cpuidle driver to displace ACPI Len Brown
2010-05-27  2:42   ` [PATCH 5/8] sched: clarify commment for TS_POLLING Len Brown
2010-05-27  5:53     ` [PATCH-v2 " Len Brown
2010-05-27  2:42   ` [PATCH 6/8] acpi_pad: uses MONITOR/MWAIT, so it doesn't need to clear TS_POLLING Len Brown
2010-05-27  2:42   ` Len Brown [this message]
2010-05-27  2:42   ` [PATCH 8/8] intel_idle: create a native cpuidle driver for select intel processors Len Brown
2010-05-27  3:44     ` Andrew Morton
2010-05-28  3:57       ` Len Brown
2010-05-30  9:20         ` Andi Kleen
2010-05-27  8:53     ` [linux-pm] " Thomas Renninger
2010-05-28  1:44       ` Len Brown
2010-05-28  7:46         ` Thomas Renninger
2010-05-28 17:38           ` Len Brown
2010-05-29  4:17         ` Thomas Renninger
2010-05-27 14:14     ` Kevin Hilman
2010-05-27 14:22       ` Arjan van de Ven
2010-05-27 14:36         ` Kevin Hilman
2010-05-28  0:22           ` Len Brown
2010-05-28 17:28             ` Kevin Hilman
2010-05-27 14:51         ` [linux-pm] " Igor Stoppa
2010-05-28  3:14           ` Arjan van de Ven
2010-05-28 17:27             ` Kevin Hilman
2010-05-29  0:38               ` Arjan van de Ven
2010-05-28  2:32     ` Chase Douglas
2010-05-28  4:16       ` Len Brown
2010-05-28 15:09         ` Chase Douglas
2010-05-28 17:43           ` Len Brown
2010-05-28 19:51             ` Chase Douglas
2010-05-28 20:14               ` Chase Douglas
2010-05-27  5:25   ` (No subject header) Milton Miller
2010-05-27  5:47     ` Len Brown
2010-05-27  8:45 ` [linux-pm] idle-test patches queued for upstream Thomas Renninger
2010-05-28  0:59   ` Len Brown
2010-05-28  8:07     ` Thomas Renninger
2010-05-28 17:42       ` Len Brown
2010-06-16  7:53     ` Pavel Machek
2010-05-28  6:01 idle patches for 2.6.35 Len Brown
2010-05-28  6:01 ` [PATCH 1/8] cpuidle: fail to register if !CONFIG_CPU_IDLE Len Brown
2010-05-28  6:02   ` [PATCH 7/8] ACPI: acpi_idle: touch TS_POLLING only in the non-MWAIT case Len Brown
2010-05-28 16:19     ` Venkatesh Pallipadi
2010-05-28 17:59       ` Len Brown
2010-05-28 21:24         ` Venkatesh Pallipadi

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=34959ffadbffe1eaedcf5cc677916b2f7313dc4e.1274926772.git.len.brown@intel.com \
    --to=lenb@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=venki@google.com \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome