public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>,
	"Yu, Luming" <luming.yu@intel.com>,
	Philip Langdale <philipl@overt.org>,
	Jeff Garrett <jeff@jgarrett.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"venki@google.com" <venki@google.com>
Subject: [PATCH] ACPI: skip checking BM_STS if the BIOS doesn't ask for it
Date: Thu, 22 Jul 2010 17:21:42 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.00.1007221720270.7970@localhost.localdomain> (raw)
In-Reply-To: <alpine.LFD.2.00.1007221153120.3164@localhost.localdomain>

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

It turns out that there is a bit in the _CST for Intel FFH C3
that tells the OS if we should be checking BM_STS or not.

Linux has been unconditionally checking BM_STS.
If the chip-set is configured to enable BM_STS,
it can retard or completely prevent entry into
deep C-states -- as illustrated by turbostat:

http://userweb.kernel.org/~lenb/acpi/utils/pmtools/turbostat/

ref: Intel Processor Vendor-Specific ACPI Interface Specification
table 4 "_CST FFH GAS Field Encoding"
Bit 1: Set to 1 if OSPM should use Bus Master avoidance for this C-state

https://bugzilla.kernel.org/show_bug.cgi?id=15886

Signed-off-by: Len Brown <len.brown@intel.com>
---
 arch/x86/kernel/acpi/cstate.c |    9 +++++++++
 drivers/acpi/processor_idle.c |    2 +-
 include/acpi/processor.h      |    3 ++-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index 2e837f5..fb7a5f0 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -145,6 +145,15 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
 		percpu_entry->states[cx->index].eax = cx->address;
 		percpu_entry->states[cx->index].ecx = MWAIT_ECX_INTERRUPT_BREAK;
 	}
+
+	/*
+	 * For _CST FFH on Intel, if GAS.access_size bit 1 is cleared,
+	 * then we should skip checking BM_STS for this C-state.
+	 * ref: "Intel Processor Vendor-Specific ACPI Interface Specification"
+	 */
+	if ((c->x86_vendor == X86_VENDOR_INTEL) && !(reg->access_size & 0x2))
+		cx->bm_sts_skip = 1;
+
 	return retval;
 }
 EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe);
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index b1b3856..b351342 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -947,7 +947,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
 	if (acpi_idle_suspend)
 		return(acpi_idle_enter_c1(dev, state));
 
-	if (acpi_idle_bm_check()) {
+	if (!cx->bm_sts_skip && acpi_idle_bm_check()) {
 		if (dev->safe_state) {
 			dev->last_state = dev->safe_state;
 			return dev->safe_state->enter(dev, dev->safe_state);
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index da565a4..a68ca8a 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -48,7 +48,7 @@ struct acpi_power_register {
 	u8 space_id;
 	u8 bit_width;
 	u8 bit_offset;
-	u8 reserved;
+	u8 access_size;
 	u64 address;
 } __attribute__ ((packed));
 
@@ -63,6 +63,7 @@ struct acpi_processor_cx {
 	u32 power;
 	u32 usage;
 	u64 time;
+	u8 bm_sts_skip;
 	char desc[ACPI_CX_DESC_LEN];
 };
 
-- 
1.7.2


  reply	other threads:[~2010-07-22 21:22 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-26  8:47 acpi_idle: Very idle Core i7 machine never enters C3 Jeff Garrett
2010-01-26 12:41 ` peng huang
2010-01-26 14:59   ` Jeff Garrett
2010-01-27 13:27     ` peng huang
2010-02-05 16:22       ` Jeff Garrett
2010-01-26 21:45 ` Andi Kleen
2010-02-05 16:09   ` Jeff Garrett
2010-02-05 17:45     ` Len Brown
2010-02-05 20:53       ` Jeff Garrett
2010-04-27  2:40       ` Philip Langdale
2010-04-27  7:26         ` Len Brown
2010-04-27 15:41           ` Philip Langdale
2010-04-27 12:47         ` Jeff Garrett
2010-04-30 14:57           ` Philip Langdale
2010-04-30 16:25           ` Len Brown
2010-04-30 17:44             ` Matthew Garrett
2010-04-30 18:35               ` Philip Langdale
2010-05-25  5:43                 ` Len Brown
2010-05-25  5:59                   ` Yu, Luming
2010-05-25 12:39                     ` Matthew Garrett
2010-05-25 12:43                     ` Matthew Garrett
2010-05-25 15:33                       ` Len Brown
2010-05-25 18:55                         ` Matthew Garrett
2010-07-21 21:31                           ` [PATCH] ACPI: make acpi_idle Nehalem-aware Len Brown
2010-07-22  0:53                             ` Venkatesh Pallipadi
2010-07-22  7:47                             ` Andi Kleen
2010-07-22 15:57                               ` Len Brown
2010-07-22 21:21                                 ` Len Brown [this message]
2010-07-22 21:40                                   ` [PATCH] ACPI: create "processor.bm_check_disable" boot param Len Brown
2010-07-26  7:24                                     ` Andi Kleen
2010-07-27  0:19                                       ` Len Brown
2010-07-27 11:28                                         ` Andi Kleen
2010-07-28 18:58                                           ` Len Brown
2010-07-22 21:25                                 ` [PATCH] ACPI: make acpi_idle Nehalem-aware Iain
2010-07-22 21:53                                   ` Iain
2010-07-22 22:01                                   ` Len Brown
2010-07-23 12:40                                     ` Iain
2010-08-03  6:55                             ` Pavel Machek
2010-08-03  7:05                               ` Andi Kleen
2010-05-25 12:37                   ` acpi_idle: Very idle Core i7 machine never enters C3 Matthew Garrett
2010-05-25 15:40                     ` Len Brown
2010-07-22  5:34           ` Len Brown
2010-02-01 14:10 ` Pavel Machek
2010-02-05 16:30   ` Jeff Garrett

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=alpine.LFD.2.00.1007221720270.7970@localhost.localdomain \
    --to=lenb@kernel.org \
    --cc=andi@firstfloor.org \
    --cc=jeff@jgarrett.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luming.yu@intel.com \
    --cc=mjg59@srcf.ucam.org \
    --cc=philipl@overt.org \
    --cc=venki@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox