Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[UNSOLVED/GIVE-UP] Automatic on-demand laptop CPU frequency
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
timotheus25
Apprentice
Apprentice


Joined: 27 Dec 2005
Posts: 162
Location: *upstate* New York, USA

PostPosted: Thu Jul 06, 2006 11:52 pm    Post subject: [UNSOLVED/GIVE-UP] Automatic on-demand laptop CPU frequency Reply with quote

I run Gentoo on a 1.25GHz G4 Powerbook.

Code:

# dmesg | head -n 10
d hash table entries: 65536 (order: 6, 262144 bytes)
[   26.040559] TCP: Hash tables configured (established 262144 bind 65536)
[   26.040582] TCP reno registered
[   26.040661] Thermal assist unit not available
[   26.040944] Registering PowerMac CPU frequency driver
[   26.040962] Low: 765 Mhz, High: 1249 Mhz, Boot: 765 Mhz
[   26.074395] highmem bounce pool size: 64 pages
[   26.074567] fuse init (API version 7.6)
[   26.074691] Initializing Cryptographic API
[   26.074709] io scheduler noop registered


Is there a way to change the Boot frequency to High (1249 MHz)? Obviously, I could modify an rc script to change the frequency as soon as /sys is mounted.

But can I do one of the following?

  1. patch the kernel driver
  2. reconfigure an OpenFirmware setting

_________________
http://tstotts.net/linux/gentoopb.html
http://tstotts.net/linux/gentooinsp640m.html


Last edited by timotheus25 on Wed Jul 26, 2006 4:46 am; edited 4 times in total
Back to top
View user's profile Send private message
JoseJX
Retired Dev
Retired Dev


Joined: 28 Apr 2002
Posts: 2774

PostPosted: Fri Jul 07, 2006 12:44 am    Post subject: Reply with quote

You'll want to enable the "userspace" cpufreq governor in the kernel and then setup one of the cpufreq programs listed here: http://www.gentoo.org/doc/en/gentoo-ppc-faq.xml#laptoppkgs

This will make the speed autoadjust based on load (which is probably what you really want).
_________________
Gentoo PPC FAQ: http://www.gentoo.org/doc/en/gentoo-ppc-faq.xml
Back to top
View user's profile Send private message
timotheus25
Apprentice
Apprentice


Joined: 27 Dec 2005
Posts: 162
Location: *upstate* New York, USA

PostPosted: Fri Jul 07, 2006 12:57 am    Post subject: Reply with quote

JoseJX wrote:
This will make the speed autoadjust based on load (which is probably what you really want).


Not really. I'd like to force the machine to boot at maximum processor frequency -- viz., even before INIT is called. Then I'll use my current configuration of pbbuttonsd. I'm looking for a way to reduce bootup time, and don't care about battery power consumption.

I'm hacking the kernel driver right now. Should only take 1 or 2 lines of code. But I thought I'd post incase anyone knows an OpenFirmware setting or the like.
_________________
http://tstotts.net/linux/gentoopb.html
http://tstotts.net/linux/gentooinsp640m.html
Back to top
View user's profile Send private message
JoseJX
Retired Dev
Retired Dev


Joined: 28 Apr 2002
Posts: 2774

PostPosted: Fri Jul 07, 2006 1:54 am    Post subject: Reply with quote

How does pbbuttonsd control the cpu speed?

If you want to have it start at full speed, compile in the "performance" governor and set that to default, then switch to userspace when you want to change the speed later.
_________________
Gentoo PPC FAQ: http://www.gentoo.org/doc/en/gentoo-ppc-faq.xml
Back to top
View user's profile Send private message
timotheus25
Apprentice
Apprentice


Joined: 27 Dec 2005
Posts: 162
Location: *upstate* New York, USA

PostPosted: Fri Jul 07, 2006 2:31 am    Post subject: Reply with quote

JoseJX wrote:
How does pbbuttonsd control the cpu speed?
Code:

# grep policy /etc/pbbuttonsd.conf
onAC_policy           = performance     ; nochange, performance, custom or powersave
onBattery_policy      = powersave
# ls -l /etc/power/event.d/cpufreq
lrwxrwxrwx 1 root root 20 2004-12-21 22:56 /etc/power/event.d/cpufreq -> ../scripts.d/cpufreq

Current versions of pbbuttonsd set the frequency governor to 'userspace', and then set the frequency to either the maximum or minimum value based on ac/battery state.

JoseJX wrote:

If you want to have it start at full speed, compile in the "performance" governor and set that to default, then switch to userspace when you want to change the speed later.

Yes, I do that, but my memory had lapsed that the governors were there. Perhaps I was just irritated that "Boot: %s MHz" showed the lower frequency at kernel initialization, and wanted to be in control :roll: .

