Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Aug 2005 14:42:00 +0900
From:      Hajimu UMEMOTO <ume@freebsd.org>
To:        Nate Lawson <nate@root.org>
Cc:        acpi@freebsd.org
Subject:   Re: Annoyances with passive thermal code (acpi_thermal)
Message-ID:  <yge8xz28ml3.wl%ume@mahoroba.org>
In-Reply-To: <43013C90.7040901@root.org>
References:  <20050814023842.C0D845D07@ptavv.es.net> <ygezmrk2van.wl%ume@mahoroba.org> <ygeoe7zacqg.wl%ume@mahoroba.org> <4300C5DF.40409@root.org> <ygek6in5e4t.wl%ume@mahoroba.org> <ygeacjj81bw.wl%ume@mahoroba.org> <43013C90.7040901@root.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

>>>>> On Mon, 15 Aug 2005 18:08:32 -0700
>>>>> Nate Lawson <nate@root.org> said:

nate> The original intention was that we would save a stack of values and that 
nate> a CPUFREQ_SET(NULL, prio) would restore the last setting for the 
nate> priority before "prio".

nate> Example:
nate> freq = 1000 Mhz
nate> CPUFREQ_SET(1200, PRIO_USER)  -- saves 1000 Mhz @PRIO_LOWEST
nate> freq = 1200
nate> CPUFREQ_SET(1800, PRIO_LOWEST) -- EPERM since prio too low
nate> freq = 1200
nate> CPUFREQ_SET(1700, PRIO_KERN)  -- saves 1200 Mhz @PRIO_USER
nate> freq = 1700
nate> CPUFREQ_SET(1900, PRIO_KERN)  -- no saves since prio same as before
nate> freq = 1900
nate> CPUFREQ_SET(NULL, PRIO_KERN)  -- restores 1200 Mhz @PRIO_USER
nate> freq = 1200
nate> CPUFREQ_SET(NULL, PRIO_USER)  -- restores 1000 Mhz @PRIO_LOWEST
nate> freq = 1000

nate> Implementing this as a simple array would make sense.  Would you be 
nate> willing to do this?  If not, your patch should be fine for now.

No, I need to save a cpu level only when raising prio to PRIO_KERN
from lower prio.  But, I realized that my privious patch was
insufficient.  If dev.cpu.0.freq was not set by sysctl(8), cpu level
was never saved.

Index: sys/kern/kern_cpu.c
diff -u -p sys/kern/kern_cpu.c.orig sys/kern/kern_cpu.c
--- sys/kern/kern_cpu.c.orig	Mon Apr 11 04:11:23 2005
+++ sys/kern/kern_cpu.c	Tue Aug 16 14:22:10 2005
@@ -336,7 +336,7 @@ cf_set_method(device_t dev, const struct
 	 */
 	if (sc->curr_level.total_set.freq != CPUFREQ_VAL_UNKNOWN &&
 	    sc->saved_level.total_set.freq == CPUFREQ_VAL_UNKNOWN &&
-	    priority > sc->curr_priority) {
+	    priority > CPUFREQ_PRIO_USER && priority > sc->curr_priority) {
 		CF_DEBUG("saving level, freq %d prio %d\n",
 		    sc->curr_level.total_set.freq, sc->curr_priority);
 		sc->saved_level = sc->curr_level;

In anyway, we should make this as stack some day.

Sincerely,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@mahoroba.org  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?yge8xz28ml3.wl%ume>