-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intel CPU Frequency Scaling Broken #4604
Comments
As you can see in #4491, dom0 kernel have no full access to power management, including cpufreq, so some data may be inaccurate. This is also why The thing you should look at is
As you can see, right now it's at 400MHz. |
So what's the solution here? Do I just assume that somehow I'm magically getting full performance, despite what every sensor tells me? I spent most of yesterday looking at Should I try cpufreq=dom0-kernel? Your response doesn't provide much of an explanation. According to these links, pstate should work. Or I should be able to see some attributes for cpufreq. https://wiki.xenproject.org/wiki/Xen_power_management https://lists.xenproject.org/archives/html/xen-devel/2015-10/msg03048.html |
I know terminology can be quite confusing here - there is acpi-cpufreq in both dom0 Linux and Xen. And the same for intel_pstate - there are two of them: one in dom0, one in Xen. By default, only Xen ones have real impact, even though dom0 one may report some data. For managing power management in Xen, user The documentation you've linked is quite old (for example mentions Xen 4.0 as the latest version, which was released in 2010...). But I'm not sure if anything more up to date exists. As for the
There is also As for the frequency, That said, it may be the case that frequency scaling doen't work properly on this machine(s). We've seen other power-management related issues with Intel Core 8th gen CPUs, specifically around system suspend. We have limited access to such machines (one of them), but there should be some progress soon. |
I understand that the documentation is quite old - there's not a lot out there regarding this issue. I literally went through ~ 100 links yesterday trying to distill out good information. It may be the case that As for
Mentioned in the OP, On a side note, I just booted a USB key of Xubuntu 18.04 and experienced flawless performance. The scaling governor was correctly reported as Has the |
That's interesting question. When I look at the Xen version we currently use, with a |
For reference, a few additional links we discovered: https://lists.gt.net/xen/devel/376881 These highlight the intel_pstate xen patch set from Wei Wang @ intel. It sounds like the correct implementation should be adding Thank you for helping track this down! |
I hadn't really looked into this, I just assumed that it was working just fine. Thank you for taking the time to look into this and sharing your findings @sylentprofet |
I wonder if @wei-w-wang-intel would have any input here? If it's the same person from the commits.. Perhaps @wei-w-wang ? |
The plot thickens.. My colleague ran across the following Citrix documentation: https://support.citrix.com/article/CTX200390?_ga=1.158728573.690652182.1439902385 Using the command from that, Strangely, if we simultaneously issue I have been unable to achieve max turbo state (4 GHz) with limited testing, but this is an interesting development nonetheless. Any thoughts as to what might cause |
Have you tried BTW I've asked about intel_pstate patches here: https://lists.xenproject.org/archives/html/xen-devel/2018-12/msg01400.html |
Matebook X Pro user here, it seems setting anything with xenpm has no affect.
I've been able to achieve close to boost, but never anything close to 4Ghz (Boost)
|
Under high load on a Lenovo X1C6: dom0 $ xenpm start 1 | grep "Avg freq"
Avg Freq 3844830 KHz
Avg Freq 3844830 KHz
Avg Freq 3844830 KHz
Avg Freq 3844830 KHz these are the largest set of values that were returned At idle, |
Is there any update on this? On my Lenovo T480 it seems the battery is lasting very short, that make me think the scaling could be really buggy. thank you so much! for any useful debugging info just ask |
I would like to get an update on this as well. It would be nice if we can are able to undervolt the cpu as well to prevent overheating. |
According to the last response on the mailing list Wei looks reluctant to work on the patch any further. https://lists.xenproject.org/archives/html/xen-devel/2018-12/msg01548.html Not sure what we should do here. Keep requesting? |
I don't know how specific any of this is to certain CPU generations, but on Intel pre-Skylake models scaling seems to work correctly except that xenpm readouts are a little odd. On a nominal 2.6GHz/3.3GHz turbo CPU, for example, if turbo mode is disabled then the highest speed shown by xenpm is |
Did anyone found a solution? thank you for sharing. If there is anything you need to test get back to me. thank you! |
Same issue here, if anyone need to test something I can try to help! |
I'm experiencing the exact same issue on XenServer 7.6 running on an HP DL 380 Gen10. Same results with this command xenpm start 1|grep "Avg freq" as other people in this thread. I tested using 0 VM's on the host, tried to pin vCPU to a couple of pCPU so I would be assured that the other pCPU's would go to sleep (c states above 3) but nothing works. I think it has to do with the driver. Our Windows and Linux VM's only show the base frequency of 2.6 Ghz, It's just static. |
Hmm, Perhaps it is assuming that hyperthreading is turned on (it is not) and is confused and really only reporting on half of the cores? EDIT: ah, known to have bugs: #4456 Also...seven(???) (virtual?) cores listed in --get-topology:
B |
I think I've got it figured out for my environment.. Xen reports CPUspeed in an odd way, the basefrequencie+1Mhz. The CPU speed that Intel uses to advertise with is only for NON (Intel) AVX code. More and more applications are running AVX2 instructions. And AVX2 has a much lower base core speed and much lower turbo speed. Take a look at page 14 and 15 of the above document. I have been told that AMD works in a different way, and those not downscale the cores. I'm afraid I can't test this, because I don't have the hardware. Hope this helps. |
As for |
I have been able to test this issue against a
|
Hello, This is on my Lenovo Thinkpad x390 with an i7 8665u /proc/cpuinfo reports 2100 static (which is base for this cpu) xenpm get-cpufreq-states reports wrong freq as stated by many of you before. seeing 2100 on load. Tried with xenpm start 1 and it does show higher boost, up to 4.2ghz (still far from its 4.8 max) but I can live with it. I am a bit concern about battery duration... I know its not big trouble but is there any update/plan to find out about this? I know it is off topic, but I can't find much around. Any of you have been able to undervolt? would be nice to know. Thank you for QubesOS! :D |
Hi, @n1m1. Sure, the weekend would be fine. Thanks! You'll have to add |
In case someone wants to enable this again and needs clear instructions: Edit the
Add Update # For legacy BIOS
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
# For UEFI BIOS
sudo grub2-mkconfig -o /boot/efi/EFI/qubes/grubx64.cfg Reboot |
Hi, @n1m1,
If you could please try out the modified kernel and hypervisor, that would
really help determine if the approach will work.
Thanks!
|
I just stumbled upon this, because my CPU wouldn't go higher than 1.6 GHz even though 3.8 GHz (turbo) would be possible. I suspect that a recent Xen update (I can't really determine which, tough), might have broken something™, because it worked before.
So, I did this and set |
Some brief feedback on this issue, which was the most pressing one with Qubes to me for some years now: |
Dear @jandryuk , I am terribly sorry for the unacceptable delay. I tried to install the new kernel (+modules) you suggested, but for some reasons my laptop does not even boot when hwp is enabled. Moreover, I was not able to the xen hypervisors packages, as they create conflicts. If there is something else you want me to test, over the next few days I should be kind of free. Thanks and apologies again for the delay in my reply. |
Hi, @n1m1 No worries. Thanks for trying. Would you please tell me the Linux and Xen versions you successfully boot? Xen probably didn't install because of a version mismatch - I built 4.14 and 4.17 since I wasn't sure which you were using. For the next try, I think I'll just give you a hypervisor binary to drop in /boot. That'll avoid messing with your existing install and should be good enough for a test. Thanks! |
Linux 6.2.10-1 Both from latest repo, both without hwp. |
Hi, @n1m1 , please test the following: xen-4.14.5-hwp.efi xen-4.14.5-hwp.gz kernel-latest-6.2.10-1.qubeshwp2.fc32.x86_64.rpm kernel-latest-modules-6.2.10-1.qubeshwp2.fc32.x86_64.rpm In dom0, copy xen-4.14.5-hwp.gz /boot and copy xen-4.14.5-hwp.efi to /boot/efi/EFI/qubes/. Then The kernel installation will run grub2-mkconfig, so you will get xen 4.14.5-hwp entries in grub. Modify an HWP one's command line to add Note, this is just the hypervisor binaries, so |
Hi there, It worked. My machine booted with HWP enabled and working. I did not install the EFI binary as I am not using UEFI. |
Great! Thanks, @n1m1!
Also, I realized that `xenpm` does support HWP since it's built into qubes,
but runtime-disabled.
…On Sun, Apr 23, 2023, 6:37 AM n1m1 ***@***.***> wrote:
Hi there,
thanks for this.
It worked. My machine booted with HWP enabled and working. I did not
install the EFI binary as I am not using UEFI.
—
Reply to this email directly, view it on GitHub
<#4604 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOKZP532MMGKXB2TQZP7HLXCUA6PANCNFSM4GKCH7NQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
will this go to the default distro? it is weird to run the cpu constantly underclocked :/ |
At some point, likely yes, but it needs to not regress on systems people already use. But note all the patches are included by default already, it just isn't enabled, but you can simply enable it on your system by adding |
Maybe relevant: my NV41 ran with Turbo Boost not working before I started using |
Tested with with i5-6300U. TLDR in terms of performance: Proposal 1 What if we put this up to the user to decide which scaling_driver to use by providing them a drop-down setting in Qubes Global Setting? IMO this is quite important as can unleash performance, improve power management and user experience. Proposal 2
Interestingly enough that using commands like |
Hi. I wrote the Xen hwp driver to try and improve power savings on Intel laptops. It showed some benefit on lightly loaded systems. I didn't focus on top-line performance - I assumed under load, the CPU would max out. I did observed turbo boost hitting near maximum with Are you measuring performance in some specific way, or is it just typing performance? You can try setting options with If you want to favor performance, you can try something like:
|
@jandryuk, thank you for developing this driver and your valuable suggestions!
Subjective evaluation: just typing performance. Would be glad to test via other means.
I played a bit with this options, here are some outcomes (still rather subjective though):
If you can recommend some means to test the performance, I would be glad to do it. I can do some standard tests via sysbench in Dom0/AppVM, but I don't expect much different as this is usually a steady workload... We may need something special to test low-demanding CPU activities.. E.g. the frequency of "awakening/sleeping" cycles? Time to reach the full performance? Any thoughts? |
@PetrVladimirov are you typing through a laptop keyboard, or through a USB keyboard with sys-usb? USB and sys-usb have more pieces to get the key strokes into their destination Qube. Is it consistently laggy, or does it lag initially and then seem to be okay while you continue to type? That would point to a delay in scaling up the processor frequency. You could try playing with the activity window:
My understanding is that it is a moving window to track load. If you make it smaller, it should scale up faster. It defaults to 0, letting the HW decide, but I don't know what is used in that case. Maybe try something like: You can try other activity window values too. I don't have any particular recommendations to test performance - I was curious how you were doing it. Subjective typing is fine. Also, with smt=off, you only have 2 cores, correct? With a USB Keyboard, the keystrokes have to go sys-usb -> dom0 -> Qube. At least one of those VMs needs to get scheduled in by Xen before it can perform it can handle a keystroke. The Qube also needs to render the keystroke before dom0 can display, which would be be another potential context switch. But if smt=off with acpi-cpufreq works well enough, we'd want to match that. |
As suggested by apparatus on the forum I'd like to add my observation on Lenovo T490: With Qubes 4.1 after 3h of Idle I have about 60% battery remaining, with Qubes 4.2 and Xen tweaked to disable hwp its down to about 40%. hwp needs to be set because of #8825 |
Hi @rwiesbach in #8825 (comment) @marmarek's suggestion disables hwp. Can you confirm that status of hwp in 4.2? |
@jandryuk Sorry, I refrased the sentence - it was misleading before. Q4.2 test was done with hwp disabkled. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@r3t4k3r: Please note that this issue tracker (qubes-issues) is not intended to serve as a help desk or tech support center. Instead, we've set up other venues where you can ask for help and support, ask questions, and have discussions. (By contrast, the issue tracker is more of a technical tool intended to support our developers in their work.) Thank you for your understanding. |
Qubes OS version:
R4.0
Affected component(s):
intel_pstate
acpi-cpufreq
xenpm
Steps to reproduce the behavior:
Tested on:
All with Intel i7-8550U.
Latest BIOS revisions for the respective systems as of Dec. 2018
Kernel: 4.19.2-3.pvops.qubes.x86_64.
EFI install.
In dom0,
sudo xenpm get-cpufreq-para
Expected behavior:
The processor is rated at 1.8 GHz (4.0 turbo), so we would expect to see appropriate scaling in that range, available frequencies from 1800000 - 4000000.
Further, we would expect to see
scaling_driver = intel_pstate
.Actual behavior:
The CPU frequencies do not scale correctly. Why?
Frequencies are pinned at 2 GHz max, 400 MHz min, across all cores.
Confirmed with
watch -n1 "cat /proc/cpuinfo | grep \"[c]pu MHz\""
xenpm set-scaling-maxfreq
and-minfreq
have no effect.xenpm get-cpufreq-states
shows 16 total/usable P-states.Changing the governor to
performance
has no effect. Default isondemand
dmidecode
reports a max of 2 GHz on the Lenovos, and an apparently erroneous speed on the Huawei (~ 8 GHz).The
scaling_driver
is legacyacpi-cpufreq
. Interestingly,intel_pstate
can be seen initializing during boot, but it does not take over handling anything. Attempting toblacklist acpi-cpufreq
inmodprobe.d
has no effect./sys/devices/system/cpu/intel_pstate/
contains the expected attributes, but as mentioned in the "related issue" linked below,no_turbo
,num_pstates
, andturbo_pct
errorResource temporarily unavailable
./sys/devices/system/cpu/intel_pstate/status
always returnsoff
, and does not respond toecho "active" >
. This behavior has been tested with various kernel command line parameters, includingintel_pstate=force
,intel_pstate=disabled
,intel_pstate=no_hwp
,intel_pstate=enable
with no change in performance aside from../cpu/intel_pstate/
attributes disappearing whenno_hwp
ordisabled
were in effect. Also triedprocessor.ignore_ppc=1
.Strangely, none of the appropriate attributes for
cpufreq
exist in/sys/devices/system/cpu/cpu*/
.lsmod | grep cpufreq
shows no results, trying tomodprobe acpi-cpufreq
orcpufreq-xen
returns errors.xen_acpi_processor
is loaded.cpupower frequency-info
is completely unresponsive, with zero information available about the processor.Though it shouldn't have any effect, testing was attempted with
smt=on
andoff
, andHyperthreading
enabled/disabled in the BIOS appropriately.Testing was also performed while toggling various BIOS settings.
Intel SpeedStep
Maximum Performance
vs.Balanced
It does not appear to be a thermal throttling issue, with idle ~ 37C and under load ~60C observed consistently.
tlp
was tested with no effect on the frequency scaling, regardless of being enabled or disabled.tlp-stat
yields minimal additional info, with what seems to be an outdated recommendation for the Lenovos to installtp-smapi kernel modules
, that are in fact deprecated in favor ofthinkpad_acpi
, which appears to be active on the Thinkpads.thermald
is not loaded.General notes:
https://www.kernel.org/doc/html/v4.12/admin-guide/pm/intel_pstate.html
This link suggests removing
irqbalance
but I'm skeptical.https://askubuntu.com/questions/1067866/ubuntu-18-04-steam-games-frame-rate-drop/1073353#1073353?newreg=c7c120f373da4effb7317104571cd573
https://cateee.net/lkddb/web-lkddb/XEN_ACPI_PROCESSOR.html
Regarding xen_acpi_processor: "It also registers itself as the SMM so that other drivers (such as ACPI cpufreq scaling driver) will not load."
How could
lsmod
reportxen_acpi_processor
as loaded butxenpm
shows the scaling driveracpi-cpufreq
? This might make sense as to the missing/sys/devices/.../cpufreq
entries.The following exchange is dubious at best, the final post gets down to the point of disabling intel microcode. They also suggest the use of
msr-tools
, but that really shouldn't be necessary.https://bbs.archlinux.org/viewtopic.php?id=231077
This is good work, but in my opinion, running a script every few seconds in dom0 isn't a legitimate fix.
https://github.com/erpalma/lenovo-throttling-fix
Related issues:
#4491
#450
The text was updated successfully, but these errors were encountered: