Bug 886185

Summary: powertop looks in all the wrong places for cpufreq sysfs files
Product: [Fedora] Fedora Reporter: Dave Jones <davej>
Component: powertopAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: jskarvad, metherid, pfrields
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-25 21:44:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Proposed fix sent upstream
none
Proposed fix sent upstream
none
Proposed fix none

Description Dave Jones 2012-12-11 17:52:31 UTC
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 16:05:53 UTC
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 19:17:38 UTC
$ cat /sys/devices/system/cpu/cpu*/topology/physical_package_id
0
0
0
0

Comment 3 Jaroslav Škarvada 2012-12-12 19:26:57 UTC
(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 14:45:26 UTC
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 15:15:55 UTC
(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 16:18:09 UTC
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 16:11:15 UTC
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 12:13:53 UTC
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 12:42:21 UTC
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 19:44:39 UTC
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 21:44:06 UTC
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.