diff options
author | jhb <jhb@FreeBSD.org> | 2010-06-15 19:14:39 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2010-06-15 19:14:39 +0000 |
commit | e645e40d6ba94b46f2d3e4191a81d1da090294a5 (patch) | |
tree | f22312854e6506d523e7ae8b6548db419ac2e72a /sys/dev | |
parent | 3e2692fd422754febd92a4d1613d4c2d454b8adc (diff) | |
download | FreeBSD-src-e645e40d6ba94b46f2d3e4191a81d1da090294a5.zip FreeBSD-src-e645e40d6ba94b46f2d3e4191a81d1da090294a5.tar.gz |
When updating individual CPU's lowest Cx state to use, never set it to a
state lower than the lowest one supported by the current CPU. This closes
some races with changes to the hw.acpi.cpu_cx_lowest sysctl while Cx
states for individual CPUs were changing (e.g. unplugging the AC adapter
of a laptop) that could result in panics.
Submitted by: Giovanni Trematerra
Tested by: David Demelier demelier dot david of gmail
MFC after: 3 days
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/acpica/acpi_cpu.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index d8cc17e..043f0c0 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -1007,6 +1007,8 @@ acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context) if (isc->cpu_cx_count > cpu_cx_count) cpu_cx_count = isc->cpu_cx_count; } + if (sc->cpu_cx_lowest < cpu_cx_lowest) + acpi_cpu_set_cx_lowest(sc, min(cpu_cx_lowest, sc->cpu_cx_count - 1)); ACPI_SERIAL_END(cpu); } @@ -1202,7 +1204,7 @@ acpi_cpu_global_cx_lowest_sysctl(SYSCTL_HANDLER_ARGS) ACPI_SERIAL_BEGIN(cpu); for (i = 0; i < cpu_ndevices; i++) { sc = device_get_softc(cpu_devices[i]); - acpi_cpu_set_cx_lowest(sc, val); + acpi_cpu_set_cx_lowest(sc, min(val, sc->cpu_cx_count - 1)); } ACPI_SERIAL_END(cpu); |