ondemand cpufreq governor broken on core 2 duo cpu

Bug #475706 reported by Dawid Ciężarkiewicz
44
This bug affects 8 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Won't Fix
Medium
Unassigned

Bug Description

I've installed fresh 9.10 and I'm with the defaults. This is how I've noticed the following behaviour and I want to share it.

As I have two cores - I've setup two cpufreq scaling monitors applets. By default my idle system is working on 1.00Ghz on both CPUs (cores to be precise).

In one console I do:
while :; do echo -n "" ; done

htop shows that CPU1 goes 100% and CPU1 scaling monitor shows that CPU1 goes 1.8Ghz (max) right away.

So I open another console and do:
while :; do echo -n "" ; done

but CPU0 goes 100% but CPU0 scalling monitor show that CPU0 is only at 1.33Ghz and this is not changing through time.

Now comes the funny part.

I press the Ctrl+c in one of the consoles and now both CPUs go 1.00Ghz while CPU0 is working 100% and the other almost idle !

I've recreated this behaviour few times (100% reproduction rate).

This behaviour is not visible when both CPUs use i.e. conservative cpufreq. I have no idea behind the logic ondeman cpufreq gov. is being driven, but for me ubuntu always had a problems with it.

The other thing is this - when watching the following in HD:
http://www.youtube.com/watch?v=zlfKdbWwruY

I'm unable to get any CPU to work on 1.8Ghz and the movie is skipping frequently due to underperformed decoding / display.

So I've played around and changed cpu?/cpufreq/ondemand/up_threshold from default 95 to 30 . Now everything is perfectly fine. The original funny behaviour is gone.

I think that 95 is way to high for default. I want my CPU to work on high speed if required and slow down if there's nothing to do. (as per http://www.lesswatts.org/projects/applications-power-management/race-to-idle.php )

Maybe 5% margin is not enough to catch quickly that the there's a CPU shortage here and there. I'm not sure, but someone with more time and knowledge should take a look at this.

ProblemType: Bug
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: dpc 1723 F.... pulseaudio
 /dev/snd/pcmC0D0p: dpc 1723 F...m pulseaudio
CRDA: Error: [Errno 2] No such file or directory
Card0.Amixer.info:
 Card hw:0 'Intel'/'HDA Intel at 0xf1200000 irq 22'
   Mixer name : 'Realtek ALC883'
   Components : 'HDA:10ec0883,15580721,00100002 HDA:10573055,10573055,00100700'
   Controls : 28
   Simple ctrls : 17
Date: Thu Nov 5 19:21:02 2009
DistroRelease: Ubuntu 9.10
HibernationDevice: RESUME=UUID=32932d31-e3e8-4410-825a-26f418ee7240
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release amd64 (20091027)
MachineType: ARISTO Slim 1250
Package: linux-image-2.6.31-14-generic 2.6.31-14.48
ProcCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.31-14-generic root=UUID=95827051-2f3b-467f-9f8a-d99370280630 ro quiet splash
ProcEnviron:
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-14.48-generic
RelatedPackageVersions:
 linux-backports-modules-2.6.31-14-generic N/A
 linux-firmware 1.24
RfKill:
 0: phy0: Wireless LAN
  Soft blocked: no
  Hard blocked: no
SourcePackage: linux
Uname: Linux 2.6.31-14-generic x86_64
dmi.bios.date: 01/10/2008
dmi.bios.vendor: Phoenix Technologies LTD
dmi.bios.version: SROSA001.86C.0038.D.080110
dmi.board.name: Slim 1250
dmi.board.vendor: ARISTO
dmi.board.version: Not Applicable
dmi.chassis.asset.tag: No Asset Tag
dmi.chassis.type: 1
dmi.chassis.vendor: ARISTO
dmi.chassis.version: N/A
dmi.modalias: dmi:bvnPhoenixTechnologiesLTD:bvrSROSA001.86C.0038.D.080110:bd01/10/2008:svnARISTO:pnSlim1250:pvrNotApplicable:rvnARISTO:rnSlim1250:rvrNotApplicable:cvnARISTO:ct1:cvrN/A:
dmi.product.name: Slim 1250
dmi.product.version: Not Applicable
dmi.sys.vendor: ARISTO
---
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.21.
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: dpc 1698 F.... pulseaudio
 /dev/snd/pcmC0D0p: dpc 1698 F...m pulseaudio
CRDA: Error: [Errno 2] No such file or directory
Card0.Amixer.info:
 Card hw:0 'Intel'/'HDA Intel at 0xf1200000 irq 22'
   Mixer name : 'Realtek ALC883'
   Components : 'HDA:10ec0883,15580721,00100002 HDA:10573055,10573055,00100700'
   Controls : 28
   Simple ctrls : 17
DistroRelease: Ubuntu 10.04
EcryptfsInUse: Yes
HibernationDevice: RESUME=UUID=32932d31-e3e8-4410-825a-26f418ee7240
InstallationMedia: Ubuntu 10.04 "Lucid Lynx" - Beta amd64 (20100318)
MachineType: ARISTO Slim 1250
Package: linux (not installed)
ProcCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.32-21-generic root=UUID=d5a869b3-8494-4faa-8d0d-aa0c3b797a9b ro quiet splash
ProcEnviron:
 PATH=(custom, user)
 LANG=en_GB.utf8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.32-21.32-generic 2.6.32.11+drm33.2
Regression: No
RelatedPackageVersions: linux-firmware 1.34
Reproducible: Yes
RfKill:
 0: phy0: Wireless LAN
  Soft blocked: no
  Hard blocked: no
Tags: lucid needs-upstream-testing
Uname: Linux 2.6.32-21-generic x86_64
UserGroups: adm admin cdrom dialout lp lpadmin plugdev sambashare
WifiSyslog:

dmi.bios.date: 01/10/2008
dmi.bios.vendor: Phoenix Technologies LTD
dmi.bios.version: SROSA001.86C.0038.D.080110
dmi.board.name: Slim 1250
dmi.board.vendor: ARISTO
dmi.board.version: Not Applicable
dmi.chassis.asset.tag: No Asset Tag
dmi.chassis.type: 1
dmi.chassis.vendor: ARISTO
dmi.chassis.version: N/A
dmi.modalias: dmi:bvnPhoenixTechnologiesLTD:bvrSROSA001.86C.0038.D.080110:bd01/10/2008:svnARISTO:pnSlim1250:pvrNotApplicable:rvnARISTO:rnSlim1250:rvrNotApplicable:cvnARISTO:ct1:cvrN/A:
dmi.product.name: Slim 1250
dmi.product.version: Not Applicable
dmi.sys.vendor: ARISTO

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote :
Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote :

Whe deciding about the importance of this particular bug please be aware that this may create an impression that the Ubuntu performance is much worse than it should really be.

Philip Muškovac (yofel)
affects: ubuntu → linux (Ubuntu)
Revision history for this message
Michael Hunold (hunold) wrote :

I can second this bug report.

Summary: with "ondemand" on a fresh 9.10 installation on a Toshiba Tecra M9 both CPUs were stuck at 800MHz. The system felt very sluggish.

I have done a fresh install of 9.10 on a Toshiba Tecra M9. After the default installation "cpufrequtils" where missing.
After installing that I put two CPU frequency scaling monitors into my panel. Both CPU cores where stuck at 800MHz all the time, no matter what load I put on the system.

Setting the policy to "conservative" (instead of "ondemand") helped. Now when putting load on the system, both
CPUs where scaling up to 2.2GHz correctly.

When I found this bug report, I tweaked the "up_threshold" setting and then "ondemand" scaling is now working as well.

echo "30" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
echo "30" > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/up_threshold

So that means something is wrong with using "ondemand" on this system.

Here are some system informations:

Linux xxx 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009 i686 GNU/Linux

Ubuntu 2.6.31-14.48-generic

cpufrequtils 005: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs to <email address hidden>, please.
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which need to switch frequency at the same time: 0
  hardware limits: 800 MHz - 2.20 GHz
  available frequency steps: 2.20 GHz, 2.20 GHz, 1.60 GHz, 1.20 GHz, 800 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 800 MHz and 2.20 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 800 MHz.
  cpufreq stats: 2.20 GHz:0.00%, 2.20 GHz:0.00%, 1.60 GHz:0.00%, 1.20 GHz:0.00%, 800 MHz:0.00% (6208)
analyzing CPU 1:
  driver: acpi-cpufreq
  CPUs which need to switch frequency at the same time: 1
  hardware limits: 800 MHz - 2.20 GHz
  available frequency steps: 2.20 GHz, 2.20 GHz, 1.60 GHz, 1.20 GHz, 800 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 800 MHz and 2.20 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 800 MHz.
  cpufreq stats: 2.20 GHz:0.00%, 2.20 GHz:0.00%, 1.60 GHz:0.00%, 1.20 GHz:0.00%, 800 MHz:0.00% (5337)

Revision history for this message
Michael Hunold (hunold) wrote :

When looking at this problem, please also have a look at the following link, section "Notes on cpufreq from my experiences": http://www.pantz.org/software/cpufreq/usingcpufreqonlinux.html

Revision history for this message
Gerhard Lang (lang-gerhard) wrote :

This bug also affects audio production on -rt kernel, lot of Xruns if jackd is configured for low latencies.
My workaround: inserted these lines into /etc/rc.local:
(sleep 2 && echo 20 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold) &
(sleep 2 && echo 20 > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/up_threshold) &
Now everything works fine with governor "ondemand", without the heating and fan noise I had by fixing at max fequency

Revision history for this message
Jeremy Foshee (jeremyfoshee) wrote :

Hi Dawid,

This bug was reported a while ago and there hasn't been any activity in it recently. We were wondering if this is still an issue? Can you try with the latest development release of Ubuntu? ISO CD images are available from http://cdimage.ubuntu.com/releases/ .

If it remains an issue, could you run the following command from a Terminal (Applications->Accessories->Terminal). It will automatically gather and attach updated debug information to this report.

apport-collect -p linux 475706

Also, if you could test the latest upstream kernel available that would be great. It will allow additional upstream developers to examine the issue. Refer to https://wiki.ubuntu.com/KernelMainlineBuilds . Once you've tested the upstream kernel, please remove the 'needs-upstream-testing' tag. This can be done by clicking on the yellow pencil icon next to the tag located at the bottom of the bug description and deleting the 'needs-upstream-testing' text. Please let us know your results.

Thanks in advance.

    [This is an automated message. Apologies if it has reached you inappropriately; please just reply to this message indicating so.]

tags: added: needs-kernel-logs
tags: added: needs-upstream-testing
tags: added: kj-triage
Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : AlsaDevices.txt

apport information

tags: added: apport-collected
description: updated
Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : AplayDevices.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : ArecordDevices.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : BootDmesg.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : Card0.Amixer.values.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : Card0.Codecs.codec.0.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : Card0.Codecs.codec.1.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote :

Hi there.

I'm using 10.04 since beta2 and the problem is the same. I'm using:

echo 15 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
echo 15 > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/up_threshold

in /etc/rc.local to help the system speed up when required.

I haven't really tested the behavior described, but flash is indeed slow with ondemand and not triggering cpufreq to use higher frequencies without this workaround. I'll test mainstream kernel but it may take me more than a week as I'm going to week long holidays tomorrow. If I won't write anything, please write a note to chase me - I'm more than happy to help Ubuntu community, but I have a tendency to forget about things to do. :)

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : CurrentDmesg.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : IwConfig.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : Lspci.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : Lsusb.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : PciMultimedia.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : ProcCpuinfo.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : ProcInterrupts.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : ProcModules.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : UdevDb.txt

apport information

Revision history for this message
Dawid Ciężarkiewicz (dpc-ucore) wrote : UdevLog.txt

apport information

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
importance: Undecided → Medium
Revision history for this message
uboot (a-v-a-t-a-r) wrote :

For me, it is the same!

Ubuntu 10.04 AMD 64 on Thinkpad X61, Core2Duo T8300 2.4GHz

I tried kernel 2.6.32-20-generic and 2.6.31-20-generic.

And even worse: when selecting Performance Gouvernor for both cores and running a multi threaded heavy load application, it won't stay at 2.4GHz but drop to 1.2GHz after some time.

Revision history for this message
uboot (a-v-a-t-a-r) wrote :

I take it all back! Ondemand works for me.

The fan/cooling unit of my laptop was broken such that my cpu reached 85C, which causes throttling.

Revision history for this message
Rick Gabriel (klaxian1) wrote :

This is still a problem in Lucid and Maverick, especially with processors with many cores (ie. more than 4). Setting the threshold lower greatly improves performance and responsiveness.

Revision history for this message
Gerhard Lang (lang-gerhard) wrote :

hi uboot,
There is a script /etc/init.d/ondemand which automatically sets ondemand governor after waiting 60 seconds, so if performance governor is selected manually immediately after startup, this might be resetted and fall back to ondemand. By removing x-flag from etc/init.d/ondemand this can be manipulated, if one likes fan rattling and fried notebook cpus.
Are you sure your cooling unit is broken? On a dualcore amd64 hp notebook under heavy load I often see cpu temperatures around 80-90°C.

Revision history for this message
uboot (a-v-a-t-a-r) wrote :

Gerhard, yes - it is definitely related to temperature.

At 85C the cpu throttles by 50% to 1.2GHz until it is cooled down below 50C I guess. At this point, I cannot select higher frequencies via cpufreq-set. I reports a maximum selectable frequency of 1.2GHz. When it is cooled down, it reports 2.4GHz max and I can set 2.4GHz again.

And I even managed to reach 95C, where it throttles to 400MHz

With Windows XP x64 it is the same.

I re-applied thermal grease and "optimized" airflow by moving a cable inside the casing and now it is better.

Revision history for this message
Brad Figg (brad-figg) wrote : Unsupported series, setting status to "Won't Fix".

This bug was filed against a series that is no longer supported and so is being marked as Won't Fix. If this issue still exists in a supported series, please file a new bug.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: Confirmed → Won't Fix
To post a comment you must log in.