Until I upgraded my system last February I didn't have a system that was fast enough to trigger the bug. My previous system had a low enough CPU clock frequency that it didn't cause overflow in the frequency calculation, so the ondemand governor worked fine. When I upgraded the system, I already had Precise installed and I never tried an older version until today. I just tested an older Ubuntu version by creating a bootable USB using a 10.04 iso with version 2.6.32-21 of the kernel, and it also has the bug.
-- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1136700 Title: cpufreq ondemand governor problem Status in “linux” package in Ubuntu: Incomplete Bug description: I'm seeing a problem with the cpufreq ondemand governor in 12.04 32-bit. When I load one core of my Intel i5-3570 processor, instead of switching to a steady 3.8GHz clock as I would expect, the clock actually toggles between 1.6GHz (min frequency) and 3.8GHz (max frequency), even though the core is maxed out at 100%. I can increase the time it spends at 3.8GHz by increasing the sampling_down_factor tuning parameter, but it still switches back to 1.6GHz, albeit less frequently. I've also tried 12.10 32-bit and it has the same problem. However, 12.04 and 12.10 64-bit do not have the problem. I decided to look into this a little further, so I copied the source code for the ondemand governor module and added a little debug code to see what was going on. I found that the __cpufreq_driver_getavg function call was sometimes returning a value which was several orders of magnitude too small. For example: [20174.251637] mygov: freq_avg(2) = 158 freq_cur = 3801000 [20174.251642] mygov: freq_avg(0) = 4149919 freq_cur = 1600000 [20174.251645] mygov: freq_avg(1) = 4149919 freq_cur = 1600000 [20174.251647] mygov: freq_avg(3) = 4120224 freq_cur = 1600000 As you can see, the return value freq_avg is very small for core 2, which is the maxed out core. This value is calculated in mperf.c using 32-bit unsigned integers (in the 32-bit OS case) and it includes a final 10-bit right shift. As you can see, the normal return value is greater than 4meg, so before the shift it is greater then 4gig, right at the limit of a 32-bit integer. I believe that the erroneous return values are due to 32-bit overflow in the average frequency calculation. However, in the 64-bit OS the calculation uses 64 bits since one of the variables is declared as unsigned long, so there is no overflow. Note that slower processors wouldn't show this problem since the average frequency numbers would be smaller. Also, I have noticed that if I load 3 or 4 cores, the problem disappears. This is because the processor maximum clock frequency is automatically reduced to 3.7GHz or 3.6GHz respectively, and this frequency reduction is enough to avoid overflow. ProblemType: Bug DistroRelease: Ubuntu 12.04 Package: linux-image-3.2.0-38-generic-pae 3.2.0-38.61 ProcVersionSignature: Ubuntu 3.2.0-38.61-generic-pae 3.2.37 Uname: Linux 3.2.0-38-generic-pae i686 AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.24. ApportVersion: 2.0.1-0ubuntu17.1 Architecture: i386 ArecordDevices: **** List of CAPTURE Hardware Devices **** card 0: AudioPCI [Ensoniq AudioPCI], device 0: ES1371/1 [ES1371 DAC2/ADC] Subdevices: 1/1 Subdevice #0: subdevice #0 AudioDevicesInUse: USER PID ACCESS COMMAND /dev/snd/controlC0: jim 2351 F.... pulseaudio jim 3333 F.... xmms /dev/snd/pcmC0D0p: jim 2351 F...m pulseaudio CRDA: Error: command ['iw', 'reg', 'get'] failed with exit code 1: nl80211 not found. Card0.Amixer.info: Card hw:0 'AudioPCI'/'Ensoniq AudioPCI ENS1371 at 0xd000, irq 18' Mixer name : 'SigmaTel STAC9721,23' Components : 'AC97a:83847609' Controls : 36 Simple ctrls : 23 Date: Thu Feb 28 18:49:55 2013 HibernationDevice: RESUME=UUID=9c9d7935-45a9-4dae-8d56-b28be920ca4e InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release i386 (20120423) IwConfig: lo no wireless extensions. eth0 no wireless extensions. MachineType: Gigabyte Technology Co., Ltd. To be filled by O.E.M. MarkForUpload: True ProcEnviron: TERM=xterm LC_COLLATE=POSIX PATH=(custom, no user) LANG=en_US.UTF-8 SHELL=/usr/bin/tcsh ProcFB: 0 inteldrmfb 1 VESA VGA ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.2.0-38-generic-pae root=UUID=8d75fd4b-1bf6-4edc-9f5b-57790e729fe1 ro vga=791 debug ignore_loglevel RelatedPackageVersions: linux-restricted-modules-3.2.0-38-generic-pae N/A linux-backports-modules-3.2.0-38-generic-pae N/A linux-firmware 1.79.1 RfKill: SourcePackage: linux StagingDrivers: mei UpgradeStatus: No upgrade log present (probably fresh install) WifiSyslog: Feb 28 10:40:13 elrond NetworkManager[1083]: <info> Unmanaged Device found; state CONNECTED forced. (see http://bugs.launchpad.net/bugs/191889) Feb 28 10:40:36 elrond NetworkManager[1083]: <info> Unmanaged Device found; state CONNECTED forced. (see http://bugs.launchpad.net/bugs/191889) Feb 28 12:21:03 elrond NetworkManager[1083]: <info> Unmanaged Device found; state CONNECTED forced. (see http://bugs.launchpad.net/bugs/191889) Feb 28 12:21:14 elrond NetworkManager[1083]: <info> Unmanaged Device found; state CONNECTED forced. (see http://bugs.launchpad.net/bugs/191889) Feb 28 16:28:23 elrond NetworkManager[1083]: <info> Unmanaged Device found; state CONNECTED forced. (see http://bugs.launchpad.net/bugs/191889) dmi.bios.date: 08/22/2012 dmi.bios.vendor: American Megatrends Inc. dmi.bios.version: F9 dmi.board.asset.tag: To be filled by O.E.M. dmi.board.name: H77M-D3H dmi.board.vendor: Gigabyte Technology Co., Ltd. dmi.board.version: x.x dmi.chassis.asset.tag: To Be Filled By O.E.M. dmi.chassis.type: 3 dmi.chassis.vendor: Gigabyte Technology Co., Ltd. dmi.chassis.version: To Be Filled By O.E.M. dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrF9:bd08/22/2012:svnGigabyteTechnologyCo.,Ltd.:pnTobefilledbyO.E.M.:pvrTobefilledbyO.E.M.:rvnGigabyteTechnologyCo.,Ltd.:rnH77M-D3H:rvrx.x:cvnGigabyteTechnologyCo.,Ltd.:ct3:cvrToBeFilledByO.E.M.: dmi.product.name: To be filled by O.E.M. dmi.product.version: To be filled by O.E.M. dmi.sys.vendor: Gigabyte Technology Co., Ltd. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1136700/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp