summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2012-12-01 18:06:05 +0000
committeravg <avg@FreeBSD.org>2012-12-01 18:06:05 +0000
commite670629b6ab33961a09adc96858b7b8c31293321 (patch)
treeff095c85e89b791f3f8a61f33bbcf58eb51098e5 /sys/dev/acpica
parent2574e6f8e5a133710a74d74c7a1167b12fa38cfd (diff)
downloadFreeBSD-src-e670629b6ab33961a09adc96858b7b8c31293321.zip
FreeBSD-src-e670629b6ab33961a09adc96858b7b8c31293321.tar.gz
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
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r--sys/dev/acpica/acpi_cpu.c22
1 files changed, 15 insertions, 7 deletions
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);
OpenPOWER on IntegriCloud