Present Location: News >> Blog >> Eee CPU Frequency Scaling

Blog

> Eee CPU Frequency Scaling
Posted by prox, from North Brunswick, on November 29, 2008 at 20:48 local (server) time

Ok, I've been hung up on the Eee, lately.  The power management and CPU throttling seems to be a mystery to me, and I need to figure it out otherwise I'm likely to go insane!  Here's where I'm at:

On most laptops I've used, I'd typically load the appropriate CPUfreq module, and then use a combination of cpufreqd or cpufreq-set to throttle the clock speed on the CPU.  The Eee initially was no different.  The Celeron ULV apparently uses the p4-clockmod module (speedstep-centrino and acpi-cpufreq wouldn't load) and cpufreq-set worked as expected - or so I thought.

I first noticed the weirdness when I successfully played a 1080p MPEG-2 video stream on the Eee.  It played fine (I was pleasantly surprised).  However, when I tried to play it a day later, it was dropping frames all over the place, and MPlayer spat out the dreaded "your system is not fast enough to play this!" message.  Both times, the CPUfreq scaling governor was set to performance.  What gives?  I couldn't make heads or tails of it, initially.  Sometimes the video played, and sometimes it didn't.  I then realized it was directly related to whether I had the AC adapter connected upon resuming the Eee from sleep (suspend to RAM).

If the AC adapter connected before the Eee is resumed, it'll play the MPEG-2 stream without a hitch.  If I resume the Eee without the AC power connected, the video won't play smoothly.  It doesn't even matter if I plug in the AC adapter after the Eee is running, it won't make a difference.  Apparently there is some variable or power saving mode that is set upon a cold start or resume from sleep, and persists until the machine is suspended or turned off.

But, if the CPU was getting throttled somehow, shouldn't /proc/cpuinfo reflect the change in the "cpu MHz" line?  Nope, apparently not.  To make matters worse, there's the /proc/acpi/processor/CPU1/throttling knob, which apparently is separate from the p4-clockmod driver and the mysterious throttling that's set at resume - it doesn't change AT ALL.  I can, however, set it, and the CPU will go down to ~77MHz, but this isn't reflected in /proc/cpuinfo, either.  I don't even want to know what happens if I use the /proc/acpi/processor/CPU1/throttling knob in combination with the CPUfreq subsystem.  Eesh.

Anyway, I did some tests with bzip2 and a 32MiB test file, just to see how much the CPU is getting throttled by this unknown mechanism.  The first one below is when the Eee was resumed without the AC adapter connected:

(six:19:33)% cpufreq-info
cpufrequtils 004: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs to cpufreq@lists.linux.org.uk, please.
analyzing CPU 0:
  no or unknown cpufreq driver is active on this CPU
(six:19:34)% cat /proc/acpi/processor/CPU1/throttling
state count:             8
active state:            T0
state available: T0 to T7
states:
   *T0:                  100%
    T1:                  87%
    T2:                  75%
    T3:                  62%
    T4:                  50%
    T5:                  37%
    T6:                  25%
    T7:                  12%
(six:19:34)% cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 13
model name      : Intel(R) Celeron(R) M processor          900MHz
stepping        : 8
cpu MHz         : 900.117
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca \
cmov pat clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx up bts
bogomips        : 1802.47
clflush size    : 64
power management:

(six:19:35)% time bunzip2 -t 32MiB.bin.bz2
bunzip2 -t 32MiB.bin.bz2  19.90s user 0.12s system 99% cpu 20.022 total
(six:19:36)% sudo modprobe p4-clockmod
(six:19:36)% sudo cpufreq-set -g performance
(six:19:37)% cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 13
model name      : Intel(R) Celeron(R) M processor          900MHz
stepping        : 8
cpu MHz         : 900.000
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca \
cmov pat clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx up bts
bogomips        : 1802.47
clflush size    : 64
power management:

(six:19:37)% cat /proc/acpi/processor/CPU1/throttling
state count:             8
active state:            T0
state available: T0 to T7
states:
   *T0:                  100%
    T1:                  87%
    T2:                  75%
    T3:                  62%
    T4:                  50%
    T5:                  37%
    T6:                  25%
    T7:                  12%
(six:19:37)% time bunzip2 -t 32MiB.bin.bz2
bunzip2 -t 32MiB.bin.bz2  19.94s user 0.08s system 100% cpu 20.018 total
(six:19:37)% sudo cpufreq-set -g powersave
(six:19:38)% cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 13
model name      : Intel(R) Celeron(R) M processor          900MHz
stepping        : 8
cpu MHz         : 112.500
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca \
cmov pat clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx up bts
bogomips        : 1802.47
clflush size    : 64
power management:

(six:19:38)% cat /proc/acpi/processor/CPU1/throttling
state count:             8
active state:            T0
state available: T0 to T7
states:
   *T0:                  100%
    T1:                  87%
    T2:                  75%
    T3:                  62%
    T4:                  50%
    T5:                  37%
    T6:                  25%
    T7:                  12%
(six:19:38)% time bunzip2 -t 32MiB.bin.bz2
bunzip2 -t 32MiB.bin.bz2  117.82s user 1.47s system 99% cpu 1:59.88 total

Now, the SAME test with the AC adapter connected:

(six:19:44)% cpufreq-info
cpufrequtils 004: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs to cpufreq@lists.linux.org.uk, please.
analyzing CPU 0:
  no or unknown cpufreq driver is active on this CPU
(six:19:45)% cat /proc/acpi/processor/CPU1/throttling
state count:             8
active state:            T0
state available: T0 to T7
states:
   *T0:                  100%
    T1:                  87%
    T2:                  75%
    T3:                  62%
    T4:                  50%
    T5:                  37%
    T6:                  25%
    T7:                  12%
(six:19:46)% cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 13
model name      : Intel(R) Celeron(R) M processor          900MHz
stepping        : 8
cpu MHz         : 900.117
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca \
cmov pat clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx up bts
bogomips        : 1802.47
clflush size    : 64
power management:

(six:19:46)% time bunzip2 -t 32MiB.bin.bz2
bunzip2 -t 32MiB.bin.bz2  13.86s user 0.04s system 99% cpu 13.917 total
(six:19:47)% sudo modprobe p4-clockmod
(six:19:47)% sudo cpufreq-set -g performance
(six:19:47)% cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 13
model name      : Intel(R) Celeron(R) M processor          900MHz
stepping        : 8
cpu MHz         : 900.000
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca \
cmov pat clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx up bts
bogomips        : 1802.47
clflush size    : 64
power management:

(six:19:47)% cat /proc/acpi/processor/CPU1/throttling
state count:             8
active state:            T0
state available: T0 to T7
states:
   *T0:                  100%
    T1:                  87%
    T2:                  75%
    T3:                  62%
    T4:                  50%
    T5:                  37%
    T6:                  25%
    T7:                  12%
(six:19:48)% time bunzip2 -t 32MiB.bin.bz2
bunzip2 -t 32MiB.bin.bz2  13.84s user 0.05s system 99% cpu 13.897 total
(six:19:48)% sudo cpufreq-set -g powersave
(six:19:48)% cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 13
model name      : Intel(R) Celeron(R) M processor          900MHz
stepping        : 8
cpu MHz         : 112.500
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca \
cmov pat clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx up bts
bogomips        : 1802.47
clflush size    : 64
power management:

(six:19:49)% cat /proc/acpi/processor/CPU1/throttling
state count:             8
active state:            T0
state available: T0 to T7
states:
   *T0:                  100%
    T1:                  87%
    T2:                  75%
    T3:                  62%
    T4:                  50%
    T5:                  37%
    T6:                  25%
    T7:                  12%
(six:19:49)% time bunzip2 -t 32MiB.bin.bz2
bunzip2 -t 32MiB.bin.bz2  81.83s user 0.98s system 99% cpu 1:23.34 total

Ok, here's what we've got:

Judging from the numbers, it's throttling the CPU to about 70% of full-speed.  I Googled around a little bit, and it seems like this is expected behavior, but nobody has a solution on how to change this via software, or how the /proc/acpi/processor/CPU1/throttling stuff fits into the equation, either.  There's nothing in the BIOS that provides any clue…

Blarg.

> Add Comment

New comments are currently disabled for this entry.