FS#43910 - [linux / drm?] High idle CPU freq for Haswell Refresh CPU

Attached to Project: Arch Linux
Opened by John (graysky) - Sunday, 22 February 2015, 12:07 GMT
Last edited by Andreas Radke (AndyRTR) - Monday, 09 November 2015, 13:47 GMT
Task Type Bug Report
Category Kernel
Status Closed
Assigned To Tobias Powalowski (tpowa)
Jan de Groot (JGC)
Andreas Radke (AndyRTR)
Laurent Carlier (lordheavy)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

My i7-4790k with onboard GPU on a fresh install of Arch idles at much higher CPU frequencies compared to the very same hardware booted into either Ubuntu 15.04 (vivid-desktop-amd64.iso 21-Feb-2015 08:35) or into Fedora 21.

In order to support the new CPU, I ran i7z-git[1] while idle in Xorg collecting about 10 min of CPU freq (i7z -w a to write log files). I repeated this for Arch, Fedora, and Ubuntu. When I plot them in simple histograms (attached to this FS), there is a clear bias for higher frequencies under Arch (dark blue) compared to Ubuntu (brown) and Fedora (green). The median idle value is ~4x higher under Arch in Xorg

What's more interesting is dropping Arch out of Xorg to a text TTY (light blue) and repeating this collection of CPU freqs brings Arch in line with the other distro's values. Video driver related? Something different in our Xorg packages?
Median idle freq under Arch in Xorg: 3,316 MHz
Median idle freq under Fedora in Xorg: 1,123 MHz
Median idle freq under Ubuntu in Xorg: 867 MHz
Median idle freq under Arch in text TTY: 951 MHz

All distros have the same settings for the scaling driver/gov:
% cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
powersave

% cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
intel_pstate

1. https://aur.archlinux.org/packages/i7z-git/
This task depends upon

Closed by  Andreas Radke (AndyRTR)
Monday, 09 November 2015, 13:47 GMT
Reason for closing:  Upstream
Additional comments about closing:  https://bugzilla.kernel.org/show_bug.cgi ?id=93521
Comment by John (graysky) - Sunday, 22 February 2015, 12:10 GMT
Should have noted that I could not repeat this with older CPUs including an Ivybridge and Haswell (non-refresh). These both behaved as expected across the three distros.

Also see this forum thread where another Arch user has observed this same phenomenon so it's not just my particular system: https://bbs.archlinux.org/viewtopic.php?id=184817
Comment by Andreas Radke (AndyRTR) - Sunday, 22 February 2015, 16:02 GMT
We build plain upstream releases in intel xorg driver and Xorg server. I guess it's caused by different kernel releases. You may want to retest with LTS kernel or some linux next or so.
Could be kernel drm related.
Comment by John (graysky) - Sunday, 22 February 2015, 16:23 GMT
I tested with both 3.18.6-1-ARCH and 3.19-1-ARCH with the similarly high results (median values differed by only 40 MHz).
Ubuntu runs 3.18.0-13 (which I believe is their patch of 3.18.7).
Fedora runs 3.17.1-1.

Just now I booted into linux-lts 3.14.33-1 and measured the median freq value of 4398 MHz which is much worse (lts_vs_arch.png).
Comment by Andreas Radke (AndyRTR) - Sunday, 22 February 2015, 18:52 GMT
Sound kernel DRM related if the kernel version makes such a difference. Look out for upstream bugs and patches.
Comment by John (graysky) - Sunday, 22 February 2015, 22:03 GMT
Well, for Arch, the kernel version did make a difference, but Ubuntu is 3.18.x and Arch is currently 3.18.x and there is a major difference there; Fedora is 3.17.1 vs Arch's 3.18.6 and there is a major disconnect there as well. What smells funny to me is that I can drop out of Xorg into a TTY and as long as /usr/lib/xorg-server/Xorg is not running, the CPU idles in Arch just it does under the other two distros. If I start Xorg, drop to a tty (ctrl+alt+F3 say) while leaving Xorg running, the frequencies are just as high as if I am in Xorg itself. This is why I am thinking it's related to the video driver or to xorg-server itself :/
Comment by John (graysky) - Monday, 23 February 2015, 20:31 GMT
Eureka! The problem is not with xorg or with the video driver, it is with the kernel itself. I used the attached fedora config renaming it to config.x86_64 and compiled our 3.18.6 kernel against it. Upon booting into it, I am able to enjoy the same low idle frequencies as I have measured under Fedora and under Ubuntu. See the attached histogram where stock Arch is blue and modified is orange.

