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
This commit is contained in:
jhb 2010-06-15 19:14:39 +00:00
parent 3e2692fd42
commit e645e40d6b

View File

@ -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);