From e670629b6ab33961a09adc96858b7b8c31293321 Mon Sep 17 00:00:00 2001 From: avg Date: Sat, 1 Dec 2012 18:06:05 +0000 Subject: acpi_cpu_notify: disable acpi_cpu_idle while updating C-state data ... to avoid any races or inconsistencies. This should fix a regression introduced in r243404. Also, remove a stale comment that has not been true for quite a while now. Pointyhat to: avg Teested by: trociny, emaste, dumbbell (earlier version) MFC after: 1 week --- sys/dev/acpica/acpi_cpu.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'sys/dev/acpica') diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index 7e3a3e7..7f008f7 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -973,9 +973,9 @@ acpi_cpu_idle() return; } - /* If disabled, return immediately. */ + /* If disabled, take the safe path. */ if (is_idle_disabled(sc)) { - ACPI_ENABLE_IRQS(); + acpi_cpu_c1(); return; } @@ -1081,23 +1081,31 @@ acpi_cpu_idle() /* * Re-evaluate the _CST object when we are notified that it changed. - * - * XXX Re-evaluation disabled until locking is done. */ static void acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context) { struct acpi_cpu_softc *sc = (struct acpi_cpu_softc *)context; - + if (notify != ACPI_NOTIFY_CX_STATES) return; + /* + * C-state data for target CPU is going to be in flux while we execute + * acpi_cpu_cx_cst, so disable entering acpi_cpu_idle. + * Also, it may happen that multiple ACPI taskqueues may concurrently + * execute notifications for the same CPU. ACPI_SERIAL is used to + * protect against that. + */ + ACPI_SERIAL_BEGIN(cpu); + disable_idle(sc); + /* Update the list of Cx states. */ acpi_cpu_cx_cst(sc); acpi_cpu_cx_list(sc); - - ACPI_SERIAL_BEGIN(cpu); acpi_cpu_set_cx_lowest(sc); + + enable_idle(sc); ACPI_SERIAL_END(cpu); acpi_UserNotify("PROCESSOR", sc->cpu_handle, notify); -- cgit v1.1