Skip to content

Commit 00299dc

Browse files
committed
Add docs for cpu management
Relates to blueprint libvirt-cpu-state-mgmt Change-Id: Id22018a880b39f694a509c04cc6497ef42343049
1 parent 439c672 commit 00299dc

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

doc/source/admin/cpu-topologies.rst

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,97 @@ CPU policy, meanwhile, will consume ``VCPU`` inventory.
730730

731731
.. _configure-hyperv-numa:
732732

733+
Configuring CPU power management for dedicated cores
734+
----------------------------------------------------
735+
736+
.. versionchanged:: 27.0.0
737+
738+
This feature was only introduced by the 2023.1 Antelope release
739+
740+
.. important::
741+
742+
The functionality described below is currently only supported by the
743+
libvirt/KVM driver.
744+
745+
For power saving reasons, operators can decide to turn down the power usage of
746+
CPU cores whether they are in use or not. For obvious reasons, Nova only allows
747+
to change the power consumption of a dedicated CPU core and not a shared one.
748+
Accordingly, usage of this feature relies on the reading of
749+
:oslo.config:option:`compute.cpu_dedicated_set` config option to know which CPU
750+
cores to handle.
751+
The main action to enable the power management of dedicated cores is to set
752+
:oslo.config:option:`libvirt.cpu_power_management` config option to ``True``.
753+
754+
By default, if this option is enabled, Nova will lookup the dedicated cores and
755+
power them down at the compute service startup. Then, once an instance starts
756+
by being attached to a dedicated core, this below core will be powered up right
757+
before the libvirt guest starts. On the other way, once an instance is stopped,
758+
migrated or deleted, then the corresponding dedicated core will be powered down.
759+
760+
There are two distinct strategies for powering up or down :
761+
762+
- the default is to offline the CPU core and online it when needed.
763+
- an alternative strategy is to use two distinct CPU governors for the up state
764+
and the down state.
765+
766+
The strategy can be chosen using
767+
:oslo.config:option:`libvirt.cpu_power_management_strategy` config option.
768+
``cpu_state`` supports the first online/offline strategy, while ``governor``
769+
sets the alternative strategy.
770+
We default to turning off the cores as it provides you the best power savings
771+
while there could be other tools outside Nova to manage the governor, like
772+
tuned. That being said, we also provide a way to automatically change the
773+
governors on the fly, as explained below.
774+
775+
If the strategy is set to ``governor``, a couple of config options are provided
776+
to define which exact CPU govenor to use for each of the up and down states :
777+
778+
- :oslo.config:option:`libvirt.cpu_power_governor_low` will define the governor
779+
to use for the powerdown state (defaults to ``powersave``)
780+
- :oslo.config:option:`libvirt.cpu_power_governor_high` will define the
781+
governor to use for the powerup state (defaults to ``performance``)
782+
783+
.. important::
784+
This is the responsibility of the operator to ensure that the govenors
785+
defined by the configuration options are currently supported by the OS
786+
underlying kernel that runs the compute service.
787+
788+
As a side note, we recommend the ``schedutil`` governor as an alternative for
789+
the high-power state (if the kernel supports it) as the CPU frequency is
790+
dynamically set based on CPU task states. Other governors may be worth to
791+
be tested, including ``conservative`` and ``ondemand`` which are quite a bit
792+
more power consuming than ``schedutil`` but more efficient than
793+
``performance``. See `Linux kernel docs`_ for further explanations.
794+
795+
.. _`Linux kernel docs`: https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt
796+
797+
As an example, a ``nova.conf`` part of configuration would look like::
798+
799+
[compute]
800+
cpu_dedicated_set=2-17
801+
802+
[libvirt]
803+
cpu_power_management=True
804+
cpu_power_management_strategy=cpu_state
805+
806+
.. warning::
807+
808+
The CPU core #0 has a special meaning in most of the recent Linux kernels.
809+
This is always highly discouraged to use it for CPU pinning but please
810+
refrain to have it power managed or you could have surprises if Nova turns
811+
it off !
812+
813+
One last important note : you can decide to change the CPU management strategy
814+
during the compute lifecycle, or you can currently already manage the CPU
815+
states. For ensuring that Nova can correctly manage the CPU performances, we
816+
added a couple of checks at startup that refuse to start nova-compute service
817+
if those arbitrary rules aren't enforced :
818+
819+
- if the operator opts for ``cpu_state`` strategy, then all dedicated CPU
820+
governors *MUST* be identical.
821+
- if they decide using ``governor``, then all dedicated CPU cores *MUST* be
822+
online.
823+
733824
Configuring Hyper-V compute nodes for instance NUMA policies
734825
------------------------------------------------------------
735826

0 commit comments

Comments
 (0)