Skip to contentSkip to conversation

idle patches for 2.6.37

PATCH In review Len Brown 2 participants 7 messages Oct 26, 2010 – Nov 2, 2010

Subsystems (2)
lore
Share & tools
lore

Len Brown

author reviewer
#0 lore raw

I realized after I requested these patches for 2.6.37-merge that I'd neglected to send the series to linux-pm -- so here they are. Let me know if you see troubles with any of them.

thanks,
Len Brown, Intel Open Source Technology Center

author reviewer
#1 lore raw

PATCH 1/5 intel_idle: simplify test for leave_mm()

From: Len Brown <[email protected]>

A run-time test to invoke leave_mm() for the deepest supported C-state is redundant, since the appropriate C-states already have flags with CPUIDLE_FLAG_TLB_FLUSHED set.

---
 drivers/idle/intel_idle.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
drivers/idle/intel_idle.c +3 -6
index c37ef64..ad0fb01 100644
@@ -186,13 +186,10 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state)
 	local_irq_disable();
 
 	/*
-	 * If the state flag indicates that the TLB will be flushed or if this
-	 * is the deepest c-state supported, do a voluntary leave mm to avoid
-	 * costly and mostly unnecessary wakeups for flushing the user TLB's
-	 * associated with the active mm.
+	 * leave_mm() to avoid costly and often unnecessary wakeups
+	 * for flushing the user TLB's associated with the active mm.
 	 */
-	if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED ||
-	    (&dev->states[dev->state_count - 1] == state))
+	if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED)
 		leave_mm(cpu);
 
 	if (!(lapic_timer_reliable_states & (1 << (cstate))))
Signature · 1 line
1.7.3.2.90.gd4c43
author reviewer
#2 lore raw

PATCH 2/5 intel_idle: delete bogus data from cpuidle_state.power_usage

In reply to Len Brown

From: Len Brown <[email protected]>

The mW data in this field is a total fabrication
and serves no purpose other than to mislead
those who might see it in sysfs. Delete it.

---
 drivers/idle/intel_idle.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
drivers/idle/intel_idle.c +0 -7
index ad0fb01..8e35c89 100644
@@ -101,7 +101,6 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = {
 		.driver_data = (void *) 0x00,
 		.flags = CPUIDLE_FLAG_TIME_VALID,
 		.exit_latency = 3,
-		.power_usage = 1000,
 		.target_residency = 6,
 		.enter = &intel_idle },
 	{ /* MWAIT C2 */
@@ -110,7 +109,6 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = {
 		.driver_data = (void *) 0x10,
 		.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 20,
-		.power_usage = 500,
 		.target_residency = 80,
 		.enter = &intel_idle },
 	{ /* MWAIT C3 */
@@ -119,7 +117,6 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = {
 		.driver_data = (void *) 0x20,
 		.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 200,
-		.power_usage = 350,
 		.target_residency = 800,
 		.enter = &intel_idle },
 };
@@ -132,7 +129,6 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
 		.driver_data = (void *) 0x00,
 		.flags = CPUIDLE_FLAG_TIME_VALID,
 		.exit_latency = 1,
-		.power_usage = 1000,
 		.target_residency = 4,
 		.enter = &intel_idle },
 	{ /* MWAIT C2 */
@@ -141,7 +137,6 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
 		.driver_data = (void *) 0x10,
 		.flags = CPUIDLE_FLAG_TIME_VALID,
 		.exit_latency = 20,
-		.power_usage = 500,
 		.target_residency = 80,
 		.enter = &intel_idle },
 	{ /* MWAIT C3 */ },
@@ -151,7 +146,6 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
 		.driver_data = (void *) 0x30,
 		.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 100,
-		.power_usage = 250,
 		.target_residency = 400,
 		.enter = &intel_idle },
 	{ /* MWAIT C5 */ },
@@ -161,7 +155,6 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
 		.driver_data = (void *) 0x52,
 		.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 140,
-		.power_usage = 150,
 		.target_residency = 560,
 		.enter = &intel_idle },
 };
Signature · 1 line
1.7.3.2.90.gd4c43
author reviewer
#3 lore raw

PATCH 3/5 acpi_idle: delete bogus data from cpuidle_state.power_usage

In reply to Len Brown

From: Len Brown <[email protected]>

The mW data in this field comes from AML _CST, which was typed in by a BIOS writer, and is thus considered unreliable.

Linux does not use it for making any decisions. We do display it in sysfs where somebody might read it and assume it is meaningful, so delete it.

---
 drivers/acpi/processor_idle.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/acpi/processor_idle.c +0 -1
index f4428e8..07a8bb6 100644
@@ -1013,7 +1013,6 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
 		strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
 		state->exit_latency = cx->latency;
 		state->target_residency = cx->latency * latency_factor;
-		state->power_usage = cx->power;
 
 		state->flags = 0;
 		switch (cx->type) {
Signature · 1 line
1.7.3.2.90.gd4c43
author reviewer
#4 lore raw

PATCH 4/5 intel_idle: add initial Sandy Bridge support

In reply to Len Brown

From: Len Brown <[email protected]>

---
 drivers/idle/intel_idle.c |   44 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 43 insertions(+), 1 deletions(-)
drivers/idle/intel_idle.c +43 -1
index 54f0fb4..84476be 100755
@@ -83,7 +83,7 @@ static unsigned int substates;
 static int (*choose_substate)(int);
 
 /* Reliable LAPIC Timer States, bit 1 for C1 etc.  */
-static unsigned int lapic_timer_reliable_states;
+static unsigned int lapic_timer_reliable_states = (1 << 1);	 /* Default to only C1 */
 
 static struct cpuidle_device *intel_idle_cpuidle_devices;
 static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state);
@@ -126,6 +126,42 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = {
 		.enter = &intel_idle },
 };
 
+static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = {
+	{ /* MWAIT C0 */ },
+	{ /* MWAIT C1 */
+		.name = "SNB-C1",
+		.desc = "MWAIT 0x00",
+		.driver_data = (void *) 0x00,
+		.flags = CPUIDLE_FLAG_TIME_VALID,
+		.exit_latency = 1,
+		.target_residency = 4,
+		.enter = &intel_idle },
+	{ /* MWAIT C2 */
+		.name = "SNB-C3",
+		.desc = "MWAIT 0x10",
+		.driver_data = (void *) 0x10,
+		.flags = CPUIDLE_FLAG_TIME_VALID,
+		.exit_latency = 80,
+		.target_residency = 160,
+		.enter = &intel_idle },
+	{ /* MWAIT C3 */
+		.name = "SNB-C6",
+		.desc = "MWAIT 0x20",
+		.driver_data = (void *) 0x20,
+		.flags = CPUIDLE_FLAG_TIME_VALID,
+		.exit_latency = 104,
+		.target_residency = 208,
+		.enter = &intel_idle },
+	{ /* MWAIT C4 */
+		.name = "SNB-C7",
+		.desc = "MWAIT 0x30",
+		.driver_data = (void *) 0x30,
+		.flags = CPUIDLE_FLAG_TIME_VALID,
+		.exit_latency = 109,
+		.target_residency = 300,
+		.enter = &intel_idle },
+};
+
 static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
 	{ /* MWAIT C0 */ },
 	{ /* MWAIT C1 */
@@ -312,6 +348,12 @@ static int intel_idle_probe(void)
 		cpuidle_state_table = atom_cstates;
 		choose_substate = choose_zero_substate;
 		break;
+
+	case 0x2A:	/* SNB */
+	case 0x2D:	/* SNB Xeon */
+		cpuidle_state_table = snb_cstates;
+		choose_substate = choose_zero_substate;
+		break;
 #ifdef FUTURE_USE
 	case 0x17:	/* 23 - Core 2 Duo */
 		lapic_timer_reliable_states = (1 << 2) | (1 << 1); /* C2, C1 */
Signature · 1 line
1.7.3.2.90.gd4c43
author reviewer
#5 lore raw

PATCH 5/5 intel_idle: do not use the LAPIC timer for ATOM C2

In reply to Len Brown

From: Len Brown <[email protected]>

If we use the LAPIC timer during ATOM C2 on
some nvidia chisets, the system stalls.

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

---
 drivers/idle/intel_idle.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/idle/intel_idle.c +1 -1
index d310590..b68d594 100644
@@ -302,7 +302,7 @@ static int intel_idle_probe(void)
 
 	case 0x1C:	/* 28 - Atom Processor */
 	case 0x26:	/* 38 - Lincroft Atom Processor */
-		lapic_timer_reliable_states = (1 << 2) | (1 << 1); /* C2, C1 */
+		lapic_timer_reliable_states = (1 << 1); /* C1 */
 		cpuidle_state_table = atom_cstates;
 		break;
 
Signature · 1 line
1.7.3.2.90.gd4c43
#6 lore raw

Re: [PATCH 5/5] intel_idle: do not use the LAPIC timer for ATOM C2

Quoted 8 lines · Len Brown

From: Len Brown <[email protected]>

If we use the LAPIC timer during ATOM C2 on
some nvidia chisets, the system stalls.

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

drivers/idle/intel_idle.c static int intel_idle_probe(void) · line 306

Quoted 6 lines
drivers/idle/intel_idle.c +1 -1
@@ -302,7 +302,7 @@ static int intel_idle_probe(void)
 
 	case 0x1C:	/* 28 - Atom Processor */
 	case 0x26:	/* 38 - Lincroft Atom Processor */
-		lapic_timer_reliable_states = (1 << 2) | (1 << 1); /* C2, C1 */
+		lapic_timer_reliable_states = (1 << 1); /* C1 */
 		cpuidle_state_table = atom_cstates;

That comment should probably go here, along with list of chipsets.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html