PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : cpuspeed unter Fedora 6



rooter
31.07.07, 10:39
Hallo ihr da,

ich habe ein kleines Problem mit meinem "cpuspeed".
Ich hab das Paket installiert und wenn ich den Daemon starte kommt: "cpuspeed start successful", jedoch steht im Status: "cpuspeed wurde angehalten"
egal ob ich es neustarte, anhalte oder wieder starte.
das verwirrt mich etwas, vielleicht weiß jemand was und kann mir helfen. ich weiß auch nicht, ob das Paket mein CPU überhaupt unterstütz, aber ich glaub schon.

Als System verwende ich "Fedora 6" Kernel 2.6.20-1.2962 auf einem HP compaq nx9105 Notebook.

Danke schonmal im Vorraus

asi_dkn
01.08.07, 11:04
also wenn du genau wissen willst was der da abfragt, dann schau der das script (/etc/init.d/cpuspeed oder so) mal im vi an. Dann solltest du auch sehen was er abfragt wenn du "status" eingibst. er wird irgend ein PID File abfragen welches nicht exisitert und darum sagen das der nicht läuft.

versuche mal mit folgendem befehl nach dem start zu kontrollieren ob cpuspeed wirklich nicht funktioniert:

ps -ef | grep cpuspeed

wenn da nix steht, dann läuft er auch nicht (es sei denn der prozess hätte einen anderen namen, so genau weiss ich das nicht).

du kannst den cpuspeed daemon auch von hand starten und eventuell noch mit ein paar logging optionen versehen. dann siehst du allenfalls wo der sich verabschiedet wenn er nicht richtig starten will.

rooter
01.08.07, 14:35
Danke für deine Antwort.
Also in der Datei habe ich nicht wirklich was interessantes gefunden, aber bei dem Befehl

ps -ef | grep cpuspeed
hab ich das hier bekommen:

# ps -ef | grep cpuspeed
root 3590 3415 0 15:28 pts/1 00:00:00 grep cpuspeed

das müsste ja dann heißen, dass er läuft oder?
naja, jetzt weiß ich wenigstens dass er funktioniert und läuft. also is die info bei "status" falsch

asi_dkn
01.08.07, 19:00
neee, das ist dein grep auf cpuspeed den du da siehst, der läuft als nicht. ich weiss nicht wie das init.d file für cpuspeed unter FC6 aussieht, aber da würde ich mal reingucken was der genau macht, eventuell findest du dort des rätsels lösung.

zusätzlich würde ich den auch mal von hand starten um zu sehen ob der warnungen oder fehler wirft.

rooter
01.08.07, 19:35
aso ok,
wie starte ich den am besten von Hand??
hmm ich weiß auch nicht wie die Datei aussehen sollte, vielleicht können sie sich die mal anschauen?
^^ Ich bin jetzt mal frech und machs hier rein

#!/bin/sh
# Startup script for cpuspeed
#
# chkconfig: 12345 06 99
# description: Run dynamic CPU speed daemon and/or load appropriate
# cpu frequency scaling kernel modules and governors

# Source function library.
. /etc/rc.d/init.d/functions

[ -f /usr/sbin/cpuspeed ] || exit 0

prog="cpuspeed"

# Get config.
if [ -f /etc/cpuspeed.conf ]; then
. /etc/cpuspeed.conf
fi

cpu0freqd=/sys/devices/system/cpu/cpu0/cpufreq
cpus='/sys/devices/system/cpu/cpu[0-9]*'
testpat="${cpus}/cpufreq/scaling_driver"
lockfile="/var/lock/subsys/$prog"
xendir="/proc/xen"
logger="/usr/bin/logger -p info -t cpuspeed"
IGNORE_NICE=${IGNORE_NICE:-0}
module_loaded=false

some_file_exist() {
while [ "$1" ] ; do
[ -f "$1" ] && return 0
shift
done
return 1
}

governor_is_module() {
# Check to see if the requested cpufreq governor
# is provided as a kernel module or not
module_info=`/sbin/modinfo cpufreq-${governor} 2>&1 > /dev/null`
return $?
}

governor_module_loaded() {
# Check to see if we have a module loaded for
# the current cpufreq governor
if [ -e ${cpu0freqd}/scaling_governor ]; then
governor=`cat ${cpu0freqd}/scaling_governor`
else
governor="none"
fi
if [ "${governor}" != "none" -a `/sbin/lsmod | grep -c -w "cpufreq.${governor}"` -ge 1 ] ; then
return 0
fi
return 1
}

adjust_cpufreq() {
# First arg is a param under $cpu/cpufreq/
# Second arg is the value you want to set that param to
for cpu in ${cpus}; do
echo $2 > $cpu/cpufreq/$1
done
}

start_cpuspeed() {
echo -n $"Starting $prog: "
# cpuspeed daemon thresholds are specified as idle percentages,
# cpufreq modules as busy percentages, so we need to do some
# math here for use of unified config...
# DOWN_THRESHOLD doesn't mean exactly the same thing for
# cpuspeed as it does for the cpufreq governors, but close
# enough, and if not specified, we use same defaults as governors.
if [ -n "$UP_THRESHOLD" ]; then
let UP_THRESHOLD=100-$UP_THRESHOLD
else
UP_THRESHOLD=20
fi
if [ -n "$DOWN_THRESHOLD" ]; then
let DOWN_THRESHOLD=100-$DOWN_THRESHOLD
else
DOWN_THRESHOLD=80
fi
OPTS="$OPTS -p $UP_THRESHOLD $DOWN_THRESHOLD"
if [ -n "$MIN_SPEED" ]; then
OPTS="$OPTS -m $MIN_SPEED"
fi
if [ -n "$MAX_SPEED" ]; then
OPTS="$OPTS -M $MAX_SPEED"
fi
if [ "$IGNORE_NICE" -eq 0 ]; then
OPTS="$OPTS -n"
fi
daemon cpuspeed -d $OPTS
RETVAL=$?
return $RETVAL
}

