Bug 181673 - cpuspeed init script might check wrongly the /proc/acpi/processor/CPU0 file
cpuspeed init script might check wrongly the /proc/acpi/processor/CPU0 file
Product: Fedora
Classification: Fedora
Component: cpuspeed (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Liang Zhang
Depends On:
  Show dependency treegraph
Reported: 2006-02-15 15:02 EST by Piergiorgio Sartor
Modified: 2015-04-06 23:06 EDT (History)
1 user (show)

See Also:
Fixed In Version: FC5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-09-21 22:20:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Piergiorgio Sartor 2006-02-15 15:02:13 EST
Description of problem:
Well, to start I must say I'm not really sure this is cpuspeed related nor that
this could be intentionally done, anyway here we go.

The init script from cpuspeed checks the throttling capabilities of the CPU with
the following line:

if [ -f /proc/acpi/processor/CPU0/throttling ];

it clearly assume that CPU0 is the right place to look into.
With kernel-2.6.15-1.1831_FC4 this is OK in case of single CPU systems (which is
the common case, I guess).
Unfortunately kernel-2.6.15-1.1831_FC4smp (at least with P4 HT), does not have
this directory, it has:


so it start to count (I dunno why) from 1 instead that from 0 (funny, because
the sys filesystem has cpu0 and cpu1...).
Clearly the init script cannot find "throttling" and so it assumes the
capability is not there.

As said before, this might be a kernel issue, nevertheless I guess that the
script should be somehow more careful in the file test.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
Check the script
Check the /proc/acpi/processor/CPUx on a P4 HT with SMP kernel
(2.6.15-1.1831_FC4 at the time of writing).
Actual results:
The check fails and no throttling capability is detected.

Expected results:
The check should detect that the CPUs have throttling capability.

Additional info:
Actually the script works fine if the /etc/cpuspeed.conf set properly, with the
correct driver (p4-clockmod).
Comment 1 Dave Jones 2006-02-20 21:06:59 EST
Bah, some ACPI BIOSes start counting CPUs at 0, and some at 1.
I'll fix this up by changing /etc/init.d/cpuspeed like so..

-                                       thr=`head -n1
+                                       thr=`head -n1 -q
/proc/acpi/processor/CPU*/throttling | uniq`

That should take care of all cases.
Comment 2 Piergiorgio Sartor 2006-02-21 14:36:40 EST
Well, don't forget to change the "if" too... :-)

Maybe off topic: is there any plan to add an "automatic" module selection?
I mean, right now the user has to explicitly add (and know) the proper "driver"
in /etc/cpuspeed.conf, it would be really good to have it done automatically in
/etc/init.d/cpuspeed, or, like for lm_sensors, having a configuration tool,
which detects the proper driver and, somehow, configures the demon.
Comment 3 Dave Jones 2006-02-21 23:18:00 EST
whoops, I missed the if, thanks for reminding me :)

long-term, I'd like this to 'just work', it's just finding the time to get the
necessary work done.

The init scripts should be able to figure out whats needed just by parsing
/proc/cpuinfo, but it's just not something I've got around to yet.
Maybe during FC6 development I'll find some time to look into it (and then
backport to older releases).
Comment 4 Bill Nottingham 2006-09-21 22:20:21 EDT
Closing bugs in MODIFIED state from prior Fedora releases. If this bug persists
in a current Fedora release (such as Fedora Core 5 or later), please reopen and
set the version appropriately.

Note You need to log in before you can comment on or make changes to this bug.