Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Dec 2012 12:07:53 +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-8@freebsd.org
Subject:   svn commit: r244617 - stable/8/sys/dev/acpica
Message-ID:  <201212231207.qBNC7rPm088836@svn.freebsd.org>

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

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

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

Modified: stable/8/sys/dev/acpica/acpi_cpu.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi_cpu.c	Sun Dec 23 12:07:42 2012	(r244616)
+++ stable/8/sys/dev/acpica/acpi_cpu.c	Sun Dec 23 12:07:52 2012	(r244617)
@@ -964,9 +964,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;
     }
 
@@ -1067,23 +1067,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.qBNC7rPm088836>