Автор Тема: Как настроить частоту процессора в Simly Linux [решено]  (Прочитано 8067 раз)

Оффлайн gBopHuk

  • alt linux team
  • ***
  • Сообщений: 584
  • Simply LInux
    • Email
А при включении в розетку у вас гувернёр меняется на Perfomance?

Онлайн Speccyfighter

  • Мастер
  • ***
  • Сообщений: 7 980
  • UNIX System V init
...
Напомню, что у меня Intel Atom N455
...
Эта же последовательность действий справедлива и для "десктопных" Intel:

# cat /proc/cpuinfo | grep 'model name'
model name : Intel(R) Core(TM)2 Duo CPU     E4700  @ 2.60GHz
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
ondemand performance
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
2600000 2000000 1600000 1200000

В простое:
# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
1200000

Запаковка каталога:
# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
2600000
# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
2000000
# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
2600000
# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
2000000
ZX Spectrum 128K
Привет от NM:  # echo -e "\n[device]\nwifi.scan-rand-mac-address=no" >> /etc/NetworkManager/NetworkManager.conf

Онлайн Speccyfighter

  • Мастер
  • ***
  • Сообщений: 7 980
  • UNIX System V init
Выясняем имеющееся:
$ uname -r
3.0.6-std-def-alt0.M60P.1
# cat /proc/cpuinfo | grep 'model name'
model name : Intel(R) Core(TM)2 Duo CPU     E4700  @ 2.60GHz
model name : Intel(R) Core(TM)2 Duo CPU     E4700  @ 2.60GHz
# modinfo /lib/modules/$(uname -r)/kernel/drivers/cpufreq/* | grep ^[fd]
filename:       /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/acpi-cpufreq.ko
description:    ACPI Processor P-States Driver
depends:        freq_table,processor,mperf
filename:       /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/cpufreq_conservative.ko
description:    'cpufreq_conservative' - A dynamic cpufreq governor for Low Latency Frequency Transition capable processors optimised for use in a battery environment
depends:       
filename:       /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/cpufreq_ondemand.ko
description:    'cpufreq_ondemand' - A dynamic cpufreq governor for Low Latency Frequency Transition capable processors
depends:        freq_table
filename:       /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/cpufreq_powersave.ko
description:    CPUfreq policy governor 'powersave'
depends:       
filename:       /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/cpufreq_stats.ko
description:    'cpufreq_stats' - A driver to export cpufreq stats through sysfs filesystem
depends:        freq_table
filename:       /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/cpufreq_userspace.ko
description:    CPUfreq policy governor 'userspace'
depends:       
filename:       /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/freq_table.ko
description:    CPUfreq frequency table helpers
depends:       
filename:       /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/mperf.ko
depends:       
filename:       /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/p4-clockmod.ko
description:    cpufreq driver for Pentium(TM) 4/Xeon(TM)
depends:        freq_table,speedstep-lib
filename:       /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/pcc-cpufreq.ko
description:    Processor Clocking Control interface driver
depends:        processor
filename:       /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/powernow-k8.ko
description:    AMD Athlon 64 and Opteron processor frequency driver.
depends:        freq_table,processor,mperf
filename:       /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/speedstep-centrino.ko
description:    Enhanced SpeedStep driver for Intel Pentium M processors.
depends:        freq_table
filename:       /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/speedstep-lib.ko
description:    Library for Intel SpeedStep 1 or 2 cpufreq drivers.
depends:       
# ls -1F /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/ | grep cpufreq_
cpufreq_conservative.ko
cpufreq_ondemand.ko
cpufreq_powersave.ko
cpufreq_stats.ko
cpufreq_userspace.ko

# ls -1F /lib/modules/3.0.6-std-def-alt0.M60P.1/kernel/drivers/cpufreq/ | grep freq_table >> /etc/modules
freq_table.ko

Конфигурируем:
# cat /etc/modules

# /etc/modules: kernel modules to load at boot time.
#
# This file should contain the names of kernel modules that are
# to be loaded at boot time, one per line.  Comments begin with
# a `#', and everything on the line after them are ignored.


acpi_cpufreq
cpufreq_conservative
cpufreq_ondemand
cpufreq_powersave
cpufreq_stats
cpufreq_userspace
freq_table
# lsmod|grep cpu
cpufreq_userspace       2328  0
cpufreq_stats           4175  0
cpufreq_powersave       1026  0
cpufreq_ondemand        6509  0
cpufreq_conservative     5671  2
acpi_cpufreq            6323  1
freq_table              3847  3 cpufreq_stats,cpufreq_ondemand,acpi_cpufreq
processor              27006  1 acpi_cpufreq
mperf                   1515  1 acpi_cpufreq
#cat /etc/sysfs.conf

#
# /etc/sysfs.conf - Configuration file for setting sysfs attributes.
#
# The sysfs mount directory is automatically prepended to the attribute paths.
#
# Syntax:
# attribute = value
# mode attribute = 0600 # (any valid argument for chmod)
# owner attribute = root:wheel # (any valid argument for chown)
#
# Examples:
#
# Always use the powersave CPU frequency governor
# devices/system/cpu/cpu0/cpufreq/scaling_governor = powersave
#
# Use userspace CPU frequency governor and set initial speed
# devices/system/cpu/cpu0/cpufreq/scaling_governor = userspace
# devices/system/cpu/cpu0/cpufreq/scaling_setspeed = 600000
#
# Set permissions of suspend control file
# owner power/state = root:power
# mode power/state = 0660
 
devices/system/cpu/cpu0/cpufreq/scaling_governor = conservative
devices/system/cpu/cpu1/cpufreq/scaling_governor = conservative

Получаем на выходе после перезагрузки:
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
conservative
# cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
conservative
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
2600000 2000000 1600000 1200000
# cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_available_frequencies
2600000 2000000 1600000 1200000
# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
1200000
# cat /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_cur_freq
1200000
# cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
2600000 162981
2000000 2943
1600000 1833
1200000 506219

http://kernel.org/doc/Documentation/cpu-freq/
http://kernel.org/doc/Documentation/cpu-freq/user-guide.txt
http://kernel.org/doc/Documentation/cpu-freq/core.txt
http://kernel.org/doc/Documentation/cpu-freq/governors.txt
http://kernel.org/doc/Documentation/cpu-freq/cpu-drivers.txt
http://www.pantz.org/software/cpufreq/usingcpufreqonlinux.html
http://idebian.wordpress.com/2008/06/22/cpu-frequency-scaling-in-linux/
http://www.thinkwiki.org/wiki/How_to_make_use_of_Dynamic_Frequency_Scaling
http://software.intel.com/en-us/articles/enhanced-intel-speedstepr-technology-and-demand-based-switching-on-linux/


P.S.
Жаль что в ALT'е нет пакета cpufrequtils как в Debian. ИМХО удобная наглядная вещь:

# apt-cache show cpufrequtils
Package: cpufrequtils
Priority: optional
Section: admin
Installed-Size: 268
Maintainer: Mattia Dongili <malattia@debian.org>
Architecture: i386
Version: 007-1
Depends: libc6 (>= 2.3), libcpufreq0 (>= 006), debconf (>= 0.5) | debconf-2.0, lsb-base (>= 3.0)
Filename: pool/main/c/cpufrequtils/cpufrequtils_007-1_i386.deb
Size: 39558
MD5sum: d815735f71253d33474670aabebeb27d
SHA1: 4864abd2ffdcff9739ea53a1d5e427d904374703
SHA256: 64442ea0b5a3a539b32459cd5722ff1e9173361f5b1eb0dec1433f006a96814a
Description: utilities to deal with the cpufreq Linux kernel feature
 This package contains two utilities for inspecting and setting the
 CPU frequency through both the sysfs and procfs CPUFreq kernel
 interfaces.
 .
 By default, it also enables CPUFreq at boot time if the correct CPU
 driver is found.
Homepage: http://kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html
Tag: hardware::detection, interface::commandline, role::program, scope::utility, use::configuring, use::viewing
Task: desktop, laptop


# dpkg -L cpufrequtils
/.
/etc
/etc/init.d
/etc/init.d/cpufrequtils
/etc/init.d/loadcpufreq
/usr
/usr/bin
/usr/bin/cpufreq-aperf
/usr/bin/cpufreq-info
/usr/bin/cpufreq-set
/usr/share
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/cpufreq-set.1.gz
/usr/share/man/man1/cpufreq-info.1.gz
/usr/share/man/man1/cpufreq-aperf.1.gz
/usr/share/locale
/usr/share/locale/fr
/usr/share/locale/fr/LC_MESSAGES
/usr/share/locale/fr/LC_MESSAGES/cpufrequtils.mo
/usr/share/locale/de
/usr/share/locale/de/LC_MESSAGES
/usr/share/locale/de/LC_MESSAGES/cpufrequtils.mo
/usr/share/locale/it
/usr/share/locale/it/LC_MESSAGES
/usr/share/locale/it/LC_MESSAGES/cpufrequtils.mo
/usr/share/locale/pt
/usr/share/locale/pt/LC_MESSAGES
/usr/share/locale/pt/LC_MESSAGES/cpufrequtils.mo
/usr/share/locale/cs
/usr/share/locale/cs/LC_MESSAGES
/usr/share/locale/cs/LC_MESSAGES/cpufrequtils.mo
/usr/share/doc
/usr/share/doc/cpufrequtils
/usr/share/doc/cpufrequtils/changelog.Debian.gz
/usr/share/doc/cpufrequtils/copyright
/usr/share/doc/cpufrequtils/examples
/usr/share/doc/cpufrequtils/examples/cpufrequtils.loadcpufreq.sample
/usr/share/doc/cpufrequtils/examples/cpufrequtils.sample
/usr/share/doc/cpufrequtils/README.Debian
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/cpufrequtils



# cpufreq-info
cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0 1
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us.
  hardware limits: 1.20 GHz - 2.60 GHz
  available frequency steps: 2.60 GHz, 2.00 GHz, 1.60 GHz, 1.20 GHz
  available cpufreq governors: userspace, powersave, conservative, ondemand, performance
  current policy: frequency should be within 1.20 GHz and 2.60 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1.20 GHz (asserted by call to hardware).
  cpufreq stats: 2.60 GHz:1.19%, 2.00 GHz:0.12%, 1.60 GHz:0.20%, 1.20 GHz:98.48%  (3136)
analyzing CPU 1:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0 1
  CPUs which need to have their frequency coordinated by software: 1
  maximum transition latency: 10.0 us.
  hardware limits: 1.20 GHz - 2.60 GHz
  available frequency steps: 2.60 GHz, 2.00 GHz, 1.60 GHz, 1.20 GHz
  available cpufreq governors: userspace, powersave, conservative, ondemand, performance
  current policy: frequency should be within 1.20 GHz and 2.60 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1.20 GHz (asserted by call to hardware).
  cpufreq stats: 2.60 GHz:1.07%, 2.00 GHz:0.11%, 1.60 GHz:0.14%, 1.20 GHz:98.68%  (2374)

Да и ядрёных модулей можно было бы и побольше:
# /sbin/modinfo /lib/modules/$(uname -r)/kernel/arch/*/kernel/cpu/cpufreq/* | grep "^[fd]"
filename:       /lib/modules/2.6.32-5-686/kernel/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko
description:    ACPI Processor P-States Driver
depends:        processor
filename:       /lib/modules/2.6.32-5-686/kernel/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.ko
description:    nForce2 FSB changing cpufreq driver
depends:       
filename:       /lib/modules/2.6.32-5-686/kernel/arch/x86/kernel/cpu/cpufreq/gx-suspmod.ko
description:    Cpufreq driver for Cyrix MediaGX and NatSemi Geode
depends:       
filename:       /lib/modules/2.6.32-5-686/kernel/arch/x86/kernel/cpu/cpufreq/longhaul.ko
description:    Longhaul driver for VIA Cyrix processors.
depends:       
filename:       /lib/modules/2.6.32-5-686/kernel/arch/x86/kernel/cpu/cpufreq/longrun.ko
description:    LongRun driver for Transmeta Crusoe and Efficeon processors.
depends:       
filename:       /lib/modules/2.6.32-5-686/kernel/arch/x86/kernel/cpu/cpufreq/p4-clockmod.ko
description:    cpufreq driver for Pentium(TM) 4/Xeon(TM)
depends:        speedstep-lib
filename:       /lib/modules/2.6.32-5-686/kernel/arch/x86/kernel/cpu/cpufreq/powernow-k6.ko
description:    PowerNow! driver for AMD K6-2+ / K6-3+ processors.
depends:       
filename:       /lib/modules/2.6.32-5-686/kernel/arch/x86/kernel/cpu/cpufreq/powernow-k7.ko
description:    Powernow driver for AMD K7 processors.
depends:        processor
filename:       /lib/modules/2.6.32-5-686/kernel/arch/x86/kernel/cpu/cpufreq/powernow-k8.ko
description:    AMD Athlon 64 and Opteron processor frequency driver.
depends:        processor
filename:       /lib/modules/2.6.32-5-686/kernel/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.ko
description:    Enhanced SpeedStep driver for Intel Pentium M processors.
depends:       
filename:       /lib/modules/2.6.32-5-686/kernel/arch/x86/kernel/cpu/cpufreq/speedstep-ich.ko
description:    Speedstep driver for Intel mobile processors on chipsets with ICH-M southbridges.
depends:        speedstep-lib
filename:       /lib/modules/2.6.32-5-686/kernel/arch/x86/kernel/cpu/cpufreq/speedstep-lib.ko
description:    Library for Intel SpeedStep 1 or 2 cpufreq drivers.
depends:       
filename:       /lib/modules/2.6.32-5-686/kernel/arch/x86/kernel/cpu/cpufreq/speedstep-smi.ko
description:    Speedstep driver for IST applet SMI interface.
depends:        speedstep-lib
« Последнее редактирование: 18.10.2011 05:40:49 от Speccyfighter »
ZX Spectrum 128K
Привет от NM:  # echo -e "\n[device]\nwifi.scan-rand-mac-address=no" >> /etc/NetworkManager/NetworkManager.conf

