WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: cpufreq, cant get it to work.  (Read 8384 times)

Offline pema

  • Newbie
  • *
  • Posts: 48
cpufreq, cant get it to work.
« on: January 17, 2009, 08:22:34 PM »
I have installed cpufreq and hwmon but my cpu fan is still trying to spin out of the box. Using a laptop with AMD K6 cpu. Googled around and tried several commands and settings but no success. Is there any boot code or script for this ? The laptop-mode start reports its started. Noted some scripts are looking for files in /usr/sbin but I believe I backed them all up. Tips and support appreciated.

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14817
Re: cpufreq, cant get it to work.
« Reply #1 on: January 17, 2009, 11:01:22 PM »
You may need the acpi "fan" module loaded to control the fan on your machine - I'm not at a tc machine at the moment, but if I recall correctly, "fan" is not in the base, it is in one of the kernel module extensions.

You could try starting the acpi and cpufreq daemons in terminal windows in "foreground" mode (see the acpi/cpufreqd --help for the exact command) - this may throw out some hints as to what the problem might be.

I don't have an amd machine to test, but on my intel speedstep laptop, one of the parameters cpufreq uses to control the cpu speed is to keep the temperature below a certain value - it's noticeable that when cpufreq is not loaded, the fan comes on a lot more often (my machine does not use the acpi "fan" module).

You could also play around with the temperature setting in the cpufreq conf file to see if that stops the fan coming on as often.

Note that in the default set-up for laptop-mode, the only thing it is controlling is the hd(s) - i.e. it will put the hd(s) into standby mode if they are not accessed for something like 5mins.

Edit: you could try:
Code: [Select]
$ tce-load /path-to-file/hwmon-cpufreq-2.6.26.tcem
$ sudo modprobe fan
$ lsmod

Module                  Size  Used by
fan                     4996  0
...
battery                11012  0 [loaded at boot]
ac                      4996  0 [loaded at boot]

$ tce-load /path-to-file/cpufreq.tcel
$ sudo acpid -d -f
..and see what you get when you disconnect/re-connect the power cord and when the fan starts/stops. This should tell you whether acpi controls the fan or not. If nothing shows up, we can move onto troubleshooting cpufreqd in a similar fashion.
« Last Edit: January 18, 2009, 02:10:50 AM by Juanito »

Offline pema

  • Newbie
  • *
  • Posts: 48
Re: cpufreq, cant get it to work.
« Reply #2 on: January 18, 2009, 02:23:37 PM »
@ juanito. Thank you for reply. Posting outputs here since Im not really sure what Im doing. (btw is there any small tool/prog for copying text from terminal to texteditor ?)
-sudo acpid -f gives nothing, just waiting for getting back to prompt and Im interrupting with cltr-c after a few minutes.
-sudo cpufreq -D gives output, short context:
* pmu/apm unit, no such file or dir
* remote control enabled
* unknown sensor plugin, nobody handles it
* unable to calculate absolute values for all profiles
* unable to normalize frequencies for all profiles
* unable to write pid file /var/run/cpufreqd.pid

- cant find any temperature settings in /etc/cpufreqd.conf
- battery is dead, if i pull the cord the fans stops with the computer.
- after modprobes, lsmod lists lot of modules as fan etc but cant find any cpu or temperature.
- sudo acpid -d -f gives parsing of  conf files for events lm_lid, lm_battery, lm_ac_adapter, all 3 rules loaded.

