frequency scaling?

Hi everybody, i just installed Ardour 3.5.308, and during installation i got the following message:
“!!! WARNING !!! - Your system seems to use frequency scaling.
This can have a serious impact on audio latency.
For best results turn it off, e.g. by chosing the ‘performance’ governor.”
what is frequency scaling and what should i do? i do not know what the performance governor is. thanks

the governer is like a set of rules that controls how fast your processor works depending on what is going on. Itz meant to save power so your not running at full power when your just doing small tasks.

This can cause problems in audio programs that require quick responses, it can cause unexpected xruns, and i have also discovered that can also have an impact on gui response. in ondemand mode on my machine the gui response can get sluggish. In perofrmance its perfect. (it also effects scrollings speed in firefox on certain pages)

you can change it with

sudo cpufreq-set -c 0 -g performance

you will need to have the tools installed. Also you need to set it for each core you have, so a dual core machine you would do that and change c to 1 for the 2nd core and so on.

and eaiser way it to install the cpufreq applet that allows you to select the governer.

sudo apt-get install indicator-cpufreq

You will get a little applet on the taskbar that will lists the modes, select performance.

Now you will be running at full speed all the time.

When running in performance, you wil get less xruns and should be able to run at lower latencies, or be able to run more plugins. Just remember that if your running a larger project as you start using more plugins you may have to increase the latency if you start running into problems with x runs, or bounce tracks down to lighten to load.

wow, thanks for the in depth explanation. i’ll certainly try to install the applet. so is it fine to select performance mode while using ardour, and powersave when not?

yes its perfectly fine to change the governer to suit your needs.

i installed cpufreq, restarted the pc, in the ubuntu software manager it shows that cpufreq is in fact installed, but i cannot find a way to start it, if i search for this app no result is showed. why could that be? thx

its not an app, there should be an applet on your taskbar. Look at the page i linked, it shows a screenshot of where you can change the cpu governer

o install cpufreq in Ubuntu 13.04 use the following command in terminal (Ctrl+Alt+T):

sudo apt-get install indicator-cpufreq

Voila! Nothing else needed here. Now just search for cpufreq in Unity Dash and it will be started. Once started, choose Powersave option to get better battery life and less overheating.

thanks, it worked fine

On Ubuntu 14.04 desktop, after running the indicator-cpufreq installation command line, I had to log out and log back in before the icon appeared in the bar on top of the screen. Thanks!

Worked for me too, sweet!

Am I correct that modern Intel CPU’s use intel_pstate and this thread’s information is redundant in this case?

I am trying to make my Intel Broadwell NUC as good as possible for Audio. I get the same Ardour warning about ‘performance’ governor’, but I am not sure it is relevant for Fedora 24 and an Intel Broadwell NUC?

https://wiki.archlinux.org/index.php/CPU_frequency_scaling

intel_pstate >>> This driver implements a scaling driver with an internal governor for Intel Core (Sandy Bridge and newer) processors.

If I understand it correctly the P-States actively lowers parts of cpu circuits voltage or can turn parts completely off when needed. Changes in these states can happen many times in a second.

I have a BayTrail N2930 processor that seems to have a hardware bug in powersaving causing random freezes. Because of this I have been forced to experiment with processor C and P States for getting this machine to be reliable for Ardour use. When the machine became stable and Ardour ran without problems I stopped there and did not try to optimize kernel settings further. Also different intel processors have different power savings feature, so these settings may not apply directly to other machines but can be used as a starting point for further research.

My distro is Gentoo so I always compile my own kernel. Now I use kenel 4.7.10 and the settings below makes processor speed constant and Ardour runs very well.

  • Kernel built with options:

X86_INTEL_PSTATE =y
X86_ACPI_CPUFREQ =n
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_DEVFREQ_GOV_PERFORMANCE=m

  • I start the machine with kernel option: intel_idle.max_cstate=0

  • I have a startup script that disables turbo boost and power saving state 3 that is buggy in this hardware and caused lock ups. When state3 is disabled the machine is completely stable and frequency also stays stable.

echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo
echo 1 > /sys/devices/system/cpu/cpu0/cpuidle/state3/disable
echo 1 > /sys/devices/system/cpu/cpu1/cpuidle/state3/disable
echo 1 > /sys/devices/system/cpu/cpu2/cpuidle/state3/disable
echo 1 > /sys/devices/system/cpu/cpu3/cpuidle/state3/disable

Thanks for this detailed info! I am afraid it’s too heavy for me at this stage, I am as near to building a kernel as I am to marrying Evan Rachel Wood :slight_smile:

I asked a question on the official Fedora forum, and will see if anyone can help with some easier solution:

