notify userland about C-state changes

Andriy Gapon avg at FreeBSD.org
Tue Sep 11 06:36:30 UTC 2012


What do you think about an idea of notifying userland about C-state changes when
(after) they actually happen?
As you know, currently power management scripts are invoked on an AC line state
change notification, which is not exactly the same thing.
It may make sense to notify abut each CPU individually and the perhaps do
another notification when all CPUs are transitioned.

The following patch adds only per-CPU notifications.

    acpi_cpu: explicitly notify userland about c-state changes

diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index 82e204a..15201f9 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -1054,6 +1054,8 @@ acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context)
     ACPI_SERIAL_BEGIN(cpu);
     acpi_cpu_set_cx_lowest(sc);
     ACPI_SERIAL_END(cpu);
+
+    acpi_UserNotify("PROCESSOR", sc->cpu_handle, notify);
 }

 static int

-- 
Andriy Gapon


More information about the freebsd-acpi mailing list