Enhanced SpeedStep and thermal monitoring with NetBSD

So there is my new laptop boasting a 2.4GHz dual processor
CPU. NetBSD is installed and it’s time to build all the packages
from pkgsrc that I regularly use. Finding myself compiling several
large packages in parallel, I know I want all the speed the CPU can
offer, but maybe it could run too hot in the build. Particularly,
since I do not like air-con…

With NetBSD I set up sysutils/estd to monitor the ratio between load
and idle states the OS records. Seting high- and low-water marks one
can control the load above or below which to switch to the next higher
or lower CPU frequency, respectively.

That takes care of using the speed available, but doesn’t take care of
limiting the temperature.

To this end I configure envsys(4) by putting into /etc/envsys.conf:

coretemp0 {
        sensor0 {
                critical-max = 65C;
        }
}
coretemp1 {
        sensor0 {
                critical-max = 65C;
        }
}

The configuration is activated by issuing

envstat -c /etc/envsys.conf

Now the envsys sytem will trigger critical events whenever the
temperature of one of these sensors goes above 65C. Such an event
results in executing the script /etc/powerd/sensor_temperarture.

In this script I put:

       .
       .
       .
case "${2}" in
normal)
        case "${1}" in
        coretemp*)
                echo "estd_flags=\"-l 40 -h 70 -b\"" >/etc/rc.conf.d/estd
                /etc/rc.d/estd restart
                ;;
        esac
        exit 0
        ;;
       .
       .
       .
critical-over)
        case "${1}" in
        coretemp*)
                /etc/rc.d/estd stop
                sysctl -w machdep.est.frequency.target=600
                ;;
        esac
        exit 0
        ;;
       .
       .
       .

It works nicely: the temperature sensor goes above 65C, the envsys
triggers a critical-over event, the script stops estd and sets the
frequency to the lowest possible value on this CPU. Under heavy load
it stays there long enough for the sensors to go down to about
52C-55C, before the normal event is triggered, estd is restarted and
the heat rises again…

Advertisements

2 Responses to “Enhanced SpeedStep and thermal monitoring with NetBSD”


  1. 1 wayne fowler November 19, 2008 at 12:43 pm

    i try issuing the envstat -c command above in netbsd4.0 and it states not a valid flag any suggestions?
    thanks wayne

  2. 2 markoschuetz November 19, 2008 at 9:08 pm

    I use this on NetBSD 4.99.72. I have not used prior versions of envstat, but a quick check in CVS of the revisions that envstat.c went through seems to indicate that it operated in a quite different way back then. You’ll have to dig through the man page and/or source code…

    HTH


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





%d bloggers like this: