Skip to contentSkip to conversation

cpuidle: makes AMD C1E works in acpi_idle

PATCH Applied Shaohua Li 3 participants 5 messages May 19, 2009 – May 27, 2009 ACPI

lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

PATCH 1/2 cpuidle: makes AMD C1E works in acpi_idle

When AMD C1E is enabled, local APIC timer will stop even in C1. This patch uses broadcast ipi to replace local APIC timer in C1.

http://bugzilla.kernel.org/show_bug.cgi?id=13233

[ impact: avoid boot hang in AMD CPU with C1E enabled ]

---
 drivers/acpi/processor_idle.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/acpi/processor_idle.c +6 -0
Index: linux/drivers/acpi/processor_idle.c
===================================================================
@@ -148,6 +148,9 @@ static void acpi_timer_check_state(int s
 	if (cpu_has(&cpu_data(pr->id), X86_FEATURE_ARAT))
 		return;
 
+	if (boot_cpu_has(X86_FEATURE_AMDC1E))
+		type = ACPI_STATE_C1;
+
 	/*
 	 * Check, if one of the previous states already marked the lapic
 	 * unstable
@@ -611,6 +614,7 @@ static int acpi_processor_power_verify(s
 		switch (cx->type) {
 		case ACPI_STATE_C1:
 			cx->valid = 1;
+			acpi_timer_check_state(i, pr, cx);
 			break;
 
 		case ACPI_STATE_C2:
@@ -835,6 +839,7 @@ static int acpi_idle_enter_c1(struct cpu
 		return 0;
 	}
 
+	acpi_state_timer_broadcast(pr, cx, 1);
 	kt1 = ktime_get_real();
 	acpi_idle_do_entry(cx);
 	kt2 = ktime_get_real();
@@ -842,6 +847,7 @@ static int acpi_idle_enter_c1(struct cpu
 
 	local_irq_enable();
 	cx->usage++;
+	acpi_state_timer_broadcast(pr, cx, 0);
 
 	return idle_time;
 }
#1 lore raw
Quoted 4 lines · Shaohua Li

When AMD C1E is enabled, local APIC timer will stop even in C1. This patch uses broadcast ipi to replace local APIC timer in C1.

http://bugzilla.kernel.org/show_bug.cgi?id=13233

Hmm. This was addressed before in

commit a8d6829044901a67732904be5f1eacdf8539604f (x86: prevent C-states hang on AMD C1E enabled machines)

We limit C-States to 1 via acpi_processor_cstate_check().

And we have the broadcast logic in c1e_idle() already. We also select c1e_idle as the idle routine, so why is the ACPI code not using this. ?

Thanks,

tglx

author
#2 lore raw
Quoted 9 lines · Thomas Gleixner
Quoted 4 lines · Shaohua Li

When AMD C1E is enabled, local APIC timer will stop even in C1. This patch uses broadcast ipi to replace local APIC timer in C1.

http://bugzilla.kernel.org/show_bug.cgi?id=13233

Hmm. This was addressed before in

Quoted 7 lines

commit a8d6829044901a67732904be5f1eacdf8539604f (x86: prevent C-states hang on AMD C1E enabled machines)

We limit C-States to 1 via acpi_processor_cstate_check().

And we have the broadcast logic in c1e_idle() already. We also select c1e_idle as the idle routine, so why is the ACPI code not using this. ?

We used to call pm_idle_save() for C1, which will call c1e_idle. But this is removed, guess the reason is we want to do C1 enter per the information gotten from BIOS. So this bug is a regression actually. The patch follows the logic of c1e_idle().

Thanks,
Shaohua

#3 lore raw
Quoted 15 lines · Shaohua Li
Quoted 14 lines · Thomas Gleixner
Quoted 4 lines · Shaohua Li

When AMD C1E is enabled, local APIC timer will stop even in C1. This patch uses broadcast ipi to replace local APIC timer in C1.

http://bugzilla.kernel.org/show_bug.cgi?id=13233

Hmm. This was addressed before in

commit a8d6829044901a67732904be5f1eacdf8539604f (x86: prevent C-states hang on AMD C1E enabled machines)

We limit C-States to 1 via acpi_processor_cstate_check().

Quoted 7 lines
Quoted 2 lines

And we have the broadcast logic in c1e_idle() already. We also select c1e_idle as the idle routine, so why is the ACPI code not using this. ?

We used to call pm_idle_save() for C1, which will call c1e_idle. But this is removed, guess the reason is we want to do C1 enter per the information gotten from BIOS. So this bug is a regression actually. The patch follows the logic of c1e_idle().

Hmm, ok. As long as the code does not undo something which was already set up in c1e_idle() I have no objections.

Thanks,

tglx