User Tools

Site Tools


realtime:documentation:howto:debugging:no-cpu-idle

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
realtime:documentation:howto:debugging:no-cpu-idle [2018/08/24 16:10]
ebugden [max_cstate parameters] Add warning about laptop power management
realtime:documentation:howto:debugging:no-cpu-idle [2018/08/27 09:56] (current)
ebugden Make kernel parameter changing method explanation more general
Line 46: Line 46:
 ===== Kernel command-line parameter ===== ===== Kernel command-line parameter =====
  
-Another way to make sure that the CPUs never go idle is to change the value of a [[https://​www.kernel.org/​doc/​html/​latest/​admin-guide/​kernel-parameters.html|kernel command-line parameter]]. A few options of parameters that can be used to prevent CPU idling ​are presented below.+Another way to make sure that the CPUs never go idle is to change the value of a [[https://​www.kernel.org/​doc/​html/​latest/​admin-guide/​kernel-parameters.html|kernel command-line parameter]]. A couple of options of parameters that can be used to prevent ​deeper ​CPU sleep states ​are presented below.
  
-This method of preventing CPU idling is permanent for the duration of the system'​s execution. So, to allow the system to go idle again the parameter must be modified and the system must be restarted. Two methods for changing parameters are presented, a method where the new kernel parameter value is permanent until explicitly changed and a method where the kernel parameter applies for a single execution of the kernel. The idle parameter is used as an example to aid in the explanation of these methods, but the techniques apply for any kernel command-line parameter.+These methods are permanent for the duration of the system'​s execution. So, to allow the system to resume its original behavior ​the parameter must be modified and the system must be restarted. Two methods for changing parameters are presented, a method where the new kernel parameter value is permanent until explicitly changed and a method where the kernel parameter applies for a single execution of the kernel. The idle parameter is used as an example to aid in the explanation of these methods, but the techniques ​below apply for any kernel command-line parameter.
  
 ==== idle parameter ==== ==== idle parameter ====
Line 54: Line 54:
 A parameter that can be used to prevent a system'​s CPUs from idling is the boot parameter "​idle"​. Changing this parameter does not prevent the idle task from executing, but it prevents the idle task from putting the CPUs in a low power idle state. ​ A parameter that can be used to prevent a system'​s CPUs from idling is the boot parameter "​idle"​. Changing this parameter does not prevent the idle task from executing, but it prevents the idle task from putting the CPUs in a low power idle state. ​
  
-To prevent the CPUs from going idle using the technique, the option idle=poll must be added to the command-line parameters passed to the kernel when it is executed on startup. This option forces the processor to poll when it has nothing to do instead of going into a low power idle state. More details about the "​idle"​ option can be found in the Linux documentation about kernel parameters.+To prevent the CPUs from going idle using the technique, the option idle=poll must be added to the command-line parameters passed to the kernel when it is executed on startup. This option forces the processor to poll when it has nothing to do instead of going into a low power idle state. More details about the "​idle"​ option can be found in the Linux documentation about [[https://​www.kernel.org/​doc/​html/​latest/​admin-guide/​kernel-parameters.html|kernel parameters]].
  
 ==== max_cstate parameters ==== ==== max_cstate parameters ====
  
-One common motivation for wanting to prevent CPU idling is avoiding gaps in kernel function traces that can be mistaken for firmware or hardware caused latencies. The max_cstate parameters //cannot be used to prevent CPU idling//, but they can be used to prevent gaps in function traces.+One common motivation for wanting to prevent CPU idling is avoiding gaps in kernel function traces that can be mistaken for unusual ​firmware or hardware caused latencies. The max_cstate parameters //cannot be used to prevent CPU idling//, but they can be used to prevent gaps in function traces.
  
-A max_cstate kernel parameter can be used to limit the maximum C-State. Limiting the maximum C-State to 1 will prevent having gaps in full function traces. Briefly, C-States are different power saving idle states. C-States 1 and up are progressively deeper processor sleep states. C-State zero represents a processor that is not idle. C-State 1 is an idle state, but it is a very "​shallow"​ idle state so it takes almost no time for the processor to enter and exit C-State 1 (around 1 us). This means that going in and out of C-State 1 will not create noticeable gaps in a trace.+A max_cstate kernel parameter can be used to limit the maximum C-State. Limiting the maximum C-State to 1 will prevent having ​noticeable ​gaps in full function traces. Briefly, C-States are different power saving idle states. C-States 1 and up are progressively deeper processor sleep states. C-State zero represents a processor that is not idle. C-State 1 is an idle state, but it is a very "​shallow"​ idle state so it takes almost no time for the processor to enter and exit C-State 1 (around 1 us). This means that going in and out of C-State 1 will not create noticeable gaps in a trace.
  
 There are two max_cstate boot parameters that can be used for this, processor.max_cstate (which limits the maximum C-State for the acpi_idle driver) and intel_idle.max_cstate (which limits the maximum C-state for the intel_idle driver). The value of one of these parameters must be set to 1 (e.g. intel_idle.max_cstate=1). Only one of these boot parameters needs to be specified in the command-line depending on which idle driver is used by the kernel. The idle driver that is currently loaded can be checked via sysfs: There are two max_cstate boot parameters that can be used for this, processor.max_cstate (which limits the maximum C-State for the acpi_idle driver) and intel_idle.max_cstate (which limits the maximum C-state for the intel_idle driver). The value of one of these parameters must be set to 1 (e.g. intel_idle.max_cstate=1). Only one of these boot parameters needs to be specified in the command-line depending on which idle driver is used by the kernel. The idle driver that is currently loaded can be checked via sysfs:
Line 71: Line 71:
  
 Using a max_cstate parameter to prevent trace gaps is better than using the idle parameter because allowing the CPUs to enter C-State 1 will save power compared to forcing them to poll when they have nothing to do. Using a max_cstate parameter to prevent trace gaps is better than using the idle parameter because allowing the CPUs to enter C-State 1 will save power compared to forcing them to poll when they have nothing to do.
- 
-<WRAP center round info 60%> 
-This method of preventing function trace gaps may not work on certain laptops if they do fancy power management via [[realtime:​documentation:​howto:​debugging:​smi-latency:​smm|SMM]]. 
-</​WRAP>​ 
  
 ==== Change parameter permanently ==== ==== Change parameter permanently ====
  
-To make the option changes persistent when the system is restarted, add idle=poll to the contents of the GRUB_CMDLINE_LINUX field in the /​etc/​default/​grub file. The user must be root or use sudo to modify this file. Here is an example of what the line in the file could look like after being modified:+To make the option changes persistent when the system is restarted, add the parameter and its desired value (e.g. idle=pollto the contents of the GRUB_CMDLINE_LINUX field in the /​etc/​default/​grub file. The user must be root or use sudo to modify this file. Here is an example of what the line in the file could look like after being modified:
  
 <​code>​ <​code>​
Line 98: Line 94:
 </​code>​ </​code>​
  
-To make the temporary change, add idle=poll to the end of the line so that it looks like this:+To make the temporary change, add the kernel parameter and its value (e.g. idle=pollto the end of the line so that it looks like this:
  
 <​code>​ <​code>​
Line 114: Line 110:
 </​code>​ </​code>​
  
-and make sure that idle=poll is somewhere in the output.+and make sure that the kernel parameter and its value (e.g. idle=pollis somewhere in the output.
realtime/documentation/howto/debugging/no-cpu-idle.1535127046.txt.gz ยท Last modified: 2018/08/24 16:10 by ebugden