stop_cpuspeed() {
if [ -n "`pidof cpuspeed`" ]; then
echo -n $"Stopping $prog: "
killproc cpuspeed -USR1
killproc cpuspeed -INT
fi
if [ -n "`pidof cpuspeed`" ]; then
killproc cpuspeed
fi
RETVAL=$?
return $RETVAL
}

start() {
if [ ! -f $lockfile ] && [ ! -d "$xendir" ]; then
if ! some_file_exist $testpat ; then
# Attempt to load scaling_driver if not loaded
# but it is configured

if [ -n "$DRIVER" ]; then
/sbin/modprobe "$DRIVER"
else
if [ -d /proc/acpi ] &&
grep flags /proc/cpuinfo | \
grep -q est ; then
# use ACPI as a fallback
/sbin/modprobe acpi-cpufreq 2> /dev/null
# if even ACPI didn't work, remove it
# and then next test will bail out.
[ -d ${cpu0freqd} ] || \
/sbin/modprobe -r acpi-cpufreq 2> /dev/null
else
# No scaling. Just exit.
return 0
fi
fi
fi

# If we get this far with no driver, we must have no scaling.
# We're doomed.
[ ! -f ${cpu0freqd}/scaling_driver ] && return 0

drv=`cat ${cpu0freqd}/scaling_driver`

case "$drv" in
centrino|powernow-k8|p4-clockmod|acpi-cpufreq|e_powersaver)
default_governor=ondemand
;;
*)
default_governor=userspace
;;
esac
governor=${GOVERNOR:-${default_governor}}
governor_is_module && /sbin/modprobe cpufreq-${governor}
if [ `grep -c -w ${governor} ${cpu0freqd}/scaling_available_governors` -ge 1 ] ; then
$logger "Enabling ${governor} cpu frequency scaling governor"
else
$logger "Invalid governor \"${governor}\" specified, falling back to ${default_governor}"
governor_is_module && /sbin/modprobe -r cpufreq-${governor}
governor=${default_governor}
governor_is_module && /sbin/modprobe cpufreq-${governor}
fi
adjust_cpufreq scaling_governor ${governor}
# cpuspeed daemon only runs w/userspace governor
if [ "${governor}" == "userspace" ]; then
start_cpuspeed
RETVAL=$?
else
if [ -n "$MIN_SPEED" ]; then
adjust_cpufreq scaling_min_freq $MIN_SPEED
fi
if [ -n "$MAX_SPEED" ]; then
adjust_cpufreq scaling_max_freq $MAX_SPEED
fi
if [ -n "$UP_THRESHOLD" -a ${governor} == "ondemand" ]; then
adjust_cpufreq ondemand/up_threshold $UP_THRESHOLD
fi
if [ -n "$DOWN_THRESHOLD" -a ${governor} == "conservative" ]; then
adjust_cpufreq conservative/down_threshold $DOWN_THRESHOLD
fi
if [ "$IGNORE_NICE" -eq 1 -a ${governor} == "ondemand" -o ${governor} == "conservative" ]; then
adjust_cpufreq ${governor}/ignore_nice_load $IGNORE_NICE
fi
echo -n "Enabling ${governor} cpu frequency scaling: "
success
RETVAL=0
fi
echo
# Technically, not quite right in non-cpuspeed daemon
# cases, but close enough to indicate that we're
# doing some sort of cpu frequency scaling.
[ $RETVAL = 0 ] && touch $lockfile
else
if [ -d "$xendir" ]; then
$logger "CPU Frequency scaling is currently not supported on xen kernels"
fi
return 0
fi
return $RETVAL
}

stop() {
[ ! -f ${cpu0freqd}/scaling_driver ] && return 0
drv=`cat ${cpu0freqd}/scaling_driver`
governor_module_loaded && module_loaded=true

if [ "${governor}" != "userspace" ]; then
echo -n "Disabling ${governor} cpu frequency scaling: "
$logger "Disabling ${governor} cpu frequency scaling governor"
for cpu in ${cpus}
do
echo userspace > $cpu/cpufreq/scaling_governor
cat $cpu/cpufreq/cpuinfo_max_freq > $cpu/cpufreq/scaling_setspeed
done
if [ $module_loaded == true ]; then
/sbin/modprobe -r cpufreq-${governor}
fi
success
RETVAL=0
else
stop_cpuspeed
RETVAL=$?
fi
echo
[ -n "$DRIVER" ] && /sbin/modprobe -r $DRIVER
[ $RETVAL = 0 ] && RETVAL=$?
[ $RETVAL = 0 ] && rm -f $lockfile
return $RETVAL
}

case "$1" in
start)
start
;;

stop)
stop
;;

status)
governor_module_loaded && module_loaded=true
if [ -d "$xendir" ]; then
echo "Frequency scaling not supported under xen kernels"
elif [ $module_loaded == true -o ${governor} == "performance" ]; then
echo "Frequency scaling enabled using ${governor} governor"
else
status cpuspeed
fi
;;
restart)
stop
start
;;
condrestart)
governor_module_loaded && module_loaded=true
if [ $module_loaded == true -o \
-n "`pidof cpuspeed`" -o \
${governor} == "performance" ] ; then
stop
start
fi
;;

*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1

esac

exit $RETVAL