Anyway, I made another Kconfig option to enable immediate setting of CPU freq. to max, and tested it out. Some minor gain in boot performance as CPU is switched up as soon as the kernel is loaded, even before dmesg can record. Perhaps I'll submit the patch.
_________________
http://tstotts.net/linux/gentoopb.html
http://tstotts.net/linux/gentooinsp640m.html
Back to top
View user's profile Send private message
JoseJX
Retired Dev
Retired Dev


Joined: 28 Apr 2002
Posts: 2774

PostPosted: Fri Jul 07, 2006 3:46 am    Post subject: Reply with quote

Sure, pbbuttonsd can do that, but then if you need the speed later, while on battery, you have to do it manually. I'm also sure that you don't want to burn your fan out because you leave the laptop plugged in all of the time. :p It's really better to use a userspace freq daemon like powernowd which scales the frequency. It's better for your machine (it won't run as hot, it won't take as long to charge, the battery will last longer).
_________________
Gentoo PPC FAQ: http://www.gentoo.org/doc/en/gentoo-ppc-faq.xml
Back to top
View user's profile Send private message
timotheus25
Apprentice
Apprentice


Joined: 27 Dec 2005
Posts: 162
Location: *upstate* New York, USA

PostPosted: Fri Jul 07, 2006 3:57 am    Post subject: Reply with quote

JoseJX wrote:
I'm also sure that you don't want to burn your fan out because you leave the laptop plugged in all of the time. :p


Well, had the machine since Nov. 2003. Haven't burned out the fans. But I'm close to burning out my 2nd hard drive 8O. Any solution for that one (when using resiserfs)?
_________________
http://tstotts.net/linux/gentoopb.html
http://tstotts.net/linux/gentooinsp640m.html
Back to top
View user's profile Send private message
JoseJX
Retired Dev
Retired Dev


Joined: 28 Apr 2002
Posts: 2774

PostPosted: Fri Jul 07, 2006 5:05 am    Post subject: Reply with quote

Well, heat isn't good for that either. I guess the only other thing I can suggest is not to drop it so much. :)
_________________
Gentoo PPC FAQ: http://www.gentoo.org/doc/en/gentoo-ppc-faq.xml
Back to top
View user's profile Send private message
timotheus25
Apprentice
Apprentice


Joined: 27 Dec 2005
Posts: 162
Location: *upstate* New York, USA

PostPosted: Wed Jul 19, 2006 12:23 am    Post subject: Reply with quote

I've tried using 'powernow' on my PowerBook G4 (original 7447 CPU). It works for a while, but other applications start throwing all kinds of libc.so.6 exceptions, crashing applications and compilation attempts randomly. Basically, system stability goes out-the-window. Yikes! Disabling the service and rebooting restores system stability.

Is there an on-demand CPU frequency regulator that anyone has working successfully with a G4 CPU, M10 video card with DRI / R300 enabled, glibc-2.4, gcc-4, xorg-7.1, and -mcpu=7450 ?

I don't think the ondemand kernel 'governor' supports G4/PPC yet.
_________________
http://tstotts.net/linux/gentoopb.html
http://tstotts.net/linux/gentooinsp640m.html
Back to top
View user's profile Send private message
JoseJX
Retired Dev
Retired Dev


Joined: 28 Apr 2002
Posts: 2774

PostPosted: Wed Jul 19, 2006 12:36 am    Post subject: Reply with quote

No, the only governors that work are: performance (always on high speed), powersave (always on low) and userspace. The automatic ones (ondemand and conservative) do not work on G4's due to the time it takes to transition between speeds.

Have you tried testing your memory with memtester while running at high speed? It sounds like you have a hardware problem, since disabling the service and restarting would make your machine always run in low speed.

What kernel are you using? Are you using that "hack" to force the speed high on boot?
_________________
Gentoo PPC FAQ: http://www.gentoo.org/doc/en/gentoo-ppc-faq.xml
Back to top
View user's profile Send private message
timotheus25
Apprentice
Apprentice


Joined: 27 Dec 2005
Posts: 162
Location: *upstate* New York, USA

PostPosted: Wed Jul 19, 2006 12:51 am    Post subject: Reply with quote

JoseJX wrote:
No, the only governors that work are: performance (always on high speed), powersave (always on low) and userspace. The automatic ones (ondemand and conservative) do not work on G4's due to the time it takes to transition between speeds.

I always wondered why. So no future support then, I suppose.

Quote:
Have you tried testing your memory with memtester while running at high speed? It sounds like you have a hardware problem, since disabling the service and restarting would make your machine always run in low speed.

No hardware troubles. Running memtester now, no problems yet. My CPU is managed by pbbuttonsd using the /sys/ filesystem. I also set the CPU to high or low manually via /sys/, near 10 times per day, under all sorts of load/idle conditions without issue.

Quote:

What kernel are you using? Are you using that "hack" to force the speed high on boot?

This is independent of that hack. It occurs with vanilla 2.6.17, which I what I am using. (I made a hack, tried it out, decided not to use it, and don't use it anymore as the benefit is too marginal.)

So, manually adjusting CPU works fine. pbbuttonsd has no problems adjusting on power transitions. No detected hardware or memory issues. Other ideas?
_________________
http://tstotts.net/linux/gentoopb.html
http://tstotts.net/linux/gentooinsp640m.html
Back to top
View user's profile Send private message
JoseJX
Retired Dev
Retired Dev


Joined: 28 Apr 2002
Posts: 2774

PostPosted: Wed Jul 19, 2006 1:04 am    Post subject: Reply with quote

Well, powernowd might be too agressive, you can try changing the "frequency" at which it changes the speeds (hah) or another daemon like cpufreqd (there's a few mentioned in the FAQ).
_________________
Gentoo PPC FAQ: http://www.gentoo.org/doc/en/gentoo-ppc-faq.xml
Back to top
View user's profile Send private message
timotheus25
Apprentice
Apprentice


Joined: 27 Dec 2005
Posts: 162
Location: *upstate* New York, USA

PostPosted: Wed Jul 19, 2006 3:31 am    Post subject: Reply with quote

JoseJX wrote:
Well, powernowd might be too agressive, you can try changing the "frequency" at which it changes the speeds (hah)


I doubt that will help. The default polling time is 1 second (1000 ms), and I can change it manually every second w/o causing libc segfaults. Testing other daemons now...
_________________
http://tstotts.net/linux/gentoopb.html
http://tstotts.net/linux/gentooinsp640m.html
Back to top
View user's profile Send private message
timotheus25
Apprentice
Apprentice


Joined: 27 Dec 2005
Posts: 162
Location: *upstate* New York, USA

PostPosted: Wed Jul 19, 2006 4:31 pm    Post subject: Reply with quote

Well, cpudyn works fairly well, for a while. I changed the settings to only allow CPU polling every 2 seconds (with dropping down actually taking ~20). The speed change is configured to never occur more than once per 20 seconds. However, X11 still locks-up after extended use. The mouse/keyboard become iresponsive. Using sysrq, I can change the keyboard mode (to steal it back from X), but cannot change to a VT. (The log files show a successful keyboard mode change though.) I have to use sysrq to poweroff and boot again. Obviously not acceptable. Ideas?

I suspect that X11 with the R300 DRI enabled cannot handle the CPU changing. I'm thinking that one of the following options could cause this:
Code:
        Option "DisplayPriority"        "HIGH"          # Fix flickering
        Option "DynamicClocks"          "1"

_________________
http://tstotts.net/linux/gentoopb.html
http://tstotts.net/linux/gentooinsp640m.html
Back to top
View user's profile Send private message
timotheus25
Apprentice
Apprentice


Joined: 27 Dec 2005
Posts: 162
Location: *upstate* New York, USA

PostPosted: Sat Jul 22, 2006 3:13 am    Post subject: Reply with quote

cpufreqd appears to give the best stability due to its ability to create weighted rules; however, give 24 hours or so, I will still experience an unexpected segfault or exit of an application, usually portage, GIMP, or some other CPU-intensive task. Of course, these issues all disappear when I stop the automatic cpu frequency adjustments.
This occurs even when the polling interval is 10 whole seconds.

Remarks from anyone else having encountered a similar issue are greatly appreciated.
_________________
http://tstotts.net/linux/gentoopb.html
http://tstotts.net/linux/gentooinsp640m.html
Back to top
View user's profile Send private message
timotheus25
Apprentice
Apprentice


Joined: 27 Dec 2005
Posts: 162
Location: *upstate* New York, USA

PostPosted: Wed Jul 26, 2006 4:45 am    Post subject: Reply with quote

I doubt this is a hardware issue, as Mac OSX seems to perform on-demand CPU adjustments just fine. Oh well; maybe I should file a kernel bug as this appears in the vanilla kernel also.
_________________
http://tstotts.net/linux/gentoopb.html
http://tstotts.net/linux/gentooinsp640m.html
Back to top
View user's profile Send private message
JoseJX
Retired Dev
Retired Dev


Joined: 28 Apr 2002
Posts: 2774

PostPosted: Wed Jul 26, 2006 1:31 pm    Post subject: Reply with quote

Sure, benh might have some insight as to what's going on. I'm just surprised that I've never heard of anyone else with this issue. Does it still have issues with pbbuttonsd disabled?
_________________
Gentoo PPC FAQ: http://www.gentoo.org/doc/en/gentoo-ppc-faq.xml
Back to top
View user's profile Send private message
dermartn
n00b
n00b


Joined: 06 Dec 2004
Posts: 63

PostPosted: Sat Jul 29, 2006 1:08 pm    Post subject: Reply with quote

hello,

i have an ibook g3 and i use a fork of powernowd. it`s called powerthend :wink:
http://powerthend.scheissname.de/

there is a ebuild on this site.
perhaps it´s a better solution.

dermartn
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum