Author: jhb
Date: Tue Jun 15 19:14:39 2010
New Revision: 209213
URL: http://svn.freebsd.org/changeset/base/209213

Log:
  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

Modified:
  head/sys/dev/acpica/acpi_cpu.c

Modified: head/sys/dev/acpica/acpi_cpu.c
==============================================================================
--- head/sys/dev/acpica/acpi_cpu.c      Tue Jun 15 18:51:41 2010        
(r209212)
+++ head/sys/dev/acpica/acpi_cpu.c      Tue Jun 15 19:14:39 2010        
(r209213)
@@ -1007,6 +1007,8 @@ acpi_cpu_notify(ACPI_HANDLE h, UINT32 no
        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_
     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);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to