Оффлайн gBopHuk

  • alt linux team
  • ***
  • Сообщений: 584
  • Simply LInux
    • Email
А как заставить sysfs запускаться при выходе из suspend?

Оффлайн gBopHuk

  • alt linux team
  • ***
  • Сообщений: 584
  • Simply LInux
    • Email
Поскольку sysfs запускается только при загрузке/перезагрузке системы, то для смены управляющего при выходе из спящего/ждущего режимов нужно добавить в /etc/pm/sleep.d такой скрипт:

#!/bin/bash
#Activate the ondemand governor on each CPU
case $1 in
thaw)
for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
echo ondemand > $i
done
;;
resume)
for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
echo ondemand > $i
done
;;
esac

Полезно на ноут/нетбуках, потому что если ушёл в спящий режим, выдернул шнур и потом разбудил машину, то управляющий не смениться.

Оффлайн uriukti

  • Давно тут
  • **
  • Сообщений: 27
Вот это действительно важно, только мне как новичку объясните пожалуйста куда добавлять скрипт, и вообще как это делается? Путь я вижу, а вот только у меня там 1 файл и всё. 01 grub. :o

Оффлайн gBopHuk

  • alt linux team
  • ***
  • Сообщений: 584
  • Simply LInux
    • Email
Создать текстовый файл  50cpufreq-ondemand c содержимым, описанным выше.

В свойствах файла сделать его выполняемым. Закинуть в нужную папку из под администратора примерно так:
sudo cp "Путь к файлу" /etc/pm/sleep.d
« Последнее редактирование: 11.11.2011 16:57:02 от gBopHuk »

Оффлайн uriukti

  • Давно тут
  • **
  • Сообщений: 27
Спасибо, gBopHuk !!!

Сделано, проверено, работает !!! )

Оффлайн gBopHuk

  • alt linux team
  • ***
  • Сообщений: 584
  • Simply LInux
    • Email
Апгрежу свой старый пост ибо в нем закралась маленькая ошибочка: При просыпании всегда ставиться ondemand, даже когда провод питая подключен. Посему обновил вид скрипта:
#!/bin/bash
#Activate the ondemand governor on each CPU

perf_st="on-line"
st=$(grep state /proc/acpi/ac_adapter/AC0/state |awk -F: '{print $2 }'|sed 's/^[ \t]*//')

case $1 in
thaw)
               if [ "$st" = "$perf_st" ]
    then  for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
echo performance > $i
done
                  else for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
echo ondemand > $i
done
;;
resume)
                 if [ "$st" = "$perf_st" ]
       then  for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
echo performance > $i
done
                      else for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
echo ondemand > $i
done
;;
esac

По-идее /proc/acpi/ac_adapter/AC0/state должно быть у всех, но могут возникнуть варианты, типа: AC1, AC2 и т.д. Глядеть в папке /proc/acpi/ac_adapter
« Последнее редактирование: 26.11.2011 02:13:30 от gBopHuk »