Skip to content
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

Cpufreq doesn't show correct CPU frequency with intel_pstate #173

Open
zaps166 opened this issue Dec 29, 2015 · 25 comments
Open

Cpufreq doesn't show correct CPU frequency with intel_pstate #173

zaps166 opened this issue Dec 29, 2015 · 25 comments

Comments

@zaps166
Copy link

zaps166 commented Dec 29, 2015

I've got i7 3770k CPU and intel_pstate driver at powersave governor. The cpufreq applet shows always 1.6GHz, but the CPU frequency is changing during CPU load.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/29460444-cpufreq-doesn-t-show-correct-cpu-frequency-with-intel_pstate?utm_campaign=plugin&utm_content=tracker%2F517519&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F517519&utm_medium=issues&utm_source=github).
@monsta
Copy link
Contributor

monsta commented Dec 30, 2015

Please file separate bug reports about each issue - makes it easier for us to track and handle.

@zaps166
Copy link
Author

zaps166 commented Dec 30, 2015

Ok, this is done.

@paraboul
Copy link

Same issue here. Stuck at 500mhz (for every CPU) while cpupower freauency-info shows the correct value.

@monsta
Copy link
Contributor

monsta commented Feb 5, 2016

I can't reproduce this - but I have an old CPU, Core 2 Duo...

@zaps166
Copy link
Author

zaps166 commented Feb 5, 2016

Ok, I know what is wrong! "intel_pstate" is not supported by this applet, so that why it doesn't work. I switched to "acpi-cpufreq" (intel_pstate=disable in kernel command line) and it works properly (but it should really be able to show entire CPU in one, especially if you want to change governor... #174).
@monsta: hmm, C2D is too old for this driver, so it will be difficult to fix it without testing...

@raveit65
Copy link
Member

raveit65 commented Feb 5, 2016

found a kernel doc about intel_pstate https://www.kernel.org/doc/Documentation/cpu-freq/intel-pstate.txt
Looks like SandyBridge procs support intel_pstate.

@zaps166
Copy link
Author

zaps166 commented Feb 5, 2016

@raveit65: Yes, Sandy Bridge and newer CPUs.

@monsta
Copy link
Contributor

monsta commented Feb 5, 2016

Ok, I suspected that... so I need to upgrade my system or buy some modern laptop 😄

@zaps166
Copy link
Author

zaps166 commented Feb 5, 2016

I looked here: https://github.com/mate-desktop/mate-applets/blob/master/cpufreq/src/cpufreq-monitor-sysfs.c#L67

and I looked also to this virtual directory, e.g. into "scaling_cur_freq" file - the value changes while I'm pressing "F5" in text editor (intel_pstate), but applet shows only 1,60 (without unit). Maybe this is a simple bug to fix?

@monsta
Copy link
Contributor

monsta commented Feb 8, 2016

Interesting. But is 1.60 a valid value for that processor (e.g. for minimum frequency)?

@monsta
Copy link
Contributor

monsta commented Feb 8, 2016

Also check what's in this file:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

My system has ondemand setting there. It's also displayed in the tooltip of the applet.

@zaps166
Copy link
Author

zaps166 commented Feb 8, 2016

In:

/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

I have powersave or performance (depending on chosen governor).

On Powersave the applet shows 1.6GHz, on Performance - 4.1GHz (Turbo + OC in UEFI/BIOS). But both of them dynamically changes the clock in range 1.6GHz - 4.1GHz. On performance the time/threshold is lower than powersave - that is the difference on "intel_pstate" (AFAIK). Applet shows only one value (the lowest for powersave, the highest for performance). I can change the governor by applet in "intel_pstate" - so this works properly.

@monsta
Copy link
Contributor

monsta commented Feb 8, 2016

Ok, thanks, it's more clear to me now. So, the code does the same thing it always did before:

    if (g_ascii_strcasecmp (governor, "userspace") == 0) {
        path = g_strdup_printf (CPUFREQ_SYSFS_BASE_PATH,
                    cpu, monitor_sysfs_files[SCALING_SETSPEED]);
    } else if (g_ascii_strcasecmp (governor, "powersave") == 0) {
        path = g_strdup_printf (CPUFREQ_SYSFS_BASE_PATH,
                    cpu, monitor_sysfs_files[SCALING_MIN]);
    } else if (g_ascii_strcasecmp (governor, "performance") == 0) {
        path = g_strdup_printf (CPUFREQ_SYSFS_BASE_PATH,
                    cpu, monitor_sysfs_files[SCALING_MAX]);
    } else { /* Ondemand, Conservative, ... */
        path = g_strdup_printf (CPUFREQ_SYSFS_BASE_PATH,
                    cpu, monitor_sysfs_files[SCALING_CUR_FREQ]);
    }

Basically, it only reads scaling_cur_freq file when the governor is set to ondemand (to be precise, when it's not userspace or powersave or performance). I've looked upstream (in gnome-applets) - the code is the same there too.

@zaps166
Copy link
Author

zaps166 commented Feb 8, 2016

As far as I can remember performance runs at max. speed, powersave runs at min. speed and ondemand(and similar) dynamically scales the CPU on acpi-cpufreq. Modern governors can dynamically change the CPU frequency and them may have different names.
For me it should do an update on every governor or leave it as is for acpi-cpufreq and for other - always read current frequency.

@skoehler
Copy link

intel_pstate doesn't allow the ondemand governor. It only allows powersave and performance.
Yet, even if powersave is active, intel_pstate will still allow the CPU to run at max speed (even turbo).

I'd also like to see the cpufreq applet to work with intel pstate. That driver will be active on all modern systems (like my laptop). Also, the cpupower command is able to show correct CPU frequencies.

@monsta
Copy link
Contributor

monsta commented Feb 24, 2016

Ok, I see the problem. Looks like the logic in the code needs to be adjusted for pstate.

@monsta monsta changed the title Cpufreq doesn't show correct CPU frequency Cpufreq doesn't show correct CPU frequency with intel_pstate Feb 24, 2016
@skoehler
Copy link

I noticed that the cpufreq applet works with intel_pstate in Ubuntu 15.10 (MATE 1.12) but not on my Gentoo (MATE 1.13).

@monsta
Copy link
Contributor

monsta commented Feb 24, 2016

Not sure if it might be related, but Debian/Ubuntu builds use cpufreq library as cpupower library isn't available...

@lucasmr
Copy link

lucasmr commented Jul 11, 2016

Running mate-applets 1.14.0 on gentoo, using an Ivy Bridge processor with intel_pstate powersave governor. It always shows the cores at 1.6GHz, when the cores vary from 1.6-3.8 depending on load according to cpupower frequency-info.

@emanuele-f
Copy link

It works for me with latest git version.

@monsta
Copy link
Contributor

monsta commented Apr 2, 2017

Works with which Intel CPU?

@emanuele-f
Copy link

Yes I have an i3-5010U. Previously I was using my distro package which didn't work, then I've tried the github version and it works. The applet seem to correctly show frequency changes, I've compared them with those reported by /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq and they seem ok.

Output of cpupower frequency-info:

  driver: intel_pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 500 MHz - 2.00 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 500 MHz and 2.00 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: 800 MHz (asserted by call to hardware)
  boost state support:
    Supported: no
    Active: no```

@monsta
Copy link
Contributor

monsta commented Apr 4, 2017

Maybe a different value for --with-cpufreq-lib option is used now?

@ericfont
Copy link

ericfont commented May 3, 2018

I'm on Intel Core i7-6500U and I experience the same problem: I'm only able to set govenor to either "performance" or "powersave" and in either case the applet only displays max or min frequency, respectively.

It seems to me that the solution should be rather simple: always read SCALING_CUR_FREQ instead of having special cases for "performance", "powersave", nor even for "userspace" like:

ericfont@29d6e23

@apaan
Copy link

apaan commented Feb 24, 2019

I experience the same problem: using intel_pstate driver, with "powersave" governor it always shows the minimum CPU Frequency, and with "performance" the applet will display max Frequency.

Maybe this is the problem:

$ cpupower frequency-info
analyzing CPU 0:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 500 MHz - 1.90 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 500 MHz and 1.90 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 891 MHz (asserted by call to kernel)
  boost state support:
    Supported: no
    Active: no

but if i grep from /proc/cpuinfo, the correct CPU Mhz is there;

$ grep "cpu MHz" /proc/cpuinfo
cpu MHz		: 1599.576
cpu MHz		: 1707.923
cpu MHz		: 1694.300
cpu MHz		: 1528.936

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants