[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:hardware:cpu_frequency_scaling [2023/12/10 19:27 (UTC)] – [/etc/rc.d/rc.cpufreq and /etc/default/cpufreq] zeebrahowtos:hardware:cpu_frequency_scaling [2023/12/11 10:43 (UTC)] (current) – [Introduction] zeebra
Line 4: Line 4:
  
 ===== Introduction ===== ===== Introduction =====
-CPU frequency scaling is carried out by the kernel, there are currently two main ways of thinking about CPU Frequency Scaling, and these are based on the driver which is in use. By default "p-states" implements CPU Frequency Scaling and cannot be compiled out of the Kernel. This has been the case for Intel for quite some time, and recently (as of 2023) "p-states" are also implemented for AMD (but is not the default driver). It is however possible to disable p-states, which will set the controlling driver to "acpi-cpufreq".\\+CPU frequency scaling is carried out by the kernel, there are currently two main ways of thinking about CPU Frequency Scaling, and these are based on the frequency scaling driver which is in use. By default "p-states" implements CPU Frequency Scaling and cannot be compiled out of the Kernel. This has been the case for Intel for quite some time, and recently (as of 2023) "p-states" are also implemented for AMD (but is not the default driver). It is however possible to disable p-states, which will set the controlling driver to "acpi-cpufreq".\\
 \\  \\ 
-"P-states" use the default scaling mechanisms of the CPU and in many cases leave more decisions to the CPU ("hardware managed p-states" aka __HPW__). There are two frequency scaling "governors" for this mode, "performance" and "powersave". If your CPU does not support HWP it is put into "passive" mode, you can also do this manually. If you change the scaling driver to acpi-cpufreq, you can disable the p-states of the CPU. ACPI is an "industry standard" and related to this topic you can use it to scale your CPU in a different way by using the acpi-cpufreq driver and scaling governors. Until somewhat recently there were 5 scaling governors for acpi-cpufreq, **"performance"**, **"powersave"**, **"userspace"**, **"ondemand"** and **"conservative"**, with "ondemand" often being the default. A 6th governor **"schedutil"** was added and made the default option in the Kernel and by Slackware. It seems complicated, but you only really have to consider the two main modes of CPU Frequency Scaling, which is __p-state__ and __acpi-cpufreq__. Slackware by default comes with all requirements necessary to use these features. \\+"P-states" use the default scaling mechanisms of the CPU and in many cases leave more decisions to the CPU ("hardware managed p-states" aka __HPW__). There are two frequency scaling "governors" for this mode, "performance" and "powersave". If your CPU does not support HWP it is put into "passive" mode, which you can also do manually. If you change the scaling driver to acpi-cpufreq, you can disable the p-states of the CPU. ACPI is an "industry standard" and related to this topic you can use it to scale your CPU in a different way by using the acpi-cpufreq driver and scaling governors. Until somewhat recently there were 5 scaling governors for acpi-cpufreq, **"performance"**, **"powersave"**, **"userspace"**, **"ondemand"** and **"conservative"**, with "ondemand" often being the default. A 6th governor **"schedutil"** was added and made the default option in the Kernel and Slackware. It might seem complicated, but you only really have to consider the two main modes of CPU Frequency Scaling, which is __p-state__ and __acpi-cpufreq__. Slackware by default comes with all requirements necessary to use these features. \\
 \\ \\
-For older computers with "legacy" scaling implementations and with a new Kernel, these functions have been incorporated into acpi-cpufreq, and alongside AMD it should be your default choice. For very old and very new AMD CPU's, other options exists and should be considered.+For older computers with "legacy" scaling implementations and with a new Kernel, these functions have been incorporated into acpi-cpufreq, and alongside AMD it should be your default choice. For very old and new AMD CPU'(zen2 onwards), other options exists and should be considered. 
 +\\ 
 + 
 +**Available governors** and the **currently used driver** can be seen by using the cpufreq command 
 +<code>cpufreq-info</code>
 \\ \\
 ===== Kernel Configuration ===== ===== Kernel Configuration =====
  
 Both Kernels (huge/generic) for Slackware 15 includes the necessary modules for all the CPU Frequency Scaling functions.\\ Both Kernels (huge/generic) for Slackware 15 includes the necessary modules for all the CPU Frequency Scaling functions.\\
-If you want to use a newer Kernel series or your own Kernel, the relevant options are found in the section "Power management and ACPI options" under "CPU Frequency scaling".\\+If you want to use a newer Kernel series or your own Kernel, the relevant options are found in the section **"Power management and ACPI options" under "CPU Frequency scaling"**.\\
  
-With AMD you should normally use the acpi-cpufreq driver, but exceptions apply. With Intel you will expose 3 different drivers: **intel_pstate**, **intel_cpufreq**(passive/acpi) and **acpi-cpufreq**. Generally speaking you could say that Intel P-state is performance biased in general and that acpi-cpufreq gives you the maximum control (including performance bias). There are several options you can pass to the Kernel at boot, but if you want to disable p-states and use the acpi-cpufreq driver you pass **intel_pstate=disable** to the Kernel at boot time.+With AMD you should normally use the acpi-cpufreq driver, but exceptions apply. With Intel you will expose 3 different drivers: **intel_pstate**, **intel_cpufreq** (passive/acpi) and **acpi-cpufreq**.   
 +Generally speaking you could say that Intel P-state is performance biased in general and that acpi-cpufreq gives you the maximum control (including performance bias). There are several options you can pass to the Kernel at boot, but if you want to disable p-states and use the acpi-cpufreq driver you pass **intel_pstate=disable** to the Kernel at boot time. These two options are the safe options, while other options could prevent a boot with certain CPU's. However, you might want to use another option depending on your cpu. \\ 
 +\\ 
 +You can pass these options at boot time to the Kernel command line with the bootloader, like Grub2, you add it after the Kernel line, the standard way of passing Kernel parameters at boot.
 \\ \\
  
Line 22: Line 29:
 ===== /etc/rc.d/rc.cpufreq and /etc/default/cpufreq ===== ===== /etc/rc.d/rc.cpufreq and /etc/default/cpufreq =====
  
-The main way to adjust frequency scaling in Slackware is to do so at boot time by making /etc/rc.d/rc.cpufreq executable (chmod +x rc.cpufreq) and selecting the governor to use by editing the file /etc/default/cpufreq. The necessary setup is done in rc.cpufreq and it reads /etc/default/cpufreq to select the governor. These things do depend on what options are available to it, and those options depend on what choice you make at boot time and which driver is in useIf you use the acpi-cpufreq driveryou can select any of the available scaling governors, if intel_pstate is in use, it will ignore the choice if it cannot be parsed.+The main way to adjust frequency scaling in Slackware is to do so at boot time by making /etc/rc.d/rc.cpufreq executable.  
 +<code>chmod +x /etc/rc.d/rc.cpufreq</code>  
 +And by selecting the governor to use by editing the file /etc/default/cpufreq. 
 +<code>nano /etc/default/cpufreq</code> 
 +<code># To select a particular CPU governor option for /etc/rc.d/rc.cpufreq, 
 +# uncomment the line below and edit it to select your choice
 +#SCALING_GOVERNOR=ondemand 
 +</code>
  
-Available governors and the currently used driver can be seen by using the cpufreq command +<note important>The necessary setup is done in /etc/rc.d/rc.cpufreq and it reads /etc/default/cpufreq to select the governor. These things do depend on what options are available to it, and those options depend on what choice you make at boot time and which driver is in use. If you use the acpi-cpufreq driver, you can select any of the available scaling governors, if intel_pstate is in use, it will ignore the choice if it cannot be parsed.</note>
-<code>cpufreq-info</code>+
  
 After the initial setup of CPU frequency scaling at boot, scaling can also be controlled manually in a variety of ways, as described below.\\ After the initial setup of CPU frequency scaling at boot, scaling can also be controlled manually in a variety of ways, as described below.\\
Line 49: Line 62:
 The ''cpufreq-set'' command can be used to set the appropriate governor. The ''cpufreq-set'' command can be used to set the appropriate governor.
  
-Adding the following to the ''/etc/rc.d/rc.local'' file+You can set the scaling governor manually if you want, per cpu core.
 <code bash> <code bash>
-# CPU-frequency scaling 
 cpufreq-set --cpu 0 --governor conservative cpufreq-set --cpu 0 --governor conservative
 cpufreq-set --cpu 1 --governor conservative cpufreq-set --cpu 1 --governor conservative
 </code> </code>
-will set the governor to 'conservative' on each boot. 
  
 The same can be done using sysfs: The same can be done using sysfs:
Line 90: Line 101:
 <!-- You must remove the tag-word "template" below before saving your new page --> <!-- You must remove the tag-word "template" below before saving your new page -->
 <!-- Some updates done, more will follow. Specifically a section about /etc/rc.d/ is high priority  --- //[[wiki:user:zeebra|zeebra]] 2023/12/10 13:34 (UTC)// --> <!-- Some updates done, more will follow. Specifically a section about /etc/rc.d/ is high priority  --- //[[wiki:user:zeebra|zeebra]] 2023/12/10 13:34 (UTC)// -->
-{{tag>howtos CPU frequency Laptop, needs_attention}}+{{tag>howtos CPU frequency Laptop cpu_frequency_scaling}}
 howtos:hardware:cpu_frequency_scaling ()