https://ask.fedoraproject.org/en/question/98156/how-do-i-set-cpu-scaling-govenor-to-performance-and-keep-it-there-in-fedora-24/

Here is what worked for me with a dual hex core X5670 Xeon machine running Debian 9.x.

(First I had to replace KDE 5 Plasma with XFCE, since as best I can tell it was stopping the menus of Synaptic being visible on my Windows machine (Xming) and also preventing me seeing the whole display window of qjackctl. Another reason for avoiding KDE 5 Plasma is: http://manual.ardour.org/ardour-configuration/system-specific-setup/kde-plasma-5/ .)

I have two RME cards installed: Digi96/8 PST and HDSP 9632. Based on prior research, I installed the alsa-tools-gui package, which gives me, amongst other things, the hdspmixer program. When I ran this it reported on the two cards and displayed the levels of the HDSP 9632.

I installed the cpufrequtils package:

    sudo apt-get update
    sudo apt-get install cpufrequtils

Then I ran:

    cpufreq-info

and got a report for all 24 “CPUs”. Each of these is really a logical processor, running one of the two hyperthreads supported by each core. The report makes it look like each one can have its clock speed set individually, by an individual choice of governor, but as far as I know, this is set per core (6 in each of the two CPU chips) not per hyperthread. The report listed the available governors:

    available cpufreq governors: powersave, userspace, conservative, ondemand, performance, schedutil
     current policy: frequency should be within 1.60 GHz and 3.06 GHz.
                      The governor "ondemand" may decide which speed to use within this range.

I could probably set the governors individualy for all 32 logical processors, with commands such as:

    sudo cpufreq-set -c 0 -g performance

as mentioned above, but I found it sufficient to, as root, create a file:

    /etc/default/cpufrequtils

Which contains (apart from comment lines which start with “#”):

    GOVERNOR="performance"

Then, when I rebooted, the report stated that all “CPUs” were running at 3.06GHz under the performance governor. This did not noticeably increase the idle power dissipation of the machine, though I did not test this rigorously.

I installed a precompiled Ardour according to http://ardour.org/first_time_linux.html, after uninstalling pulseaudio, running (as a mortal, non-root, user) Ardour-5.12.0-x86_64.run and letting it install Jack. As part of the Jack installation, I agreed to it enabling realtime process priority, by it writing a file /etc/security/limits.d/audio.conf.

There are two types of Jack: 1 and 2: https://github.com/jackaudio/jackaudio.github.com/wiki/Q_difference_jack1_jack2 . To find out which kind I have, I tried:

    apt-cache show jack 

but this reported on a CD ripper. So:

    apt-cache show jackd 

This depends on two packages jackd1 or jackd2. I listed all installed packages which contain “jack” in their names:

    apt list --installed | grep jack

and found I was using jackd2:

    jackd/stable,stable,now 5 all [installed]
    jackd2/stable,stable,now 1.9.10+20150825git1ed50c92~dfsg-5 amd64 [installed,automatic]
    jackd2-firewire/stable,stable,now 1.9.10+20150825git1ed50c92~dfsg-5 amd64 [installed,automatic]
    libjack-jackd2-0/stable,stable,now 1.9.10+20150825git1ed50c92~dfsg-5 amd64 [installed,automatic]
    qjackctl/stable,stable,now 0.4.4-1 amd64 [installed,automatic]

Checking the results of the above steps against: http://jackaudio.org/faq/linux_rt_config.html I found:

(Point 1) There was a single file in this directory:

    /etc/security/limits.d/audio.conf 

which contained the required items, though the priority of 95 is not quite the 99 mentioned in this point:

    %
    # Provided by the jackd package. 
    #
    # Changes to this file will be preserved.
    #
    # If you want to enable/disable realtime permissions, run
    #
    #    dpkg-reconfigure -p high jackd

    @audio   -  rtprio     95
    @audio   -  memlock    unlimited
    #@audio   -  nice      -19

(Point 2)

Since I installed Ardour, and therefore Jack, as user “robin”, I assume it was the Jack installation which added this user to group “audio” in:

    /etc/group 

which contains a line:

    audio:x:29:pulse,robin 

This group “audio” is referred to in the audio.conf file just mentioned.

I logged out and in again as instructed, so the new login shell would recognise that my user account is now part of the audio group.

This is how I established that my governor configuration was good enough for Jack. When I ran the command:

    qjackctl 

I got a window showing that jackd was not running. qjackctl is a GUI control for jackd.

I came to understand that Ardour requires Jack, and that I can access a sound card from Ardour either through its ALSA driver directly, or via Jack which then uses the ALSA driver. On another machine on which I has done these steps, for simplicity rather than navigating the RME cards, I had only installed a Behringer UCA222 USB 2 in 2 out interface, I was able to start Ardour with:

    Ardour5 

I created a new session using the Recording Session template. In the next dialogue box I the top option is for the Audio System, ALSA or JACK. For ALSA, the next two items are: Input Device and Output Device, and for these, in both cases, the only option (other than None) was the UCA222 “USB Audio Codec”. (These are IBM rack-mount servers, not PCs, so there was no motherboard audio system.) If I chose JACK, then the next two options were for Driver and Device. For Driver, I chose ALSA, and the other options were: OSS, FreeBoB, FFADO, NetJACK and Dummy. With ALSA chosen, the only Device was “USB Audio Codec”. I chose 48kHz, 1024 samples (buffer) and 2 periods (?), Input Output channels all available. I clicked the Start button (which to the left had “stopped”). The dialogue box vanished and Ardour started, with a small second dialogue box which was not at first visible, in which I specified 2 tracks. I could see my input audio signal was reaching Ardour and by record arming the two channels (dull red circle icons) and likewise Ardour itself (similar icon to the right of the stop icon) I could click the play icon (right-pointing triangle) and I could see that the signals were being recorded. During recording, the input signals appeared at the outputs of the interface, and likewise when playing back the recording. (I have included all these details for those who are unfamiliar with Ardour, as I was at the time. I had dragged the Mixer button to the desktop so there was a separate Mixer window.)

So this shows me the very basics of using Ardour with this particular ALSA driver for this simple USB interface, not using Jack.

I closed the program and started it again with a different project, this time using JACK as the Audio System, and ALSA as its driver. I was able to do the same things. The qjackctl window did not show that Jack was running. When I closed and restarted this program, it did show that Jack was running. The Connect button and then Expand All helped me understand how Ardour works with Jack.

Hi all,

I have just switched to an Ubuntu based OS after years using something else. Just downloaded ARDOUR. Some where along the line, I have ( I think ) changed a setting resulting in message <!!! WARNING !!! - Your system seems to use frequency scaling.
This can have a serious impact on audio latency.
For best results turn it off, e.g. by choosing the ‘performance’ governor> As the original post. I have followed the post here and have not read everything yet. But when I now run

<z@z:~$ cpufreq-info
cpufrequtils 008: cpufreq-info © Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
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: 0.97 ms.
hardware limits: 500 MHz - 3.00 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 500 MHz and 3.00 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency is 1.19 GHz.
analyzing CPU 1:
driver: intel_pstate
CPUs which run at the same hardware frequency: 1
CPUs which need to have their frequency coordinated by software: 1
maximum transition latency: 0.97 ms.
hardware limits: 500 MHz - 3.00 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 500 MHz and 3.00 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency is 1.72 GHz.
analyzing CPU 2:
driver: intel_pstate
CPUs which run at the same hardware frequency: 2
CPUs which need to have their frequency coordinated by software: 2
maximum transition latency: 0.97 ms.
hardware limits: 500 MHz - 3.00 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 500 MHz and 3.00 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency is 1.72 GHz.
analyzing CPU 3:
driver: intel_pstate
CPUs which run at the same hardware frequency: 3
CPUs which need to have their frequency coordinated by software: 3
maximum transition latency: 0.97 ms.
hardware limits: 500 MHz - 3.00 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 500 MHz and 3.00 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency is 1.29 GHz>
I am still working all this out. But do those specs look okay? Mind you I have not yet rebooted OS since I installed

Any feedback at all would be awesome !
Thanks

z@z:~$ cpufreq-info
cpufrequtils 008: cpufreq-info © Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
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: 0.97 ms.
hardware limits: 500 MHz - 3.00 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 500 MHz and 3.00 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency is 1.19 GHz.
analyzing CPU 1:
driver: intel_pstate
CPUs which run at the same hardware frequency: 1
CPUs which need to have their frequency coordinated by software: 1
maximum transition latency: 0.97 ms.
hardware limits: 500 MHz - 3.00 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 500 MHz and 3.00 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency is 1.72 GHz.
analyzing CPU 2:
driver: intel_pstate
CPUs which run at the same hardware frequency: 2
CPUs which need to have their frequency coordinated by software: 2
maximum transition latency: 0.97 ms.
hardware limits: 500 MHz - 3.00 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 500 MHz and 3.00 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency is 1.72 GHz.
analyzing CPU 3:
driver: intel_pstate
CPUs which run at the same hardware frequency: 3
CPUs which need to have their frequency coordinated by software: 3
maximum transition latency: 0.97 ms.
hardware limits: 500 MHz - 3.00 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 500 MHz and 3.00 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency is 1.29 GHz.
z@z:~$