Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Dec 2012 12:07:42 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r244616 - stable/9/sys/dev/acpica
Message-ID:  <201212231207.qBNC7gAB088771@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Sun Dec 23 12:07:42 2012
New Revision: 244616
URL: http://svnweb.freebsd.org/changeset/base/244616

Log:
  MFC r243761: acpi_cpu_notify: disable acpi_cpu_idle while updating
  C-state data

Modified:
  stable/9/sys/dev/acpica/acpi_cpu.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/acpica/acpi_cpu.c
==============================================================================
--- stable/9/sys/dev/acpica/acpi_cpu.c	Sun Dec 23 12:06:12 2012	(r244615)
+++ stable/9/sys/dev/acpica/acpi_cpu.c	Sun Dec 23 12:07:42 2012	(r244616)
@@ -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);



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