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 · 24 comments

Comments

Projects
None yet
8 participants
@zaps166

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

This comment has been minimized.

Show comment
Hide comment
@monsta

monsta Dec 30, 2015

Member

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

Member

monsta commented Dec 30, 2015

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

@zaps166

This comment has been minimized.

Show comment
Hide comment
@zaps166

zaps166 Dec 30, 2015

Ok, this is done.

zaps166 commented Dec 30, 2015

Ok, this is done.

@paraboul

This comment has been minimized.

Show comment
Hide comment
@paraboul

paraboul Jan 30, 2016

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

paraboul commented Jan 30, 2016

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

@monsta

This comment has been minimized.

Show comment
Hide comment
@monsta

monsta Feb 5, 2016

Member

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

Member

monsta commented Feb 5, 2016

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

@zaps166

This comment has been minimized.

Show comment
Hide comment
@zaps166

zaps166 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...

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

This comment has been minimized.

Show comment
Hide comment
@raveit65

raveit65 Feb 5, 2016

Member

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.

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

This comment has been minimized.

Show comment
Hide comment
@zaps166

zaps166 Feb 5, 2016

@raveit65: Yes, Sandy Bridge and newer CPUs.

zaps166 commented Feb 5, 2016

@raveit65: Yes, Sandy Bridge and newer CPUs.

@monsta

This comment has been minimized.

Show comment
Hide comment
@monsta

monsta Feb 5, 2016

Member

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

Member

monsta commented Feb 5, 2016

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

@zaps166

This comment has been minimized.

Show comment
Hide comment
@zaps166

zaps166 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?

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

This comment has been minimized.

Show comment
Hide comment
@monsta

monsta Feb 8, 2016

Member

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

Member

monsta commented Feb 8, 2016

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

@monsta

This comment has been minimized.

Show comment
Hide comment
@monsta

monsta Feb 8, 2016

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@zaps166

zaps166 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.

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

This comment has been minimized.

Show comment
Hide comment
@monsta

monsta Feb 8, 2016

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@zaps166

zaps166 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.

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

This comment has been minimized.

Show comment
Hide comment
@skoehler

skoehler Feb 22, 2016

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.

skoehler commented Feb 22, 2016

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

This comment has been minimized.

Show comment
Hide comment
@monsta

monsta Feb 24, 2016

Member

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

Member

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 from Cpufreq doesn't show correct CPU frequency to Cpufreq doesn't show correct CPU frequency with intel_pstate Feb 24, 2016

@monsta monsta added the confirmed label Feb 24, 2016

@skoehler

This comment has been minimized.

Show comment
Hide comment
@skoehler

skoehler Feb 24, 2016

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).

skoehler commented Feb 24, 2016

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

This comment has been minimized.

Show comment
Hide comment
@monsta

monsta Feb 24, 2016

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@lucasmr

lucasmr 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.

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

This comment has been minimized.

Show comment
Hide comment
@emanuele-f

emanuele-f Apr 2, 2017

It works for me with latest git version.

emanuele-f commented Apr 2, 2017

It works for me with latest git version.

@monsta

This comment has been minimized.

Show comment
Hide comment
@monsta

monsta Apr 2, 2017

Member

Works with which Intel CPU?

Member

monsta commented Apr 2, 2017

Works with which Intel CPU?

@emanuele-f

This comment has been minimized.

Show comment
Hide comment
@emanuele-f

emanuele-f Apr 2, 2017

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```

emanuele-f commented Apr 2, 2017

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

This comment has been minimized.

Show comment
Hide comment
@monsta

monsta Apr 4, 2017

Member

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

Member

monsta commented Apr 4, 2017

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

@ericfont

This comment has been minimized.

Show comment
Hide comment
@ericfont

ericfont 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

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

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