Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jun 2007 09:46:37 GMT
From:      Simun Mikecin <numisemis@yahoo.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/113813: [fix] terminating powerd should restore max CPU frequency
Message-ID:  <200706180946.l5I9kbYH061405@www.freebsd.org>
Resent-Message-ID: <200706180950.l5I9o9hV009950@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         113813
>Category:       bin
>Synopsis:       [fix] terminating powerd should restore max CPU frequency
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 18 09:50:08 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Simun Mikecin
>Release:        6.2-RELEASE i386
>Organization:
>Environment:
FreeBSD plasma.logos.hr 6.2-RELEASE-p2 FreeBSD 6.2-RELEASE-p2 #0: Mon Mar  5 10:23:07 CET 2007     root@plasma.logos.hr:/usr/obj/usr/src.6.2/sys/PLASMA  i386

>Description:
If just booted, before starting powerd daemon CPU frequency should be setup to the maximum possible value. Terminating (for example, by sending it a SIGTERM signal) powerd daemon should restore that frequency.
Currently it does not do that. It leaves the frequency as it was. Which depends on the configuration of powerd (power source, etc.) and of the CPU load in the time it was terminating.

As I can see, /etc/rc.d/powerd script already has powerd_poststop() which should restore the frequency.
Unfortunatelly, in some situations it doesn't work, since powerd can be stopped without running /etc/rc.d/powerd script, but by sending a signal directly to the powerd daemon.


>How-To-Repeat:
You are running multiuser with powerd which dropped the CPU frequency. As root you want to go single-user for whatever reason that is ('make installworld' is one of them), so you run 'shutdown now' as root.
powerd daemon will get terminated, but the CPU frequency will stay low.
If I try to run 'make installworld;, it would run noticeably slower since the CPU frequency is down, and can be restored only if I manually run sysctl to set it back to the maximum.

>Fix:


Patch attached with submission follows:

--- usr.sbin/powerd/powerd.c.orig	Sun Jan 15 18:50:37 2006
+++ usr.sbin/powerd/powerd.c	Mon Jun 18 11:27:56 2007
@@ -494,6 +494,7 @@
 				    freqs[i]);
 		}
 	}
+	set_freq(freqs[0]);
 	free(freqs);
 	free(mwatts);
 	if (!vflag)


>Release-Note:
>Audit-Trail:
>Unformatted:



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