From owner-freebsd-acpi@FreeBSD.ORG Tue Sep 11 06:36:30 2012 Return-Path: Delivered-To: freebsd-acpi@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66D22106566C for ; Tue, 11 Sep 2012 06:36:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id B74938FC12 for ; Tue, 11 Sep 2012 06:36:29 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id JAA18910 for ; Tue, 11 Sep 2012 09:36:28 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1TBK5D-00020c-VQ for freebsd-acpi@FreeBSD.org; Tue, 11 Sep 2012 09:36:27 +0300 Message-ID: <504EDBEB.6010104@FreeBSD.org> Date: Tue, 11 Sep 2012 09:36:27 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:15.0) Gecko/20120901 Thunderbird/15.0 MIME-Version: 1.0 To: "freebsd-acpi@freebsd.org" X-Enigmail-Version: 1.4.3 Content-Type: text/plain; charset=X-VIET-VPS Content-Transfer-Encoding: 7bit Cc: Subject: notify userland about C-state changes X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Sep 2012 06:36:30 -0000 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