Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 243008 - sys-power/cpufrequtils-005 init script typo causes daemon to run with stop options
Summary: sys-power/cpufrequtils-005 init script typo causes daemon to run with stop op...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Mobile Herd (OBSOLETE)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-21 08:01 UTC by konsti
Modified: 2008-10-22 10:21 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch to fix init script (cpufrequtils-init.d-005.patch,352 bytes, patch)
2008-10-21 08:45 UTC, Rene Meier
Details | Diff
multi cpu patch for cpufrequtils-init.d-005 (cpufrequtils-init.d-005.patch,880 bytes, patch)
2008-10-21 12:28 UTC, Rene Meier
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description konsti 2008-10-21 08:01:42 UTC
Or - also possible, it sets always stop options even if starting.

On my system this release behaves weird, sets performance governor but points out to have installed ondemand though:

 > cat scaling_available_frequencies scaling_available_governors
3166000 2670000 2336000 2003000
ondemand performance
 > /etc/init.d/cpufrequtils start
cpufrequtils      | * Running cpufreq-set --governor ondemand ...
 > cat scaling_cur_freq scaling_governor
3166000
performance

Running by Hand:

 > cpufreq-set --governor ondemand
 > cat scaling_cur_freq scaling_governor
2003000
ondemand

The last is the expected nehaviour, the -dv debug output of initscript also says running "cpufreq-set --governor ondemand" but it is doing something else...
Comment 1 konsti 2008-10-21 08:13:21 UTC
strace -fF when starting, excerpt:

31340 execve("/lib/rc/bin/ebegin", ["ebegin", "Running cpufreq-set --governor o"...], [/* 37 vars */] <unfinished ...>



31341 execve("/usr/bin/cpufreq-set", ["cpufreq-set", "--governor", "performance"], [/* 37 vars */] <unfinished ...>

31341 open("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", O_WRONLY) = 3
31341 write(3, "performance"..., 11)    = 11
Comment 2 Rene Meier 2008-10-21 08:42:09 UTC
i think the init script is wrong. there are two start functions... i think its a copy and paste error.
start() {
        ebegin "Running cpufreq-set ${START_OPTS}"
        cpufreq-set ${START_OPTS}
        eend $?
}

start() {
        ebegin "Running cpufreq-set ${START_OPTS}"
        cpufreq-set ${STOP_OPTS}
        eend $?
}
Comment 3 Rene Meier 2008-10-21 08:45:03 UTC
Created attachment 169266 [details, diff]
patch to fix init script
Comment 4 konsti 2008-10-21 09:01:58 UTC
*ARGH*

I investigated the init script but did not see the doubled start function and missing stop part ;-)
The fix solves this. Weird thing is verbose printing is done with first and execve with cpufreq-set is done with second start function ;-)
Comment 5 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2008-10-21 11:18:35 UTC
Another problem is that this init script only affects the first CPU. Any other CPU is happily ignored by this init script (this is not nice on a dual quad-core machine...)

How about something like this? (taken from bug #190997)

local cpu n
for cpu in /sys/devices/system/cpu/cpu[0-9]*; do
    n=${cpu##*cpu}
    cpufreq-set -c ${n} ${START_OPTS}
done
eend $?
Comment 6 Rene Meier 2008-10-21 12:21:18 UTC
(In reply to comment #5)
> Another problem is that this init script only affects the first CPU. Any other
> CPU is happily ignored by this init script (this is not nice on a dual
> quad-core machine...)
you are right. i will attach a changed patch.
Comment 7 Rene Meier 2008-10-21 12:28:10 UTC
Created attachment 169304 [details, diff]
multi cpu patch for cpufrequtils-init.d-005
Comment 8 SpanKY gentoo-dev 2008-10-21 21:20:35 UTC
hmm, some systems will set states for all procs regardless.  my amd64 4200+ will change both cpus even if no -c is specified.

fixed with 005-r1 at any rate
http://sources.gentoo.org/sys-power/cpufrequtils/files/cpufrequtils-init.d-005?r1=1.1&r2=1.2
Comment 9 Rene Meier 2008-10-22 07:12:18 UTC
(In reply to comment #8)
> hmm, some systems will set states for all procs regardless.
you are right. it works on multi core systems for all cores if you change the states of one. apparently because cpus do not support different clockspeeds for the cores of one chip. if you have a multi chip system then you have to change the states of every chip.
Comment 10 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2008-10-22 10:21:44 UTC
The K9 dual-core chips from AMD cannot have different clock speeds for each core but the K10 chips (phenom, barcelona) can have each core set to another frequency independent from the other cores.