3.18.6-1-ARCH with stock Arch config median CPU freq on idle in Xorg: 3,316 MHz
3.18.6-1-ARCH with Fedora's config median CPU freq on idle in Xorg: 925 MHz

1) Can someone please reassign this bug report to be against the [linux] package?
2) I have attached the Fedora config I used to build this kernel. Perhaps someone with more experience and knowledge than I can determine which of the settings would affect the intel_pstate driver this drastically. I am very glad to test out some settings and report back.

Thanks!
Comment by John (graysky) - Tuesday, 24 February 2015, 02:04 GMT
After much trial-and-error settings in the config, I believe that the problem is with the 300 Hz tick rate in our defaults AND this particular CPU. Setting to either 250 Hz or 1000 Hz both give idle rates that are comparable to either Ubuntu or Fedora. A setting of 300 Hz is to blame for the odd behavior I originally posted. Nothing else.

* Original Arch config (300 Hz) median value on idle in Xorg = 3,316 MHz

Changing only the tickrate from the original Arch config...
* To 250 Hz tick rate median value on idle in Xorg = 889 MHz
* To 1000 Hz tick rate median value on idle in Xorg = 1,012 MHz

What's going on with the 300 Hz value and this particular processor?
Comment by John (graysky) - Thursday, 26 February 2015, 22:09 GMT Comment by Manuel Bua (manuel) - Friday, 27 February 2015, 10:42 GMT
I've the same issue on my i7-4790k: i tried the workaround proposed by Doug with this:

echo 19 | sudo tee /sys/kernel/debug/pstate_snb/sample_rate_ms

By looking at the c-states with i7z-git i can see how the CPU is staying in C7 most of the time but the frequency is modulated in the upper 4-4.4ghz if Turbo Mode is enabled on my Asus H97-Plus, while it just sits at 3.9/4 without it.
I can see some spikes toward 2.9Ghz, for one single core at a time, but that's it, not really going down for more than one second.

I also tried different settings for the sample rate, such as 5, 20, 21, 22, 25, 50 and 100, but the result stays the same.
Comment by John (graysky) - Saturday, 28 February 2015, 11:34 GMT
@manuel - Onboard GPU or separate GPU?
Comment by Manuel Bua (manuel) - Saturday, 28 February 2015, 12:52 GMT
I'm using a separate nVidia GTX970.
Comment by Andreas Radke (AndyRTR) - Saturday, 20 June 2015, 12:28 GMT
Is this still an issue with recent kernels?
Comment by John (graysky) - Saturday, 20 June 2015, 15:22 GMT
@Andy - Yes, when comparing back to Ubuntu

Median idle freq under Arch in Xorg (300 Hz tick rate): 1,237 MHz
Median idle freq under Arch in Xorg (1000 Hz tick rate): 956 MHz
Median idle freq under Ubuntu 15.04 live CD: 886 MHz
Median idle freq under Fedora 22 live CD: 885 MHz
Median idle freq under Arch without Xorg running (1000 Hz tick rate): 831 MHz

Based on those numbers, I would say still affected but to a lesser magnitude than when I first opened this ticket.

Upstream: https://bugzilla.kernel.org/show_bug.cgi?id=93521

Loading...