Posts: 1,028
SamK
Joined: 21 Aug 2011
#1
I'm trying to get a grip on CPU frequency scaling in antiX-12-Full. There are a few forum posts relating to M-11. There seems to be nothing that helps much with the standard antiX-12 and kernel. A couple of wiki articles from Debian and Arch add to the confusion.

========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"https://wiki.archlinux.org/index.php/CPU_Frequency_Scaling"
linktext was:"https://wiki.archlinux.org/index.php/CP ... cy_Scaling"
====================================


========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://wiki.debian.org/HowTo/CpuFrequencyScaling"
linktext was:"http://wiki.debian.org/HowTo/CpuFrequencyScaling"
====================================


Is anyone able to throw any light on this topic? Hopefully someone might offer a thumbnail or outine of the steps required.

The Arch wiki suggests that a frequency scaling driver is required at an early stage. It goes on to note that since v3.4 it is now included in the kernel. Is this also the case for antiX-12? If so is it acpi_cpufreq?

Both the Arch and Debian wikis describe the use of scaling governors. This particular laptop reports

Code: Select all

lsmod | grep cpufreq
cpufreq_userspace      1364  0
cpufreq_stats          2014  0
cpufreq_powersave       574  0
The wikis mention govenors named"ondemand" and"conservative". Neither of these are able to be loaded via modprobe. The Arch wiki states that"ondemand" and"performance" governors are now built into the kernel. Is the the case with antiX-12?

Loading looks to be conducted via / etc/init.d/cpufrequtils.

Code: Select all

/ etc/init.d/cpufrequtils start
[ ok ] CPUFreq Utilities: Setting ondemand CPUFreq governor...disabled, governor not available...done.
A similar message is seen at each bootup. Internally the file references a non-existant path

Code: Select all

...
# Which governor to use. Must be one of the governors listed in:
#   cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
#
# and which limits to set. Both MIN_SPEED and MAX_SPEED must be values
# listed in:
#   cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
# a value of 0 for any of the two variables will disabling the use of 
# that limit variable.
#
# WARNING: the correct kernel module must already be loaded or compiled in.
# 
# Set ENABLE to"true" to let the script run at boot time.
# 
# eg:   ENABLE="true"
#       GOVERNOR="ondemand"
#       MAX_SPEED=1000
#       MIN_SPEED=500

ENABLE="true"
GOVERNOR="ondemand"
MAX_SPEED="0"
MIN_SPEED="0"

check_governor_avail() {
        info="/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors"
        if [ -f $info ] && grep -q"\<$GOVERNOR\>" $info ; then
                return 0;
        fi
        return 1;
}
...
The path is OK upto /sys/devices/system/cpu/cpu0 but invalid thereafter, so the scaling_available_govenors cannot be found and scaling_available_frequencies cannot be obtained.
Posts: 1,308
BitJam
Joined: 31 Aug 2009
#2
I don't have a complete answer for you but I do have a tip. Answers to most questions about the kernel configuration can be found in the file /proc/config.gz. For example:

Code: Select all

$ zgrep CPU_FREQ /proc/config.gz
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
CONFIG_CPU_FREQ_STAT=m
# CONFIG_CPU_FREQ_STAT_DETAILS is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=m
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
Both"ondemand" and"conservative" are built into the kernel which is why they don't show up as modules. I don't know why frequency scaling does not work for you. I don't even know if the problem is specific to your machine.
Posts: 1,028
SamK
Joined: 21 Aug 2011
#3
BitJam wrote:Answers to most questions about the kernel configuration can be found in the file /proc/config.g
Thanks that is helpful to know.

Confirming the kernel configuration here:

Code: Select all

zgrep CPU_FREQ /proc/config.gz
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
CONFIG_CPU_FREQ_STAT=m
# CONFIG_CPU_FREQ_STAT_DETAILS is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=m
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
A frequency scaling driver is not listed.

Code: Select all

zgrep ACPI_CPUFREQ /proc/config.gz
CONFIG_X86_ACPI_CPUFREQ=m
Presuming this indicates a module is available, check if it is already loaded

Code: Select all

lsmod | grep acpi
returns blank
Attempt to load the module

Code: Select all

modprobe --verbose --dry-run acpi_cpufreq
insmod /lib/modules/3.5.0-antix.2-486-smp/kernel/drivers/cpufreq/acpi-cpufreq.ko 
modprobe --verbose acpi_cpufreq
insmod /lib/modules/3.5.0-antix.2-486-smp/kernel/drivers/cpufreq/acpi-cpufreq.ko 
ERROR: could not insert 'acpi_cpufreq': No such device
Try again using hyphen rather than underscore in module name
modprobe --verbose acpi-cpufreq
insmod /lib/modules/3.5.0-antix.2-486-smp/kernel/drivers/cpufreq/acpi-cpufreq.ko 
ERROR: could not insert 'acpi_cpufreq': No such device
Verify what is present in directory

Code: Select all

ls -1 /lib/modules/3.5.0-antix.2-486-smp/kernel/drivers/cpufreq
acpi-cpufreq.ko
cpufreq-nforce2.ko
cpufreq_powersave.ko
cpufreq_stats.ko
cpufreq_userspace.ko
e_powersaver.ko
gx-suspmod.ko
longhaul.ko
longrun.ko
mperf.ko
p4-clockmod.ko
pcc-cpufreq.ko
powernow-k6.ko
powernow-k7.ko
powernow-k8.ko
speedstep-centrino.ko
speedstep-ich.ko
speedstep-lib.ko
speedstep-smi.ko
So the module is present but modprobe does not load it.
Attempt to force loading

Code: Select all

 modprobe --verbose --force acpi_cpufreq
insmod /lib/modules/3.5.0-antix.2-486-smp/kernel/drivers/cpufreq/acpi-cpufreq.ko 
ERROR: could not insert 'acpi_cpufreq': Exec format error
Is there a simple means of definitively establishing if this is a software issue, incorrect use, or one of hardware incompatibilty (which I suspect in this case)?
Alanarchy
Posts 0
Alanarchy
#4
Is there a simple means of definitively establishing if this is a software issue, incorrect use, or one of hardware incompatibilty (which I suspect in this case)?
As in, if you have an older CPU it is never going to work? __{{emoticon}}__
Posts: 1,028
SamK
Joined: 21 Aug 2011
#5
Alanarchy wrote:As in, if you have an older CPU it is never going to work? __{{emoticon}}__
I intended to feed back on this a while ago, but real life sometimes gets in the way.

The most ancient of machines may have a CPU that does not support frequency scaling. The machine under test is old and does support it. The defaults used by antiX-12 appear to suit modern kit but not older hardware.

Some of the following is based on my fallible recall...

antiX-12 attempts to use the acpi-cpufreq driver by default. This is not appropriate for the test laptop and is therefore not loaded. Despite the failure to load the driver, antiX-12 continues to load some governors. In this mixed condition it is easy to misinterpret CPU frequency scaling as operational. It is not transparent why error messages are obtained reporting governors are unavailable when governors are loaded.

CPU frequency scaling works OK on the laptop when one of the various alternative drivers provided by antiX-12 is loaded.

To get to a working condition may be an iterative process involving some trial and error. It involves three discrete but related elements.
  • Ensure a suitable CPU driver is loaded.
    This is the part that conducts the switching to a different frequency. Driver suitability depends on the type of CPU. The links in the opening post are useful. The Archlinux link has helpful information on CPU drivers in the referenced page. antiX-12 has various CPU drivers and scaling governors in /lib/modules/3.5.0-antix.2-486-smp/kernel/drivers/cpufreq
  • Ensure a suitable governor module is loaded.
    This is the part that passes the instruction to switch to a different frequency to the CPU driver. The stock antiX-12 kernel includes conservative, ondemand, and powersave. An alternative scaling governor module may need to be explicitly loaded.
  • Ensure a suitable configuration is used to start CPU frequency scaling.
    This is the part that instructs the governor when and how to switch frequency. For this, antiX-12 uses / etc/init.d/cpufrequtils in order to have it automatically start at bootup. This file should be edited to indicate the governor to which the configuration is sent, and the parameters the governor is to use.

Suggestions
  • As antiX is aimed at both modern and older hardware, it would be preferable if it's out-of-the-box defaults for CPU frequency scaling were able to automatically accommodate more than the single driver, acpi-cpufreq.
  • Additionally, in cases where loading the CPU driver fails, it would be preferable for no governors to be loaded.
  • Hopefully not a sore point, some guidance documentation on the topic might become available.
Last edited by SamK on 13 Dec 2012, 09:43, edited 1 time in total.
Posts: 2,238
dolphin_oracle
Joined: 16 Dec 2007
#6
SamK, if you don't mind me asking, which cpu/laptop were you using?
Posts: 1,028
SamK
Joined: 21 Aug 2011
#7
dolphin_oracle wrote:SamK, if you don't mind me asking, which cpu/laptop were you using?
I don't mind at all. This was post may be what you're after. post26459.html?hilit=Starbook#p26459
Posts: 1,028
SamK
Joined: 21 Aug 2011
#8
Remembered some more infomation so added it to this post post27163.html?hilit=cpufreq#p27163 to keep it together, in the hope that it might help other antiX-12 users.
Alanarchy
Posts 0
Alanarchy
#9
So how do we with an Aphlon, or Duron, K7 processor, disable it completely so the error messages go away?

And what if we are more inclined to overclock the processor? As in, having spent ages tweaking the BIOS to give maximum performance why would I want the OS reducing performance? Especially considering that I originally switched to Linux because it gives better performance, and I switched to AntiX because it gives the best performance of any OS I've tried, including Arch.
Alanarchy
Posts 0
Alanarchy
#10
After all Anticapitalista described AntiX as the Triumph Bonneville of the computing world. Now I don't know anybody who ever fitted a governor to his Bonnie, while I do know a guy who spent nine months in hospital and has three steel pins in his leg to this day through trying to make it go faster.
Posts: 2,238
dolphin_oracle
Joined: 16 Dec 2007
#11
I dusted off (literally) a 900 mhz AMD duron sony laptop. I forgot how heavy laptops used to be. At any rate, during boot, the sony/duron automatically skips the acpi-cpufreq driver module and uses the powernow-k7 driver instead. the governors in the kernel will also work with that driver.

Perhaps there is some sort of issue with detecting the hardware for that clevo/starbook?

I'm not an expert with modprobe, but I would think that you could load manually one of the other cpu freq drivers and once you know which one is correct modify the startup script to do load during boot. rc.local maybe?

i tested with the current antix M12 full iso.

***edit*** actually we can specify a cpu freq driver by placing a special .conf file in etc / modules-load.d . The arch wiki you mention has the details.
Posts: 1,028
SamK
Joined: 21 Aug 2011
#12
Alanarchy wrote:So how do we with an Aphlon, or Duron, K7 processor, disable it completely so the error messages go away?
I have not tested any of those CPUs and as you haven't indicated the actual error messages only generic suggestions are offered.

You may want to investigate preventing the automatic startup and configuration script (/ etc/init.d/cpufrequtils) from running at bootup. This is done with the command update-rc.d. Have a look at the man page as it contains some examples of it use (man update-rc.d).

The system may still try and load kernel modules. If so it might be worth investigating preventing this by blacklisting them.
Posts: 1,028
SamK
Joined: 21 Aug 2011
#13
dolphin_oracle wrote:I dusted off (literally) a 900 mhz AMD duron sony laptop. I forgot how heavy laptops used to be. At any rate, during boot, the sony/duron automatically skips the acpi-cpufreq driver module and uses the powernow-k7 driver instead. the governors in the kernel will also work with that driver.
That is good to hear.
dolphin_oracle wrote:I'm not an expert with modprobe, but I would think that you could load manually one of the other cpu freq drivers and once you know which one is correct modify the startup script to do load during boot.
Thanks for this idea. If you refer back to the earlier post post27163.html?hilit=cpufreq#p27163 you will see that I mentined that I did get it to work with an alternative driver and although it is not mentioned also had it automatically starting at bootup.
Posts: 2,238
dolphin_oracle
Joined: 16 Dec 2007
#14
@SamK - I suspected you had it running. __{{emoticon}}__
anticapitalista
Posts: 5,955
Site Admin
Joined: 11 Sep 2007
#15
Minor point.
When installing antiX to hard drive via gui installer, you have the option to disable cpufrequtils.