Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jun 2010 19:14:39 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r209213 - head/sys/dev/acpica
Message-ID:  <201006151914.o5FJEdWT069074@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006151914.o5FJEdWT069074>