mirror of
https://github.com/clearlinux/clear-linux-documentation.git
synced 2026-05-01 12:33:44 +00:00
363 lines
22 KiB
HTML
363 lines
22 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html lang="en" data-content_root="../../">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
|
||
<title>CPU Power and Performance — Documentation for Clear Linux* project</title>
|
||
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
|
||
<link rel="stylesheet" type="text/css" href="../../_static/bizstyle.css?v=5283bb3d" />
|
||
<link rel="stylesheet" type="text/css" href="../../_static/copybutton.css?v=76b2166b" />
|
||
|
||
<script src="../../_static/documentation_options.js?v=5929fcd5"></script>
|
||
<script src="../../_static/doctools.js?v=9bcbadda"></script>
|
||
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
|
||
<script src="../../_static/clipboard.min.js?v=a7894cd8"></script>
|
||
<script src="../../_static/copybutton.js?v=a56c686a"></script>
|
||
<script src="../../_static/bizstyle.js"></script>
|
||
<link rel="canonical" href="https://clearlinux.github.io/clear-linux-documentation/guides/maintenance/cpu-performance.html" />
|
||
<link rel="icon" href="../../_static/favicon.ico"/>
|
||
<link rel="author" title="About these documents" href="../../about.html" />
|
||
<link rel="index" title="Index" href="../../genindex.html" />
|
||
<link rel="search" title="Search" href="../../search.html" />
|
||
<link rel="next" title="Deploy at Scale" href="deploy-at-scale.html" />
|
||
<link rel="prev" title="Build a new Clear Linux OS-based container image" href="container-image-new.html" />
|
||
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
||
<!--[if lt IE 9]>
|
||
<script src="_static/css3-mediaqueries.js"></script>
|
||
<![endif]-->
|
||
</head><body>
|
||
<div class="related" role="navigation" aria-label="Related">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../../genindex.html" title="General Index"
|
||
accesskey="I">index</a></li>
|
||
<li class="right" >
|
||
<a href="deploy-at-scale.html" title="Deploy at Scale"
|
||
accesskey="N">next</a> |</li>
|
||
<li class="right" >
|
||
<a href="container-image-new.html" title="Build a new Clear Linux OS-based container image"
|
||
accesskey="P">previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../../index.html">Documentation for Clear Linux* project</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="../index.html" accesskey="U">Guides</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">CPU Power and Performance</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section id="cpu-power-and-performance">
|
||
<span id="cpu-performance"></span><h1>CPU Power and Performance<a class="headerlink" href="#cpu-power-and-performance" title="Link to this heading">¶</a></h1>
|
||
<p>This guide explains the CPU power and performance mechanisms in Clear Linux* OS.</p>
|
||
<nav class="contents local" id="contents">
|
||
<ul class="simple">
|
||
<li><p><a class="reference internal" href="#overview" id="id2">Overview</a></p></li>
|
||
<li><p><a class="reference internal" href="#cpu-power-saving-mechanisms" id="id3">CPU power saving mechanisms</a></p></li>
|
||
<li><p><a class="reference internal" href="#linux-cpu-clock-frequency-scaling" id="id4">Linux CPU clock frequency scaling</a></p></li>
|
||
<li><p><a class="reference internal" href="#thermal-management" id="id5">Thermal management</a></p></li>
|
||
</ul>
|
||
</nav>
|
||
<section id="overview">
|
||
<h2><a class="toc-backref" href="#id2" role="doc-backlink">Overview</a><a class="headerlink" href="#overview" title="Link to this heading">¶</a></h2>
|
||
<p>Modern x86 <abbr title="central processing units">CPUs</abbr> employ a number of features
|
||
to balance performance, energy, and thermal efficiency.</p>
|
||
<p>By default, Clear Linux OS prioritizes maximum CPU performance, assuming that
|
||
the faster the program finishes execution, the faster the CPU can return to a
|
||
low energy idle state. It is important to understand and evaluate the impact
|
||
of each feature when troubleshooting or considering changing the defaults.</p>
|
||
</section>
|
||
<section id="cpu-power-saving-mechanisms">
|
||
<h2><a class="toc-backref" href="#id3" role="doc-backlink">CPU power saving mechanisms</a><a class="headerlink" href="#cpu-power-saving-mechanisms" title="Link to this heading">¶</a></h2>
|
||
<p>C-states and P-states are both CPU power saving mechanisms that are entered
|
||
under different operating conditions. The tradeoff is a slightly longer time
|
||
to exit these states when the CPU is needed.</p>
|
||
<section id="c-states-idle-states">
|
||
<span id="c-states-section"></span><h3>C-states (idle states)<a class="headerlink" href="#c-states-idle-states" title="Link to this heading">¶</a></h3>
|
||
<p>Hardware enters a C-state when the CPU is idle and not executing instructions.
|
||
C-states decrease power utilization by reducing clock frequency,
|
||
voltages, and features in each state. Although C-states can typically be
|
||
limited or disabled in a system’s UEFI or BIOS configuration, these settings
|
||
are overridden when the <a class="reference external" href="https://github.com/torvalds/linux/blob/master/drivers/idle/intel_idle.c">intel_idle driver</a> is in use.</p>
|
||
<p>To view the current <code class="docutils literal notranslate"><span class="pre">cpuidle</span></code> driver run this command in a terminal:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>cat<span class="w"> </span>/sys/devices/system/cpu/cpuidle/current_driver
|
||
</pre></div>
|
||
</div>
|
||
<p>For troubleshooting, C-states can be limited with a kernel command line boot
|
||
parameter by adding <strong class="command">processor.max_cstate=N intel_idle.max_cstate=N</strong>
|
||
or completely disabled with <strong class="command">idle=poll</strong>.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<ul class="simple">
|
||
<li><p><strong class="command">processor.max_cstate=0</strong> is changed to a valid value by the
|
||
kernel: <strong class="command">processor.max_cstate=1</strong>.</p></li>
|
||
<li><p><strong class="command">intel_idle.max_cstate=0</strong> disables the Intel Idle driver rather
|
||
than set it to C-state 0.</p></li>
|
||
</ul>
|
||
</div>
|
||
</section>
|
||
<section id="p-states-performance-states">
|
||
<span id="p-states-section"></span><h3>P-states (performance states)<a class="headerlink" href="#p-states-performance-states" title="Link to this heading">¶</a></h3>
|
||
<p>The CPU can enter a P-state, also known as Intel SpeedStep® technology on
|
||
Intel processors or AMD* Cool’n’Quiet* technology, while it is active
|
||
and executing instructions. P-states reduce power utilization by adjusting CPU
|
||
clock frequency and voltages based on CPU demand. P-states can typically be
|
||
limited or disabled in a system’s firmware (UEFI/BIOS).</p>
|
||
<section id="turbo-boost">
|
||
<h4>Turbo boost<a class="headerlink" href="#turbo-boost" title="Link to this heading">¶</a></h4>
|
||
<p><a class="reference external" href="https://www.intel.com/content/www/us/en/architecture-and-technology/turbo-boost/turbo-boost-technology.html">Intel® Turbo Boost Technology</a>, found on some modern Intel CPUs, allows
|
||
cores on a processor to temporarily operate at a higher than rated CPU clock
|
||
frequency to accommodate demanding workloads if the CPU is under defined power
|
||
and thermal thresholds. Intel Turbo Boost Technology is an extension of
|
||
P-states, so it can be impacted by limiting C-states or P-states.</p>
|
||
<p>Intel Turbo Boost Technology can be disabled in a system’s UEFI/BIOS or in
|
||
Clear Linux OS:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">echo</span><span class="w"> </span><span class="m">1</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>sudo<span class="w"> </span>tee<span class="w"> </span>/sys/devices/system/cpu/intel_pstate/no_turbo
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
</section>
|
||
</section>
|
||
<section id="linux-cpu-clock-frequency-scaling">
|
||
<h2><a class="toc-backref" href="#id4" role="doc-backlink">Linux CPU clock frequency scaling</a><a class="headerlink" href="#linux-cpu-clock-frequency-scaling" title="Link to this heading">¶</a></h2>
|
||
<p>The <code class="docutils literal notranslate"><span class="pre">CPUFreq</span></code> subsystem in Linux allows the OS to control
|
||
<a class="reference internal" href="#c-states-section"><span class="std std-ref">C-states</span></a> and <a class="reference internal" href="#p-states-section"><span class="std std-ref">P-states</span></a>
|
||
via CPU drivers and governors that provide algorithms that define how and when
|
||
to enter these states.</p>
|
||
<section id="scaling-driver">
|
||
<h3>Scaling driver<a class="headerlink" href="#scaling-driver" title="Link to this heading">¶</a></h3>
|
||
<p>Linux uses the <a class="reference external" href="https://www.kernel.org/doc/Documentation/cpu-freq/intel-pstate.txt">Intel P-state driver</a>, <strong class="command">intel_pstate</strong>, for
|
||
modern Intel processors from the Sandy Bridge generation or newer. Other
|
||
processors may default to the <strong class="command">acpi-cpufreq</strong> driver which reads
|
||
values from the systems UEFI or BIOS.</p>
|
||
<p>To view the current CPU frequency scaling driver, run this command in a
|
||
terminal:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>cat<span class="w"> </span>/sys/devices/system/cpu/cpu*/cpufreq/scaling_driver
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="scaling-governor">
|
||
<h3>Scaling governor<a class="headerlink" href="#scaling-governor" title="Link to this heading">¶</a></h3>
|
||
<p>Clear Linux OS sets the CPU governor to <code class="docutils literal notranslate"><span class="pre">performance</span></code> which calls for the CPU to
|
||
operate at maximum clock frequency. In other words, P-state P0. While this may
|
||
sound wasteful at first, it is important to remember that power utilization
|
||
does not increase significantly simply because of a locked clock frequency
|
||
without a workload.</p>
|
||
<p>To view the current CPU frequency scaling governor, run this command in a
|
||
terminal:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>cat<span class="w"> </span>/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||
</pre></div>
|
||
</div>
|
||
<p>Each core will report its own status. Your output should look similar to this
|
||
example with four cores:</p>
|
||
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">performance</span>
|
||
<span class="go">performance</span>
|
||
<span class="go">performance</span>
|
||
<span class="go">performance</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>The list of all governors can be found in the Linux kernel documentation on
|
||
<a class="reference external" href="https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt">CPUFreq Governors</a>.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>The intel_pstate driver only supports <em>performance</em> and <em>powersave</em> governors.</p>
|
||
</div>
|
||
<p>There are 2 ways to change the CPU frequency scaling governor:</p>
|
||
<ol class="arabic">
|
||
<li><p>Disable Clear Linux OS enforcement of certain power and performance settings:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>systemctl<span class="w"> </span>mask<span class="w"> </span>clr-power.timer
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Change the governor value in <code class="file docutils literal notranslate"><span class="pre">/sys/devices</span></code>. In the example below,
|
||
the governor is set to <em>performance</em>:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">echo</span><span class="w"> </span>performance<span class="w"> </span><span class="p">|</span><span class="w"> </span>sudo<span class="w"> </span>tee<span class="w"> </span>/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
</ol>
|
||
</section>
|
||
</section>
|
||
<section id="thermal-management">
|
||
<h2><a class="toc-backref" href="#id5" role="doc-backlink">Thermal management</a><a class="headerlink" href="#thermal-management" title="Link to this heading">¶</a></h2>
|
||
<p><a class="reference external" href="https://01.org/linux-thermal-daemon">thermald</a> is a Linux thermal management daemon used to prevent platforms
|
||
from overheating. <strong class="command">thermald</strong> forces a C-state by inserting CPU sleep
|
||
cycles and adjusting any available cooling methods. This can be especially
|
||
desirable for laptops.</p>
|
||
<p><strong class="command">thermald</strong> is disabled by default in Clear Linux OS and starts automatically
|
||
if it detects battery power. Enable <strong class="command">thermald</strong> manually by using
|
||
the systemd service by running the command:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>systemctl<span class="w"> </span><span class="nb">enable</span><span class="w"> </span>--now<span class="w"> </span>thermald
|
||
</pre></div>
|
||
</div>
|
||
<p>For more information, see the <strong class="command">thermald</strong> man page:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>man<span class="w"> </span>thermald
|
||
</pre></div>
|
||
</div>
|
||
<p><a class="reference external" href="https://github.com/intel/thermal_daemon/tree/master/tools/thermal_monitor">ThermalMonitor</a> is a GUI application that can visually graph and log
|
||
temperatures from <strong class="command">thermald</strong>. To use ThermalMonitor, add the
|
||
<strong class="command">desktop-apps-extras</strong> bundle and add your user account to the power
|
||
group:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>swupd<span class="w"> </span>bundle-add<span class="w"> </span>desktop-apps-extras
|
||
sudo<span class="w"> </span>usermod<span class="w"> </span>-a<span class="w"> </span>-G<span class="w"> </span>power<span class="w"> </span><USER>
|
||
ThermalMonitor
|
||
</pre></div>
|
||
</div>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>After adding a new group, you must log out and log back in for the new group
|
||
to take effect.</p>
|
||
</div>
|
||
<section id="enhanced-thermal-configuration">
|
||
<h3>Enhanced thermal configuration<a class="headerlink" href="#enhanced-thermal-configuration" title="Link to this heading">¶</a></h3>
|
||
<p>Better thermal control and performance can be achieved by providing platform
|
||
specific configuration to <strong class="command">thermald</strong>.</p>
|
||
<p><a class="reference external" href="https://github.com/intel/dptfxtract">Linux DPTF Extract Utility</a> is a companion tool to <strong class="command">thermald</strong>,
|
||
This tool uses Intel® Dynamic Platform and Thermal Framework (Intel® DPTF)
|
||
technology and can convert to the <code class="file docutils literal notranslate"><span class="pre">thermal_conf.xml</span></code> configuration format
|
||
used by <strong class="command">thermald</strong>. Closed-source projects, like this one, cannot be
|
||
packaged as a bundle in Clear Linux OS, so you must install it manually:</p>
|
||
<ol class="arabic">
|
||
<li><p>Make sure your machine’s BIOS has DPTF feature and is enabled. It will usually be in the <span class="guilabel">Advanced</span> or <span class="guilabel">Advanced>Power</span> section of the BIOS.</p>
|
||
<figure class="align-default">
|
||
<img alt="../../_images/dptf_bios.png" src="../../_images/dptf_bios.png" />
|
||
</figure>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>Intel DPTF requires BIOS support and is typically only available on
|
||
laptops.</p>
|
||
</div>
|
||
</li>
|
||
<li><p>Generate thermal configuration. <strong class="command">thermald</strong> configuration files
|
||
will be generated and saved to <code class="file docutils literal notranslate"><span class="pre">/etc/thermal/</span></code> folder.</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>swupd<span class="w"> </span>bundle-add<span class="w"> </span>acpica-unix2<span class="w"> </span><span class="c1"># install acpi tools</span>
|
||
git<span class="w"> </span>clone<span class="w"> </span>https://github.com/intel/dptfxtract.git
|
||
<span class="nb">cd</span><span class="w"> </span>dptfxtract
|
||
sudo<span class="w"> </span>acpidump<span class="w"> </span>><span class="w"> </span>acpi.out
|
||
acpixtract<span class="w"> </span>-a<span class="w"> </span>acpi.out
|
||
sudo<span class="w"> </span>./dptfxtract<span class="w"> </span>*.dat
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Restart <strong class="command">thermald</strong> service to take effect.</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>systemctl<span class="w"> </span>restart<span class="w"> </span>thermald.service
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Check whether the configuration is in use.</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>systemctl<span class="w"> </span>status<span class="w"> </span>thermald.service
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
</ol>
|
||
<p>The following output means the configuration has already been applied:</p>
|
||
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">thermald[*]: [WARN]Using generated /etc/thermald/thermal-conf.xml.auto</span>
|
||
</pre></div>
|
||
</div>
|
||
<p><em>Intel® Turbo Boost Technology requires a PC with a processor with Intel Turbo
|
||
Boost Technology capability. Intel Turbo Boost Technology performance varies
|
||
depending on hardware, software and overall system configuration. Check with
|
||
your PC manufacturer on whether your system delivers Intel Turbo Boost Technology.
|
||
For more information, see http://www.intel.com/technology/turboboost</em></p>
|
||
<p><em>Intel, Intel SpeedStep, and the Intel logo are trademarks of Intel Corporation or its subsidiaries.</em></p>
|
||
</section>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
<div class="clearer"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
||
<div class="sphinxsidebarwrapper">
|
||
<p class="logo"><a href="../../index.html">
|
||
<img class="logo" src="../../_static/clearlinux.png" alt="Logo of Clear Linux* Project Docs"/>
|
||
</a></p>
|
||
<div>
|
||
<h3><a href="../../index.html">Table of Contents</a></h3>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">CPU Power and Performance</a><ul>
|
||
<li><a class="reference internal" href="#overview">Overview</a></li>
|
||
<li><a class="reference internal" href="#cpu-power-saving-mechanisms">CPU power saving mechanisms</a><ul>
|
||
<li><a class="reference internal" href="#c-states-idle-states">C-states (idle states)</a></li>
|
||
<li><a class="reference internal" href="#p-states-performance-states">P-states (performance states)</a><ul>
|
||
<li><a class="reference internal" href="#turbo-boost">Turbo boost</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#linux-cpu-clock-frequency-scaling">Linux CPU clock frequency scaling</a><ul>
|
||
<li><a class="reference internal" href="#scaling-driver">Scaling driver</a></li>
|
||
<li><a class="reference internal" href="#scaling-governor">Scaling governor</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#thermal-management">Thermal management</a><ul>
|
||
<li><a class="reference internal" href="#enhanced-thermal-configuration">Enhanced thermal configuration</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
</div>
|
||
<div>
|
||
<h4>Previous topic</h4>
|
||
<p class="topless"><a href="container-image-new.html"
|
||
title="previous chapter">Build a new Clear Linux OS-based container image</a></p>
|
||
</div>
|
||
<div>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="deploy-at-scale.html"
|
||
title="next chapter">Deploy at Scale</a></p>
|
||
</div>
|
||
<div role="note" aria-label="source link">
|
||
<h3>This Page</h3>
|
||
<ul class="this-page-menu">
|
||
<li><a href="../../_sources/guides/maintenance/cpu-performance.rst.txt"
|
||
rel="nofollow">Show Source</a></li>
|
||
</ul>
|
||
</div>
|
||
<search id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="../../search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</search>
|
||
<script>document.getElementById('searchbox').style.display = "block"</script>
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="Related">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../../genindex.html" title="General Index"
|
||
>index</a></li>
|
||
<li class="right" >
|
||
<a href="deploy-at-scale.html" title="Deploy at Scale"
|
||
>next</a> |</li>
|
||
<li class="right" >
|
||
<a href="container-image-new.html" title="Build a new Clear Linux OS-based container image"
|
||
>previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../../index.html">Documentation for Clear Linux* project</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="../index.html" >Guides</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">CPU Power and Performance</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2022 Intel Corporation. All Rights Reserved..
|
||
Last updated on Nov 04, 2024.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.1.3.
|
||
</div>
|
||
</body>
|
||
</html> |