From owner-freebsd-bugs@FreeBSD.ORG Mon Jun 18 09:50:09 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5176516A468 for ; Mon, 18 Jun 2007 09:50:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 3398013C44C for ; Mon, 18 Jun 2007 09:50:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l5I9o9Ee009951 for ; Mon, 18 Jun 2007 09:50:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l5I9o9hV009950; Mon, 18 Jun 2007 09:50:09 GMT (envelope-from gnats) Resent-Date: Mon, 18 Jun 2007 09:50:09 GMT Resent-Message-Id: <200706180950.l5I9o9hV009950@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Simun Mikecin Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 15E8816A468 for ; Mon, 18 Jun 2007 09:46:38 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [69.147.83.33]) by mx1.freebsd.org (Postfix) with ESMTP id 0745513C468 for ; Mon, 18 Jun 2007 09:46:38 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l5I9kbTY061407 for ; Mon, 18 Jun 2007 09:46:37 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id l5I9kbYH061405; Mon, 18 Jun 2007 09:46:37 GMT (envelope-from nobody) Message-Id: <200706180946.l5I9kbYH061405@www.freebsd.org> Date: Mon, 18 Jun 2007 09:46:37 GMT From: Simun Mikecin To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: bin/113813: [fix] terminating powerd should restore max CPU frequency X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2007 09:50:09 -0000 >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: