Bug 181673 - cpuspeed init script might check wrongly the /proc/acpi/processor/CPU0 file
Summary: cpuspeed init script might check wrongly the /proc/acpi/processor/CPU0 file
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: cpuspeed
Version: 4
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Liang Zhang
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-02-15 20:02 UTC by Piergiorgio Sartor
Modified: 2015-04-07 03:06 UTC (History)
1 user (show)

Fixed In Version: FC5
Clone Of:
Environment:
Last Closed: 2006-09-22 02:20:21 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Piergiorgio Sartor 2006-02-15 20:02:13 UTC
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:

/proc/acpi/processor/CPU1/throttling
/proc/acpi/processor/CPU2/throttling

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):
1.2.1-1.24_FC4

How reproducible:
Always.

Steps to Reproduce:
1.
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).
2.
3.
  
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-21 02:06:59 UTC
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
/proc/acpi/processor/CPU0/throttling`
+                                       thr=`head -n1 -q
/proc/acpi/processor/CPU*/throttling | uniq`

That should take care of all cases.


Comment 2 Piergiorgio Sartor 2006-02-21 19:36:40 UTC
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-22 04:18:00 UTC
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-22 02:20:21 UTC
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.