Cpufan is constantly running when computer is active, shuts off when computer is idle for a couple of minutes, no variation fan speed as with ubuntu. Googled around and saw people are turning off acpi at boot, what would control cpu and fan then ? Hope text is understandable.
//P

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14817
Re: cpufreq, cant get it to work.
« Reply #3 on: January 18, 2009, 11:03:03 PM »
To cut & paste text from a terminal window, highlight it in the terminal window, click in the text editor and then either click with the 3rd mouse button to paste or (if you don't have a 3rd mouse button) click both mouse buttons at the same time to paste.

"sudo acpid -f" doesn't work for me either - as you say, "sudo acpid -f -d" is required. If you get a message about parsing the acpi event files, then I believe this shows acpid is working. I understand you cannot disconnect the power cord, but you could try briefly pressing the power button or closing/opening the lid to see if you get an acpi message shown after "sudo acpid -f -d".

Did you load the cpufreq modules as follows:
Code: [Select]
$ sudo modprobe acpi-cpufreq
$ sudo modprobe cpufreq_conservative
$ sudo modprobe cpufreq_ondemand
$ sudo modprobe cpufreq_powersave
$ sudo modprobe cpufreq_userspace

$ lsmod
Module                  Size  Used by
cpufreq_userspace       4004  0
cpufreq_powersave       2688  0
cpufreq_ondemand        7180  0
cpufreq_conservative     6792  0
acpi_cpufreq            7436  0
freq_table              4256  2 cpufreq_ondemand,acpi_cpufreq
fan                     4996  0
...
battery                11012  0
ac
Note that I believe "acpi-cpufreq" has superceded the cpu-specific modules.

You can then try the following in a new terminal window (with acpid still running in the other window):
Code: [Select]
$ sudo cpufreqd -D -V5
apm_init                 : /proc/apm: No such file or directory
load_plugin_list         : discarded plugin apm
pmu_init                 : /proc/pmu/info: No such file or directory
load_plugin_list         : discarded plugin pmu
tau_init                 : /proc/cpuinfo file found
nforce2_post_conf        : Unconfigured, exiting.
plugins_post_conf        : Unable to configure plugin nforce2_atxp1, removing
cpufreqd_set_profile     : Profile "Performance High" set for CPU0

[disconnect power cord]
cpufreqd_set_profile     : Profile "On Demand High" set for CPU0

reconnect power cord]
cpufreqd_set_profile     : Profile "Performance High" set for CPU0
Note that "-V6" and "-V7" will give even more data, you might want to try this to capture the data in a file to make it easier to check:
Code: [Select]
$ script cpufreqd_log
$ sudo cpufreqd -D -V7
yada..yada
<ctrl-d>
beaver cpufreqd_log &

As you say, you will not be able to disconnect the power cord as in my example, but you could wait and see what happens with the fan.

Note that the part of cpufreqd.conf controlling the temperature is:
Code: [Select]
# CPU Too hot!
[Rule]
name=CPU Too Hot
acpi_temperature=55-100
cpu_interval=50-100
profile=Performance Low
[/Rule]
i.e. if the temperature exceeds 55degC, the "Performance Low" profile will be followed.

Good luck and let me know how you get on.
« Last Edit: January 18, 2009, 11:08:03 PM by Juanito »

Offline pema

  • Newbie
  • *
  • Posts: 48
Re: cpufreq, cant get it to work.
« Reply #4 on: February 17, 2009, 04:12:46 PM »
I have really been struggling with this one but do not have any smart to say. For my computer the only cpu freq driver I can load is powernow-k7,
sudo modprobe acpi-cpufreq gives "error inserting acpi_cpufreq, device or resource busy", but I can see module is available at /lib/modules etc...

Command cpufreqd -D -V7 is "not found".

After "sudo modprobe cpufreq_ondemand" I still have "performance" as governor when doing "cat scaling_governor" in /sys/devices/system/cpu/cpu0/cpufreq, but lsmod shows correct driver and governor. Where is "performance" launched as governor ? It is not listed in laptop-mode config files.
Played around with temperature settings in cpu_freq.conf but could not notice any major difference.

During time I´ve been playing with the crunch bang ubuntu derivate and cpu-throttling works perfect with the powernowd tool.
Unfortunately I removed my tcl when playing with cb, and now I cant get laptop-mode started allthough I have the tce hwmon-cpufreq and cpufreq.tcel modules loaded, there is no laptop-mode prog in sbin or bin, could there be a dependency problem preventing laptop-mode-tools working properly ?
Any ideas ?

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14817
Re: cpufreq, cant get it to work.
« Reply #5 on: February 17, 2009, 11:43:55 PM »
It might be an idea to do this one step at a time - to make sure nothing is corrupted, it would be a good idea to delete hwmon-cpufreq-2.6.26.tcem and cpufreq.tcel, reboot and then download and "tce-load" these two extensions again.

Once this is done, and without starting the acpid or cpufreqd daemons, can you "sudo modprobe acpi-cpufreq"?

What does "which acpid" and "which cpufreqd" give?

Offline pema

  • Newbie
  • *
  • Posts: 48
