Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 164802 - [2.6.19 regression] cpufreq powernow-k7: can't reach maximum speed
Summary: [2.6.19 regression] cpufreq powernow-k7: can't reach maximum speed
Status: VERIFIED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL: http://bugzilla.kernel.org/show_bug.c...
Whiteboard: linux-2.6.19-regression
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-01 09:52 UTC by Dustin Polke
Modified: 2007-06-30 22:38 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
configuration generated by genkernel without any changes (config-genkernel,52.54 KB, text/plain)
2007-02-01 17:01 UTC, Dustin Polke
Details
Changes to the standard genkernel configuration I made to enable frequencyscaling and ACPI (config-diff,5.57 KB, text/plain)
2007-02-01 17:02 UTC, Dustin Polke
Details
dmesg.log (dmesg.log,17.47 KB, text/plain)
2007-03-08 19:35 UTC, Dustin Polke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dustin Polke 2007-02-01 09:52:04 UTC
After switching to the newly stabilized gentoo-sources-2.6.19-r5 kernel, my CPU runs only on reduced speed:

solaris dustin # cd /sys/devices/system/cpu/cpu0/cpufreq/

solaris cpufreq # cat cpuinfo_max_freq 
1266768

solaris cpufreq # cat cpuinfo_cur_freq 
933408

solaris cpufreq # cat scaling_available_frequencies 
1266768 1000080 933408 800064 666720 

solaris cpufreq # cat scaling_available_governors   
ondemand powersave userspace performance 

solaris cpufreq # cat scaling_governor            
performance

solaris cpufreq # cat scaling_driver 
powernow-k7

solaris cpufreq # uname -a
Linux solaris 2.6.19-gentoo-r5 #1 Wed Jan 31 23:49:21 CET 2007 i686 mobile AMD Athlon(tm) XP 1500+ AuthenticAMD GNU/Linux

Although in performance mode, the CPU is running not at max. frequency. Switching to powersafe mode will reduce the frequency to minimum:

solaris cpufreq # echo powersave > scaling_governor 
solaris cpufreq # cat cpuinfo_cur_freq 
666720

With ondemand, frequency stays at minimum until CPU load increases, but never exceeds 933408.

To configure the new kernel version, I copied /etc/kernels/kernel-config-x86-2.6.18-gentoo-r6 to
/etc/kernels/kernel-config-x86-2.6.19-gentoo-r5 and ran genkernel in order to use the settings of the previous kernel.

gentoo-sources-2.6.18-r6 does not show this behavior but works as expected.



used the config of the previous version and ran oldconfig 

Reproducible: Always

Steps to Reproduce:
1. Configure kernel to use frequency scaling
2. Compile kernel and reboot using the new kernel
3. Check CPU frequency

Actual Results:  
CPU runs not at max frequency

Expected Results:  
CPU should run at max frequency in performance mode and in ondemand mode under high CPU load.

Portage 2.1.1-r2 (default-linux/x86/2006.1, gcc-4.1.1, glibc-2.4-r4, 2.6.19-gentoo-r5 i686)
=================================================================
System uname: 2.6.19-gentoo-r5 i686 mobile AMD Athlon(tm) XP 1500+
Gentoo Base System version 1.12.6
Last Sync: Thu, 01 Feb 2007 08:50:01 +0000
ccache version 2.4 [enabled]
app-admin/eselect-compiler: [Not Present]
dev-java/java-config: 1.3.7, 2.0.31
dev-lang/python:     2.4.3-r4
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r6
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.14
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O3 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /us
r/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/
splash /etc/terminfo"
CXXFLAGS="-march=athlon-xp -O3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache collision-protect distlocks fixpackages metadata-transfer parallel-fetch sandbo
x sfperms strict test userfetch userpriv usersandbox"
GENTOO_MIRRORS="ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://pandemonium.tiscali.de/pub/gentoo
/ ftp://linux.rz.ruhr-uni-bochum.de/gentoo-mirror/ ftp://gd.tuwien.ac.at/opsys/linux/gentoo/ ftp://gentoo.i
node.at/source/"
LINGUAS="en de"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_EXTRA_OPTS="--timeout=500"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --dele
te --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/modified /usr/local/portage/own /usr/local/portage/layman/webapps-exper
imental /usr/local/portage/layman/science"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 3dnow 3dnowext X Xaw3d a52 aac aalib acpi alsa alsa_cards_mpu401 alsa_cards_via82xx alsa_cards_via
82xx-modem alsa_pcm_plugins_adpcm alsa_pcm_plugins_alaw alsa_pcm_plugins_asym alsa_pcm_plugins_copy alsa_pc
m_plugins_dmix alsa_pcm_plugins_dshare alsa_pcm_plugins_dsnoop alsa_pcm_plugins_empty alsa_pcm_plugins_extp
lug alsa_pcm_plugins_file alsa_pcm_plugins_hooks alsa_pcm_plugins_iec958 alsa_pcm_plugins_ioplug alsa_pcm_p
lugins_ladspa alsa_pcm_plugins_lfloat alsa_pcm_plugins_linear alsa_pcm_plugins_meter alsa_pcm_plugins_mulaw
 alsa_pcm_plugins_multi alsa_pcm_plugins_null alsa_pcm_plugins_plug alsa_pcm_plugins_rate alsa_pcm_plugins_
route alsa_pcm_plugins_share alsa_pcm_plugins_shm alsa_pcm_plugins_softvol amr amrr apache2 apm asf async a
tlas audacious audiofile bash-completion berkdb bindist bitmap-fonts bl bonobo bzip2 cap cardbus cjk cli cr
acklib crypt ctype cups dba dga dlloader dri dvd dvdread eds elibc_glibc encode evo exif expat extensions f
am fbcon ffmpeg flac foomaticdb force-cgi-redirect fortran ftp gd gdbm gif gimpprint glibc-omitfp glut gs g
streamer gtk gtk2 gtkhtml guile hal icq idn imagemagick imap imlib input_devices_keyboard input_devices_mou
se iproute2 java javascript jikes jpeg jpeg2k kerberos kernel_linux lcd_devices_bayrad lcd_devices_cfontz l
cd_devices_cfontz633 lcd_devices_glk lcd_devices_hd44780 lcd_devices_lb216 lcd_devices_lcdm001 lcd_devices_
mtxorb lcd_devices_ncurses lcd_devices_text lcms ldap libcaca libg++ libwww linguas_de linguas_en live lm_s
ensors logrotate lzo mad madwifi memlimit mikmod mime mjpeg mmx mmxext mng motif moznocompose moznoirc mozn
omail moznoroaming mp3 mp4 mpeg musepack mysql ncurses nls nntp nptl nptlonly nsplugin ogg opengl pam pam_t
imestamp pcmcia pcre pda pdf perl php plotutils png pnp posix postgres print python qt4 quicktime readline 
real ruby samba sasl sdl seamonkey server session simplexml slang smbkrb5passwd sndfile soap sockets sox sp
eex spell spl sse sse-filters ssl svga swat symlink syslog tcltk tcpd test tetex theora tiff truetype truet
ype-fonts type1-fonts udev unicode usb userland_GNU userlocales vcd video_cards_savage vim-with-x vorbis wi
fi win32codecs winbind wma wmf x264 xanim xine xinetd xml xorg xosd xpm xsl xv xvid zlib"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-02-01 10:02:38 UTC
(In reply to comment #0)
> To configure the new kernel version, I copied
> /etc/kernels/kernel-config-x86-2.6.18-gentoo-r6 to
> /etc/kernels/kernel-config-x86-2.6.19-gentoo-r5 and ran genkernel in order to
> use the settings of the previous kernel.
> used the config of the previous version and ran oldconfig 

Uh, don't do such things. Reopen if you can reproduce with *fresh* kernel configuration and correct setup. It's totally unsafe to use use oldconfig between 2.6.18 and 2.6.19 (and between different kernels version in general).
Comment 2 Dustin Polke 2007-02-01 16:57:45 UTC
Genkernel is exactly doing this in general, isn't it?

If you install a new kernel source and run 'genkernel all' then genkernel is checking for an existing config and if none for the kernel is found it uses the one stored in /usr/share/genkernel/${arch}/kernel-config-2.6 for 2.6 kernels and envokes 'make oldconfig'.

I am using genkernel-3.4.5-r1 and here the first lines of /usr/share/genkernel/x86/kernel-config-2.6 reads:

dustin@solaris ~ $ head /usr/share/genkernel/x86/kernel-config-2.6 
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.17-gentoo-r7
# Mon Oct 23 10:46:05 2006
#
CONFIG_X86_32=y
CONFIG_SEMAPHORE_SLEEPERS=y
CONFIG_X86=y
CONFIG_MMU=y
CONFIG_GENERIC_ISA_DMA=y

Notice that this config is for kernel version 2.6.17-gentoo-r7, so why shouldn't I start with the config file of a more recent kernel version that is already configured to suit my hardware better (i.e., I disabled unneeded modules, configured bootsplash options, etc.)?

I've done now the following, as you requested:

1. I removed all config files for the 2.6.19-r5 from /usr/src/linux
2. I envoked genkernel with 'genkernel --menuconfig all', thus using the standard genkernel config file located in /usr/share/genkernel/x86/kernel-config-2.6
3. I changed the following options:
   (i)   Disabled SMTP
   (ii)  Changed processor type to AthlonXP
   (iii) Built ACPI components into the kernel
   (iv)  Built Frequency scaling components into the kernel

Result: The kernel shows exactly the aforementioned behavior, it runs with reduced speed at 933MHz.

I will attach the configuration generated by genkernel without any changes and a diff with the changes I made to compile this kernel.

I will test a kernel configuration without using genkernel as well and post the results later.

Best regards,
Dustin
Comment 3 Dustin Polke 2007-02-01 17:01:09 UTC
Created attachment 108875 [details]
configuration generated by genkernel without any changes
Comment 4 Dustin Polke 2007-02-01 17:02:33 UTC
Created attachment 108877 [details]
Changes to the standard genkernel configuration I made to enable frequencyscaling and ACPI
Comment 5 Dustin Polke 2007-02-01 17:47:25 UTC
Just tried kernel without using genkernel. Same result, so it is definitely genkernel unspecific.

I can post diff of config file to standard config if needed.
Comment 6 Dustin Polke 2007-02-01 19:05:49 UTC
Update: With CONFIG_CPU_FREQ unset CPU runs at max frequency.
Comment 7 Dustin Polke 2007-02-01 21:09:34 UTC
I was able to reproduce this with vanilla source 2.6.19.2 as well.
Comment 8 Daniel Drake (RETIRED) gentoo-dev 2007-02-06 19:00:30 UTC
should be fixed in gentoo-sources-2.6.19-r6, reopen if not
Comment 9 Dustin Polke 2007-02-08 21:59:17 UTC
I tested now gentoo-sources-2.6.19-r6. Unfortunately, the problem still remains the same.

solaris cpufreq # cat cpuinfo_max_freq 
1266768
solaris cpufreq # cat scaling_governor 
performance
solaris cpufreq # cat scaling_max_freq 
950000
solaris cpufreq # cat scaling_cur_freq 
933408
solaris cpufreq # cat scaling_available_frequencies 
1266768 1000080 933408 800064 666720 
solaris cpufreq # echo 800064 > scaling_max_freq 
solaris cpufreq # cat scaling_cur_freq 
800064
solaris cpufreq # echo 1266768 > scaling_max_freq 
solaris cpufreq # cat scaling_cur_freq 
933408


BR,
Dustin
Comment 10 Daniel Drake (RETIRED) gentoo-dev 2007-03-06 18:21:44 UTC
To change the speed you need to select the userspace governor and write into scaling_cur_freq (rather than max)
Comment 11 Dustin Polke 2007-03-07 20:27:00 UTC
dustin@solaris ~ $ cd /sys/devices/system/cpu/cpu0/cpufreq/
dustin@solaris /sys/devices/system/cpu/cpu0/cpufreq $ ll
total 0
drwxr-xr-x 2 root root    0 2007-03-07 21:16 .
drwxr-xr-x 4 root root    0 2007-03-07 22:06 ..
-r--r--r-- 1 root root 4096 2007-03-07 21:17 affected_cpus
-r-------- 1 root root 4096 2007-03-07 21:17 cpuinfo_cur_freq
-r--r--r-- 1 root root 4096 2007-03-07 21:17 cpuinfo_max_freq
-r--r--r-- 1 root root 4096 2007-03-07 21:17 cpuinfo_min_freq
-r--r--r-- 1 root root 4096 2007-03-07 21:17 scaling_available_frequencies
-r--r--r-- 1 root root 4096 2007-03-07 21:17 scaling_available_governors
-r--r--r-- 1 root root 4096 2007-03-07 21:17 scaling_cur_freq
-r--r--r-- 1 root root 4096 2007-03-07 21:17 scaling_driver
-rw-r--r-- 1 root root 4096 2007-03-07 21:07 scaling_governor
-rw-r--r-- 1 root root 4096 2007-03-07 21:16 scaling_max_freq
-rw-r--r-- 1 root root 4096 2007-03-07 21:17 scaling_min_freq

I am afraid that's not possible. Note which files are writable.
What can be done is to set a lower and an upper limit for the cpu frequency. Within this range, certain frequencies are selectable which can be read from scaling_available_frequencies. From these frequencies a specific is chosen according to the governor set in scaling_governor.

If you set scaling_governor to 'userspace', the cpu frequency is only changed explicitly from userpace, not according to some rules by the kernel itself.
Comment 12 Daniel Drake (RETIRED) gentoo-dev 2007-03-07 23:05:44 UTC
You're correct, sorry I read that through too quickly.

Next step is to reproduce this on the latest development kernel, currently 2.6.21-rc3? Please enable CONFIG_CPU_FREQ_DEBUG and if the problem still exists, post dmesg output after trying to switch to the maximum frequency.
Comment 13 Dustin Polke 2007-03-08 10:23:41 UTC
Could you give me a hint, where to find this kernel version in portage? Is it in an overlay? Is it a gentoo kernel or vanilla? Or do I need it to download from somewhere else?
Comment 14 Daniel Drake (RETIRED) gentoo-dev 2007-03-08 13:00:41 UTC
They are normally in portage under vanilla-sources but 2.6.21 doesn't seem to be there for some reason. Instead you can just extract this tarball in /usr/src :
http://www.us.kernel.org/pub/linux/kernel/v2.6/testing/linux-2.6.21-rc3.tar.bz2
Comment 15 Dustin Polke 2007-03-08 14:52:48 UTC
Okay. I compiled the 2.6.21-rc3 kernel. Problem exists here as well.
Max available frequency is 1266768:

solaris cpufreq # cat scaling_available_frequencies 
1266768 1000080 933408 800064 666720 

Max frequency threshold cannot be increased above 950000:

solaris cpufreq # cat scaling_max_freq 
950000
solaris cpufreq # echo 1266768 > scaling_max_freq
solaris cpufreq # cat scaling_max_freq 
950000


I compiled with 'CONFIG_CPU_FREQ_DEBUG=y', but there is no output in the logs, neither in dmesg nor message... Any idea where to look?


Strange thing is:
If I set governor to 'performance', I achieve max freq 950MHz.
If I set governor to 'userspace', I achieve max freq 933MHz.
Comment 16 Daniel Drake (RETIRED) gentoo-dev 2007-03-08 15:04:51 UTC
Try adding cpufreq.debug=3 to your kernel parameters in your bootloader config
Comment 17 Dustin Polke 2007-03-08 18:46:06 UTC
Okay. Now I found something in the log. I attach full dmesg.log.

I think the relevant part is around line 220.

powernow: Minimum speed 666 MHz. Maximum speed 1266 MHz.
freq-table: setting show_table for cpu 0 to cec867e0
freq-table: table entry 0: 1266768 kHz, 3085 index
freq-table: table entry 1: 1000080 kHz, 3593 index
freq-table: table entry 2: 933408 kHz, 3592 index
freq-table: table entry 3: 800064 kHz, 4358 index
freq-table: table entry 4: 666720 kHz, 4868 index
cpufreq-core: setting new policy for CPU 0: 666720 - 1266768 kHz
freq-table: request for verification of policy (666720 - 1266768 kHz) for cpu 0
freq-table: verification lead to (666720 - 1266768 kHz) for cpu 0
freq-table: request for verification of policy (666720 - 950000 kHz) for cpu 0
freq-table: verification lead to (666720 - 950000 kHz) for cpu 0
cpufreq-core: new min and max freqs are 666720 - 950000 kHz

It seems that after detecting the correct max speed and setting the correct policy, the max speed is reduced and again validated, which leads to an incorrect max speed.
Comment 18 Dustin Polke 2007-03-08 19:35:11 UTC
Created attachment 112612 [details]
dmesg.log
Comment 19 Daniel Drake (RETIRED) gentoo-dev 2007-03-24 17:08:45 UTC
Thanks for the logs, they should help. Please now file this bug at http://bugzilla.kernel.org if it is not there already. Attach those logs. Mention that you are using powernow-k7 and that it is a 2.6.19 regression still present in 2.6.21-rc. Post the new bug URL here when done.
Comment 20 Dustin Polke 2007-03-24 18:13:41 UTC
Filed upstream bug and added URL.
Comment 21 Daniel Drake (RETIRED) gentoo-dev 2007-03-24 23:49:33 UTC
Thanks. If there is no response after a couple of days, if you are really keen, you could attempt to do a bisection to find the patch which introduced this bug. It will take some time but is an interesting process. See http://www.reactivated.net/weblog/archives/2006/01/using-git-bisect-to-find-buggy-kernel-patches/
Comment 22 Dustin Polke 2007-03-29 15:02:58 UTC
@Daniel:

I tracked down the regression with git (s. upstream bug) and there seems to be already a patch available:

http://www.mail-archive.com/linux-acpi@vger.kernel.org/msg04484.html

Maybe it can be added to the affected kernels until upstream implements a solution?
Comment 23 Dustin Polke 2007-03-29 16:19:52 UTC
As you stated in the upstream bug, the patch does not solve the issue :(
Is it possible to look into the commit using git? Maybe I can experiment a bit to find the issue...
Comment 25 Daniel Drake (RETIRED) gentoo-dev 2007-04-07 15:20:27 UTC
closing until upstream bug is solved
Comment 26 Dustin Polke 2007-04-21 21:09:03 UTC
Increasing severity to major because kernel version 2.6.18-r6 has been removed from portage. One has to use now either very old kernel (2.6.16-r13 last stable before regression) or turn off frequency scaling.

I do understand that Gentoo has no direct influence on solving this issue, but it appears to me that upstream is not working on this. There is no response on several posts commited by me :(
Comment 27 Daniel Drake (RETIRED) gentoo-dev 2007-06-30 22:38:24 UTC
This is fixed in recent kernel releases