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

Open
zaps166 opened this Issue Dec 29, 2015 · 19 comments

Projects

None yet

6 participants

@zaps166
zaps166 commented Dec 29, 2015 edited

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
Member
monsta commented Dec 30, 2015

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

@zaps166
zaps166 commented Dec 30, 2015

Ok, this is done.

@paraboul

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

@monsta
Member
monsta commented Feb 5, 2016

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

@zaps166
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
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
zaps166 commented Feb 5, 2016

@raveit65: Yes, Sandy Bridge and newer CPUs.

@monsta
Member
monsta commented Feb 5, 2016

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

@zaps166
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
Member
monsta commented Feb 8, 2016

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

@monsta
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
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
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
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

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

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

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