Bug 886185 - powertop looks in all the wrong places for cpufreq sysfs files
powertop looks in all the wrong places for cpufreq sysfs files
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: powertop (Show other bugs)
18
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jaroslav Škarvada
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-11 12:52 EST by Dave Jones
Modified: 2015-01-04 17:31 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-01-25 16:44:05 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Proposed fix sent upstream (1.58 KB, patch)
2012-12-12 11:05 EST, Jaroslav Škarvada
no flags Details | Diff
Proposed fix sent upstream (5.00 KB, patch)
2012-12-13 09:45 EST, Jaroslav Škarvada
no flags Details | Diff
Proposed fix (398 bytes, patch)
2013-01-14 11:11 EST, Jaroslav Škarvada
no flags Details | Diff

  None (edit)
Description Dave Jones 2012-12-11 12:52:31 EST
Trying to find scaling_governor

open("/sys/devices/system/cpu/cpufreq/cpufreq/scaling_governor", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/sys/devices/system/cpu/cpuidle/cpufreq/scaling_governor", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/sys/devices/system/cpu/release/cpufreq/scaling_governor", O_RDONLY) = -1 ENOTDIR (Not a directory)
open("/sys/devices/system/cpu/power/cpufreq/scaling_governor", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/sys/devices/system/cpu/probe/cpufreq/scaling_governor", O_RDONLY) = -1 ENOTDIR (Not a directory)
open("/sys/devices/system/cpu/modalias/cpufreq/scaling_governor", O_RDONLY) = -1 ENOTDIR (Not a directory)
open("/sys/devices/system/cpu/kernel_max/cpufreq/scaling_governor", O_RDONLY) = -1 ENOTDIR (Not a directory)
open("/sys/devices/system/cpu/possible/cpufreq/scaling_governor", O_RDONLY) = -1 ENOTDIR (Not a directory)
open("/sys/devices/system/cpu/online/cpufreq/scaling_governor", O_RDONLY) = -1 ENOTDIR (Not a directory)
open("/sys/devices/system/cpu/offline/cpufreq/scaling_governor", O_RDONLY) = -1 ENOTDIR (Not a directory)
open("/sys/devices/system/cpu/uevent/cpufreq/scaling_governor", O_RDONLY) = -1 ENOTDIR (Not a directory)
open("/sys/devices/system/cpu/microcode/cpufreq/scaling_governor", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/sys/devices/system/cpu/present/cpufreq/scaling_governor", O_RDONLY) = -1 ENOTDIR (Not a directory)

most of those files aren't even subdirectories.
It should be looking in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor only.



Other parts of this code also seem to be doing crazy things..

open("/sys/devices/system/cpu/cpu1330597711/cpufreq/scaling_max_freq", O_RDONLY) = -1 ENOENT (No such file or directory)
Comment 1 Jaroslav Škarvada 2012-12-12 11:05:53 EST
Created attachment 662423 [details]
Proposed fix sent upstream

(In reply to comment #0)
Thanks for the report.
> most of those files aren't even subdirectories.
> It should be looking in
> /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor only.
> 
<nitpick>This would also match /sys/devices/system/cpu/cpufreq/cpufreq/scaling_governor as well :)</nitpick>

Patch that tries to address this was sent upstream.

> 
> 
> Other parts of this code also seem to be doing crazy things..
> 
> open("/sys/devices/system/cpu/cpu1330597711/cpufreq/scaling_max_freq",
> O_RDONLY) = -1 ENOENT (No such file or directory)

Strange, could you provide content of your:
/sys/devices/system/cpu/cpu[0-9]+/topology/physical_package_id
Comment 2 Dave Jones 2012-12-12 14:17:38 EST
$ cat /sys/devices/system/cpu/cpu*/topology/physical_package_id
0
0
0
0
Comment 3 Jaroslav Škarvada 2012-12-12 14:26:57 EST
(In reply to comment #2)
> $ cat /sys/devices/system/cpu/cpu*/topology/physical_package_id
> 0
> 0
> 0
> 0

Thanks, currently I am not sure from where the cpu1330597711 came, I am unable to reproduce this on my machines. I will try to dig deep into the code.
Comment 4 Jaroslav Škarvada 2012-12-13 09:45:26 EST
Created attachment 663007 [details]
Proposed fix sent upstream

New version of the patch removing more useless 'open' syscalls.
Comment 5 Jaroslav Škarvada 2012-12-13 10:15:55 EST
(In reply to comment #2)
> $ cat /sys/devices/system/cpu/cpu*/topology/physical_package_id
> 0
> 0
> 0
> 0

Could you provide the content of your /proc/cpuinfo?
Comment 6 Dave Jones 2012-12-13 11:18:09 EST
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
stepping	: 9
microcode	: 0x13
cpu MHz		: 1200.000
cache size	: 4096 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 2
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips	: 5787.16
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
stepping	: 9
microcode	: 0x13
cpu MHz		: 1200.000
cache size	: 4096 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 2
apicid		: 1
initial apicid	: 1
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips	: 5787.16
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 2
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
stepping	: 9
microcode	: 0x13
cpu MHz		: 2901.000
cache size	: 4096 KB
physical id	: 0
siblings	: 4
core id		: 1
cpu cores	: 2
apicid		: 2
initial apicid	: 2
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips	: 5787.16
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 3
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
stepping	: 9
microcode	: 0x13
cpu MHz		: 1200.000
cache size	: 4096 KB
physical id	: 0
siblings	: 4
core id		: 1
cpu cores	: 2
apicid		: 3
initial apicid	: 3
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips	: 5787.16
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:
Comment 7 Jaroslav Škarvada 2013-01-14 11:11:15 EST
Created attachment 678277 [details]
Proposed fix

I finally was able to reproduce the "strange CPU number" issue on similar machine. Proposed fix was sent upstream, please check the scratch build whether it fixes the problem for you:
http://koji.fedoraproject.org/koji/taskinfo?taskID=4867426
Comment 8 Jaroslav Škarvada 2013-01-15 07:13:53 EST
Patches got accepted by upstream, I am releasing the fix. Feel free to reopen if the problem persist.
Comment 9 Fedora Update System 2013-01-15 07:42:21 EST
powertop-2.2-4.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/powertop-2.2-4.fc18
Comment 10 Fedora Update System 2013-01-16 14:44:39 EST
Package powertop-2.2-4.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing powertop-2.2-4.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-0877/powertop-2.2-4.fc18
then log in and leave karma (feedback).
Comment 11 Fedora Update System 2013-01-25 16:44:06 EST
powertop-2.2-4.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

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