Skip to contentSkip to conversation

cpuidle: makes AMD C1E works in suspend/resume path

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

lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

PATCH 2/2 cpuidle: makes AMD C1E works in suspend/resume path

When AMD C1E is enabled, local APIC timer will stop even in C1. To avoid suspend/resume hang, this patch removes C1 and replace it with a cpu_relax() in suspend/resume path. This hasn't any impact in runtime path.

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

[ impact: avoid suspend/resume hang in AMD CPU with C1E enabled ]

---
 drivers/acpi/processor_idle.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/processor_idle.c +1 -1
Index: linux/drivers/acpi/processor_idle.c
===================================================================
@@ -834,8 +834,8 @@ static int acpi_idle_enter_c1(struct cpu
 
 	/* Do not access any ACPI IO ports in suspend path */
 	if (acpi_idle_suspend) {
-		acpi_safe_halt();
 		local_irq_enable();
+		cpu_relax();
 		return 0;
 	}
 
#1 lore raw
Quoted 19 lines · Shaohua Li

When AMD C1E is enabled, local APIC timer will stop even in C1. To avoid suspend/resume hang, this patch removes C1 and replace it with a cpu_relax() in suspend/resume path. This hasn't any impact in runtime path.

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

[ impact: avoid suspend/resume hang in AMD CPU with C1E enabled ]

---
 drivers/acpi/processor_idle.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/drivers/acpi/processor_idle.c
===================================================================

drivers/acpi/processor_idle.c static int acpi_idle_enter_c1(struct cpu · line 840

Quoted 8 lines
drivers/acpi/processor_idle.c +1 -1
@@ -834,8 +834,8 @@ static int acpi_idle_enter_c1(struct cpu
 
 	/* Do not access any ACPI IO ports in suspend path */
 	if (acpi_idle_suspend) {
-		acpi_safe_halt();
 		local_irq_enable();
+		cpu_relax();
 		return 0;
 	}

Hmm, we removed the pm_idle_safe logic which took care of that in older kernel versions :(

        if (!cx || acpi_idle_suspend) {
                if (pm_idle_save)
                        pm_idle_save();
                else
                        acpi_safe_halt();
                return;
        }

That's what took care of the broadcast on those AMD C1E machines as well.

But yeah, that cpu_relax() loop is probably fine for the suspend path.

Thanks,

tglx