Re: cpufreq, cant get it to work.
« Reply #6 on: February 23, 2009, 03:56:21 PM »
Ok, reloaded the tce's, sudo modprobe acpi-cpufreq gives error inserting module, device or resource busy. Which acpid gives nothing, which cpufreqd tells /usr/local/sbin/cpufreqd.

Modprobing powernow-k7 always works, and after a couple of reboots I got the laptop_mode started and could get a scaling governor accepted. Seems right now as the cpu-scaling works, hasnt stressed it enough to be sure yet.
As I understand the howtos on internet, acpi is a universal cpu driver, and somehow depends on cpu type, the only driver I get to work is the powernow-k7(tried all) which also is the speced driver for my amd-k6 cpu.
I tried writing the modprobe commands to etc/init.d/rcS and opt/bootlocal.sh, letting them start the cpu-scaling but cant get it to work, can I use same syntax in bootscripts as in terminal ?. Are the rcs and bootlocal.sh "sudo's" ?

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14817
Re: cpufreq, cant get it to work.
« Reply #7 on: February 23, 2009, 10:50:25 PM »
Here's the script I use to start things:
Code: [Select]
#!/bin/sh -e
#
tce-load /mnt/sda1/extensions/hwmon-cpufreq-2.6.26.tcem
#
tce-load /mnt/sda1/source/buildtc/08_10_25/cpufreq.tcel
#
sudo modprobe acpi-cpufreq
sudo modprobe cpufreq_conservative
sudo modprobe cpufreq_ondemand
sudo modprobe cpufreq_powersave
sudo modprobe cpufreq_userspace
#
sudo acpid
sudo cpufreqd
sudo /etc/init.d/laptop-mode start
#
# EOF

Note that "which acpid" should find acpid on your system otherwise the "sudo acpid" line in the script would not work...

If you want the above to happen at boot, you could put the two modules in your /tce folder where they would be auto-loaded at boot and call a script containing the rest of the  commands from bootlocal.sh - note that bootlocal.sh runs as root, so you could remove "sudo" from each of the lines.

Offline pema

  • Newbie
  • *
  • Posts: 48
Re: cpufreq, cant get it to work.
« Reply #8 on: February 24, 2009, 01:51:40 PM »
Yes, thats how I did it, but I still have to start manually in terminal.
Today I cant start laptop_mode, when launching command sudo laptop_mode start, I get laptop mode tools 1.45, next line laptop mode disabled, not active, I have checked all conf files I can find in /etc/ and /proc/acpi.

One thing that bugs me is that Iam not able starting the acpi(I guess I need acpi whatever cpu I have), sudo modprobe acpi-cpufreq gives device or resource busy, it is available in the lib, same for acpid -f -d. I have re-read your advices and tried them over and over again, but Iam not getting the acpi started. Is there any log I can check or command for diagnose ?

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14817
Re: cpufreq, cant get it to work.
« Reply #9 on: February 24, 2009, 10:41:52 PM »
I'm not sure laptop-mode would start reliably without acpid running - also, laptop-mode would start only when the right conditions are met, for example when the power cord is disconnected.

Do you have anything in your boot codes about "apm" or "acpi" that might prevent the acpid daemon from running? Does "dmesg | grep acpi" give any clues?

If you issue the "top" command, does it show that acpid is already running?

Sorry, but without access to the same cpu as you, it's kind of hard to give too many suggestions...

Offline pema

  • Newbie
  • *
  • Posts: 48
Re: cpufreq, cant get it to work.
« Reply #10 on: February 25, 2009, 04:25:16 PM »
Yes I understand you, its difficult when you dont have the tools your self.
The only strange bootcode except the tcelocal etc is nodhcp, tried booting with and without all bootcodes but no difference. I hacked config files for battery/ac, sooner or later I would have got something right. "dmesg | grep acpi" gives nada, but "top" indicates both acpid and cpufreqd running, in the list they differs from other processes, both are run with ppid=1 user=root, all other processes had different numeric values, permission problem ?
I sort of gave up this matter and compiled the powernowd as tce, it seems to work, the tce weighs in at 12kB. Have to test it a bit more to be sure. The powernowd is reported to work with both amd & intel and it is very easily operated, no problems starting, it depends on the hwmon and cpufreq tce modules. Pwrnwd is set to user=755.