Linux ACPI
 help / color / mirror / Atom feed
* [PATCH] ACPI: Idle C-states disabled by max_cstate should not disable the TSC
       [not found]             ` <alpine.LFD.2.00.0905141750100.24833@localhost.localdomain>
@ 2009-05-15  5:40               ` Len Brown
  2009-05-15  6:18                 ` [PATCH] ACPI: idle: rename lapic timer workaround routines Len Brown
  2009-05-15  8:27                 ` [PATCH] ACPI: Idle C-states disabled by max_cstate should not disable the TSC Thomas Gleixner
  0 siblings, 2 replies; 4+ messages in thread
From: Len Brown @ 2009-05-15  5:40 UTC (permalink / raw)
  To: Venkatesh Pallipadi
  Cc: Thomas Gleixner, Janne Kulmala, Frans Pop,
	Linux Kernel Mailing List, Steven Rostedt, Ingo Molnar, johnstul,
	linux-acpi

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

Processor idle power states C2 and C3 stop the TSC on many machines.
Linux recognizes this situation and marks the TSC as unstable:

Marking TSC unstable due to TSC halts in idle

But if those same machines are booted with "processor.max_cstate=1",
then there is no need to validate C2 and C3, and no need to
disable the TSC, which can be reliably used as a clocksource.

Signed-off-by: Len Brown <len.brown@intel.com>
---
 drivers/acpi/processor_idle.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index e39a40a..e65476f 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -582,7 +582,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
 
 	pr->power.timer_broadcast_on_state = INT_MAX;
 
-	for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
+	for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
 		struct acpi_processor_cx *cx = &pr->power.states[i];
 
 		switch (cx->type) {
-- 
1.6.3.1.9.g95405b


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ACPI: idle: rename lapic timer workaround routines
  2009-05-15  5:40               ` [PATCH] ACPI: Idle C-states disabled by max_cstate should not disable the TSC Len Brown
@ 2009-05-15  6:18                 ` Len Brown
  2009-05-15  8:28                   ` Thomas Gleixner
  2009-05-15  8:27                 ` [PATCH] ACPI: Idle C-states disabled by max_cstate should not disable the TSC Thomas Gleixner
  1 sibling, 1 reply; 4+ messages in thread
From: Len Brown @ 2009-05-15  6:18 UTC (permalink / raw)
  To: Venkatesh Pallipadi
  Cc: Thomas Gleixner, Janne Kulmala, Frans Pop,
	Linux Kernel Mailing List, Steven Rostedt, Ingo Molnar, johnstul,
	linux-acpi

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

cosmetic only.  The lapic_timer workaround routines
are specific to the lapic_timer, and are not acpi-generic.

old:

acpi_timer_check_state()
acpi_propagate_timer_broadcast()
acpi_state_timer_broadcast()

new:

lapic_timer_check_state()
lapic_timer_propagate_broadcast()
lapic_timer_state_broadcast()

also, simplify the code in acpi_processor_power_verify()
so that lapic_timer_check_state() is simply called
from one place for all valid C-states, including C1.

Signed-off-by: Len Brown <len.brown@intel.com>
---
 drivers/acpi/processor_idle.c |   35 ++++++++++++++++-------------------
 1 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index e65476f..60c3bcd 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -139,7 +139,7 @@ static void acpi_safe_halt(void)
  * are affected too. We pick the most conservative approach: we assume
  * that the local APIC stops in both C2 and C3.
  */
-static void acpi_timer_check_state(int state, struct acpi_processor *pr,
+static void lapic_timer_check_state(int state, struct acpi_processor *pr,
 				   struct acpi_processor_cx *cx)
 {
 	struct acpi_processor_power *pwr = &pr->power;
@@ -159,7 +159,7 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr,
 		pr->power.timer_broadcast_on_state = state;
 }
 
-static void acpi_propagate_timer_broadcast(struct acpi_processor *pr)
+static void lapic_timer_propagate_broadcast(struct acpi_processor *pr)
 {
 	unsigned long reason;
 
@@ -170,7 +170,7 @@ static void acpi_propagate_timer_broadcast(struct acpi_processor *pr)
 }
 
 /* Power(C) State timer broadcast control */
-static void acpi_state_timer_broadcast(struct acpi_processor *pr,
+static void lapic_timer_state_broadcast(struct acpi_processor *pr,
 				       struct acpi_processor_cx *cx,
 				       int broadcast)
 {
@@ -187,10 +187,10 @@ static void acpi_state_timer_broadcast(struct acpi_processor *pr,
 
 #else
 
-static void acpi_timer_check_state(int state, struct acpi_processor *pr,
+static void lapic_timer_check_state(int state, struct acpi_processor *pr,
 				   struct acpi_processor_cx *cstate) { }
-static void acpi_propagate_timer_broadcast(struct acpi_processor *pr) { }
-static void acpi_state_timer_broadcast(struct acpi_processor *pr,
+static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) { }
+static void lapic_timer_state_broadcast(struct acpi_processor *pr,
 				       struct acpi_processor_cx *cx,
 				       int broadcast)
 {
@@ -592,24 +592,21 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
 
 		case ACPI_STATE_C2:
 			acpi_processor_power_verify_c2(cx);
-			if (cx->valid)
-				acpi_timer_check_state(i, pr, cx);
 			break;
 
 		case ACPI_STATE_C3:
 			acpi_processor_power_verify_c3(pr, cx);
-			if (cx->valid)
-				acpi_timer_check_state(i, pr, cx);
 			break;
 		}
-		if (cx->valid)
-			tsc_check_state(cx->type);
+		if (!cx->valid)
+			continue;
 
-		if (cx->valid)
-			working++;
+		lapic_timer_check_state(i, pr, cx);
+		tsc_check_state(cx->type);
+		working++;
 	}
 
-	acpi_propagate_timer_broadcast(pr);
+	lapic_timer_propagate_broadcast(pr);
 
 	return (working);
 }
@@ -863,7 +860,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
 	 * Must be done before busmaster disable as we might need to
 	 * access HPET !
 	 */
-	acpi_state_timer_broadcast(pr, cx, 1);
+	lapic_timer_state_broadcast(pr, cx, 1);
 
 	if (cx->type == ACPI_STATE_C3)
 		ACPI_FLUSH_CPU_CACHE();
@@ -885,7 +882,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
 
 	cx->usage++;
 
-	acpi_state_timer_broadcast(pr, cx, 0);
+	lapic_timer_state_broadcast(pr, cx, 0);
 	cx->time += sleep_ticks;
 	return idle_time;
 }
@@ -952,7 +949,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
 	 * Must be done before busmaster disable as we might need to
 	 * access HPET !
 	 */
-	acpi_state_timer_broadcast(pr, cx, 1);
+	lapic_timer_state_broadcast(pr, cx, 1);
 
 	kt1 = ktime_get_real();
 	/*
@@ -997,7 +994,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
 
 	cx->usage++;
 
-	acpi_state_timer_broadcast(pr, cx, 0);
+	lapic_timer_state_broadcast(pr, cx, 0);
 	cx->time += sleep_ticks;
 	return idle_time;
 }
-- 
1.6.3.1.9.g95405b



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI: Idle C-states disabled by max_cstate should not disable the TSC
  2009-05-15  5:40               ` [PATCH] ACPI: Idle C-states disabled by max_cstate should not disable the TSC Len Brown
  2009-05-15  6:18                 ` [PATCH] ACPI: idle: rename lapic timer workaround routines Len Brown
@ 2009-05-15  8:27                 ` Thomas Gleixner
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2009-05-15  8:27 UTC (permalink / raw)
  To: Len Brown
  Cc: Venkatesh Pallipadi, Janne Kulmala, Frans Pop,
	Linux Kernel Mailing List, Steven Rostedt, Ingo Molnar, johnstul,
	linux-acpi

On Fri, 15 May 2009, Len Brown wrote:

> From: Len Brown <len.brown@intel.com>
> 
> Processor idle power states C2 and C3 stop the TSC on many machines.
> Linux recognizes this situation and marks the TSC as unstable:
> 
> Marking TSC unstable due to TSC halts in idle
> 
> But if those same machines are booted with "processor.max_cstate=1",
> then there is no need to validate C2 and C3, and no need to
> disable the TSC, which can be reliably used as a clocksource.
> 
> Signed-off-by: Len Brown <len.brown@intel.com>

Acked-by: Thomas Gleixner <tglx@linutronix.de>

> ---
>  drivers/acpi/processor_idle.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index e39a40a..e65476f 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -582,7 +582,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
>  
>  	pr->power.timer_broadcast_on_state = INT_MAX;
>  
> -	for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
> +	for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
>  		struct acpi_processor_cx *cx = &pr->power.states[i];
>  
>  		switch (cx->type) {
> -- 
> 1.6.3.1.9.g95405b
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI: idle: rename lapic timer workaround routines
  2009-05-15  6:18                 ` [PATCH] ACPI: idle: rename lapic timer workaround routines Len Brown
@ 2009-05-15  8:28                   ` Thomas Gleixner
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2009-05-15  8:28 UTC (permalink / raw)
  To: Len Brown
  Cc: Venkatesh Pallipadi, Janne Kulmala, Frans Pop,
	Linux Kernel Mailing List, Steven Rostedt, Ingo Molnar, johnstul,
	linux-acpi

On Fri, 15 May 2009, Len Brown wrote:

> From: Len Brown <len.brown@intel.com>
> 
> cosmetic only.  The lapic_timer workaround routines
> are specific to the lapic_timer, and are not acpi-generic.
> 
> old:
> 
> acpi_timer_check_state()
> acpi_propagate_timer_broadcast()
> acpi_state_timer_broadcast()
> 
> new:
> 
> lapic_timer_check_state()
> lapic_timer_propagate_broadcast()
> lapic_timer_state_broadcast()
> 
> also, simplify the code in acpi_processor_power_verify()
> so that lapic_timer_check_state() is simply called
> from one place for all valid C-states, including C1.
> 
> Signed-off-by: Len Brown <len.brown@intel.com>

Acked-by: Thomas Gleixner <tglx@linutronix.de>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-05-15  8:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <alpine.DEB.2.00.0905072359530.28378@gandalf.stny.rr.com>
     [not found] ` <200905110226.50115.elendil@planet.nl>
     [not found]   ` <alpine.LFD.2.00.0905111614570.3561@localhost.localdomain>
     [not found]     ` <4A0855A5.8040109@tut.fi>
     [not found]       ` <alpine.LFD.2.00.0905141545280.24833@localhost.localdomain>
     [not found]         ` <alpine.LFD.2.00.0905141608070.24833@localhost.localdomain>
     [not found]           ` <alpine.LFD.2.00.0905142217340.3561@localhost.localdomain>
     [not found]             ` <alpine.LFD.2.00.0905141750100.24833@localhost.localdomain>
2009-05-15  5:40               ` [PATCH] ACPI: Idle C-states disabled by max_cstate should not disable the TSC Len Brown
2009-05-15  6:18                 ` [PATCH] ACPI: idle: rename lapic timer workaround routines Len Brown
2009-05-15  8:28                   ` Thomas Gleixner
2009-05-15  8:27                 ` [PATCH] ACPI: Idle C-states disabled by max_cstate should not disable the TSC Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox