
* Update to QEMU v9.0.0 --------- Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com> Signed-off-by: Ido Plat <ido.plat@ibm.com> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: David Hildenbrand <david@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> Signed-off-by: Gregory Price <gregory.price@memverge.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Lorenz Brun <lorenz@brun.one> Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> Signed-off-by: Arnaud Minier <arnaud.minier@telecom-paris.fr> Signed-off-by: Inès Varhol <ines.varhol@telecom-paris.fr> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Sven Schnelle <svens@stackframe.org> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Benjamin Gray <bgray@linux.ibm.com> Signed-off-by: Avihai Horon <avihaih@nvidia.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Joonas Kankaala <joonas.a.kankaala@gmail.com> Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Glenn Miles <milesg@linux.ibm.com> Signed-off-by: Oleg Sviridov <oleg.sviridov@red-soft.ru> Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru> Signed-off-by: Yajun Wu <yajunw@nvidia.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Pierre-Clément Tosi <ptosi@google.com> Signed-off-by: Lei Wang <lei4.wang@intel.com> Signed-off-by: Wei Wang <wei.w.wang@intel.com> Signed-off-by: Martin Hundebøll <martin@geanix.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Signed-off-by: Wafer <wafer@jaguarmicro.com> Signed-off-by: Yuxue Liu <yuxue.liu@jaguarmicro.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com> Signed-off-by: Zack Buhman <zack@buhman.org> Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Yuquan Wang wangyuquan1236@phytium.com.cn Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com> Signed-off-by: Cindy Lu <lulu@redhat.com> Co-authored-by: Peter Maydell <peter.maydell@linaro.org> Co-authored-by: Fabiano Rosas <farosas@suse.de> Co-authored-by: Peter Xu <peterx@redhat.com> Co-authored-by: Thomas Huth <thuth@redhat.com> Co-authored-by: Cédric Le Goater <clg@redhat.com> Co-authored-by: Zheyu Ma <zheyuma97@gmail.com> Co-authored-by: Ido Plat <ido.plat@ibm.com> Co-authored-by: Ilya Leoshkevich <iii@linux.ibm.com> Co-authored-by: Markus Armbruster <armbru@redhat.com> Co-authored-by: Marc-André Lureau <marcandre.lureau@redhat.com> Co-authored-by: Paolo Bonzini <pbonzini@redhat.com> Co-authored-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Co-authored-by: David Hildenbrand <david@redhat.com> Co-authored-by: Kevin Wolf <kwolf@redhat.com> Co-authored-by: Stefan Reiter <s.reiter@proxmox.com> Co-authored-by: Fiona Ebner <f.ebner@proxmox.com> Co-authored-by: Gregory Price <gregory.price@memverge.com> Co-authored-by: Lorenz Brun <lorenz@brun.one> Co-authored-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> Co-authored-by: Philippe Mathieu-Daudé <philmd@linaro.org> Co-authored-by: Arnaud Minier <arnaud.minier@telecom-paris.fr> Co-authored-by: BALATON Zoltan <balaton@eik.bme.hu> Co-authored-by: Igor Mammedov <imammedo@redhat.com> Co-authored-by: Akihiko Odaki <akihiko.odaki@daynix.com> Co-authored-by: Richard Henderson <richard.henderson@linaro.org> Co-authored-by: Sven Schnelle <svens@stackframe.org> Co-authored-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Co-authored-by: Helge Deller <deller@kernel.org> Co-authored-by: Harsh Prateek Bora <harshpb@linux.ibm.com> Co-authored-by: Benjamin Gray <bgray@linux.ibm.com> Co-authored-by: Nicholas Piggin <npiggin@gmail.com> Co-authored-by: Avihai Horon <avihaih@nvidia.com> Co-authored-by: Michael Tokarev <mjt@tls.msk.ru> Co-authored-by: Joonas Kankaala <joonas.a.kankaala@gmail.com> Co-authored-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> Co-authored-by: Stefan Weil <sw@weilnetz.de> Co-authored-by: Dayu Liu <liu.dayu@zte.com.cn> Co-authored-by: Zhao Liu <zhao1.liu@intel.com> Co-authored-by: Glenn Miles <milesg@linux.vnet.ibm.com> Co-authored-by: Artem Chernyshev <artem.chernyshev@red-soft.ru> Co-authored-by: Yajun Wu <yajunw@nvidia.com> Co-authored-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Co-authored-by: Pierre-Clément Tosi <ptosi@google.com> Co-authored-by: Wei Wang <wei.w.wang@intel.com> Co-authored-by: Martin Hundebøll <martin@geanix.com> Co-authored-by: Michael S. Tsirkin <mst@redhat.com> Co-authored-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Co-authored-by: Wafer <wafer@jaguarmicro.com> Co-authored-by: lyx634449800 <yuxue.liu@jaguarmicro.com> Co-authored-by: Gerd Hoffmann <kraxel@redhat.com> Co-authored-by: Nguyen Dinh Phi <phind.uet@gmail.com> Co-authored-by: Zack Buhman <zack@buhman.org> Co-authored-by: Keith Packard <keithp@keithp.com> Co-authored-by: Yuquan Wang <wangyuquan1236@phytium.com.cn> Co-authored-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com> Co-authored-by: Cindy Lu <lulu@redhat.com>
247 lines
7.8 KiB
ReStructuredText
247 lines
7.8 KiB
ReStructuredText
.. _cpu-topology-s390x:
|
|
|
|
CPU topology on s390x
|
|
=====================
|
|
|
|
Since QEMU 8.2, CPU topology on s390x provides up to 3 levels of
|
|
topology containers: drawers, books and sockets. They define a
|
|
tree-shaped hierarchy.
|
|
|
|
The socket container has one or more CPU entries.
|
|
Each of these CPU entries consists of a bitmap and three CPU attributes:
|
|
|
|
- CPU type
|
|
- entitlement
|
|
- dedication
|
|
|
|
Each bit set in the bitmap correspond to a core-id of a vCPU with matching
|
|
attributes.
|
|
|
|
This documentation provides general information on S390 CPU topology,
|
|
how to enable it and explains the new CPU attributes.
|
|
For information on how to modify the S390 CPU topology and how to
|
|
monitor polarization changes, see ``docs/devel/s390-cpu-topology.rst``.
|
|
|
|
Prerequisites
|
|
-------------
|
|
|
|
To use the CPU topology, you currently need to choose the KVM accelerator.
|
|
See :ref:`Accelerators` for more details about accelerators and how to select them.
|
|
|
|
The s390x host needs to use a Linux kernel v6.0 or newer (which provides the so-called
|
|
``KVM_CAP_S390_CPU_TOPOLOGY`` capability that allows QEMU to signal the
|
|
CPU topology facility via the so-called STFLE bit 11 to the VM).
|
|
|
|
Enabling CPU topology
|
|
---------------------
|
|
|
|
Currently, CPU topology is enabled by default only in the "host" CPU model.
|
|
|
|
Enabling CPU topology in another CPU model is done by setting the CPU flag
|
|
``ctop`` to ``on`` as in:
|
|
|
|
.. code-block:: bash
|
|
|
|
-cpu gen16b,ctop=on
|
|
|
|
Having the topology disabled by default allows migration between
|
|
old and new QEMU without adding new flags.
|
|
|
|
Default topology usage
|
|
----------------------
|
|
|
|
The CPU topology can be specified on the QEMU command line
|
|
with the ``-smp`` or the ``-device`` QEMU command arguments.
|
|
|
|
Note also that since 7.2 threads are no longer supported in the topology
|
|
and the ``-smp`` command line argument accepts only ``threads=1``.
|
|
|
|
If none of the containers attributes (drawers, books, sockets) are
|
|
specified for the ``-smp`` flag, the number of these containers
|
|
is 1.
|
|
|
|
Thus the following two options will result in the same topology:
|
|
|
|
.. code-block:: bash
|
|
|
|
-smp cpus=5,drawer=1,books=1,sockets=8,cores=4,maxcpus=32
|
|
|
|
and
|
|
|
|
.. code-block:: bash
|
|
|
|
-smp cpus=5,sockets=8,cores=4,maxcpus=32
|
|
|
|
When a CPU is defined by the ``-smp`` command argument, its position
|
|
inside the topology is calculated by adding the CPUs to the topology
|
|
based on the core-id starting with core-0 at position 0 of socket-0,
|
|
book-0, drawer-0 and filling all CPUs of socket-0 before filling socket-1
|
|
of book-0 and so on up to the last socket of the last book of the last
|
|
drawer.
|
|
|
|
When a CPU is defined by the ``-device`` command argument, the
|
|
tree topology attributes must all be defined or all not defined.
|
|
|
|
.. code-block:: bash
|
|
|
|
-device gen16b-s390x-cpu,drawer-id=1,book-id=1,socket-id=2,core-id=1
|
|
|
|
or
|
|
|
|
.. code-block:: bash
|
|
|
|
-device gen16b-s390x-cpu,core-id=1,dedicated=true
|
|
|
|
If none of the tree attributes (drawer, book, sockets), are specified
|
|
for the ``-device`` argument, like for all CPUs defined with the ``-smp``
|
|
command argument the topology tree attributes will be set by simply
|
|
adding the CPUs to the topology based on the core-id.
|
|
|
|
QEMU will not try to resolve collisions and will report an error if the
|
|
CPU topology defined explicitly or implicitly on a ``-device``
|
|
argument collides with the definition of a CPU implicitly defined
|
|
on the ``-smp`` argument.
|
|
|
|
When the topology modifier attributes are not defined for the
|
|
``-device`` command argument they takes following default values:
|
|
|
|
- dedicated: ``false``
|
|
- entitlement: ``medium``
|
|
|
|
|
|
Hot plug
|
|
++++++++
|
|
|
|
New CPUs can be plugged using the device_add hmp command as in:
|
|
|
|
.. code-block:: bash
|
|
|
|
(qemu) device_add gen16b-s390x-cpu,core-id=9
|
|
|
|
The placement of the CPU is derived from the core-id as described above.
|
|
|
|
The topology can of course also be fully defined:
|
|
|
|
.. code-block:: bash
|
|
|
|
(qemu) device_add gen16b-s390x-cpu,drawer-id=1,book-id=1,socket-id=2,core-id=1
|
|
|
|
|
|
Examples
|
|
++++++++
|
|
|
|
In the following machine we define 8 sockets with 4 cores each.
|
|
|
|
.. code-block:: bash
|
|
|
|
$ qemu-system-s390x -accel kvm -m 2G \
|
|
-cpu gen16b,ctop=on \
|
|
-smp cpus=5,sockets=8,cores=4,maxcpus=32 \
|
|
-device host-s390x-cpu,core-id=14 \
|
|
|
|
A new CPUs can be plugged using the device_add hmp command as before:
|
|
|
|
.. code-block:: bash
|
|
|
|
(qemu) device_add gen16b-s390x-cpu,core-id=9
|
|
|
|
The core-id defines the placement of the core in the topology by
|
|
starting with core 0 in socket 0 up to maxcpus.
|
|
|
|
In the example above:
|
|
|
|
* There are 5 CPUs provided to the guest with the ``-smp`` command line
|
|
They will take the core-ids 0,1,2,3,4
|
|
As we have 4 cores in a socket, we have 4 CPUs provided
|
|
to the guest in socket 0, with core-ids 0,1,2,3.
|
|
The last CPU, with core-id 4, will be on socket 1.
|
|
|
|
* the core with ID 14 provided by the ``-device`` command line will
|
|
be placed in socket 3, with core-id 14
|
|
|
|
* the core with ID 9 provided by the ``device_add`` qmp command will
|
|
be placed in socket 2, with core-id 9
|
|
|
|
|
|
Polarization, entitlement and dedication
|
|
----------------------------------------
|
|
|
|
Polarization
|
|
++++++++++++
|
|
|
|
The polarization affects how the CPUs of a shared host are utilized/distributed
|
|
among guests.
|
|
The guest determines the polarization by using the PTF instruction.
|
|
|
|
Polarization defines two models of CPU provisioning: horizontal
|
|
and vertical.
|
|
|
|
The horizontal polarization is the default model on boot and after
|
|
subsystem reset. When horizontal polarization is in effect all vCPUs should
|
|
have about equal resource provisioning.
|
|
|
|
In the vertical polarization model vCPUs are unequal, but overall more resources
|
|
might be available.
|
|
The guest can make use of the vCPU entitlement information provided by the host
|
|
to optimize kernel thread scheduling.
|
|
|
|
A subsystem reset puts all vCPU of the configuration into the
|
|
horizontal polarization.
|
|
|
|
Entitlement
|
|
+++++++++++
|
|
|
|
The vertical polarization specifies that the guest's vCPU can get
|
|
different real CPU provisioning:
|
|
|
|
- a vCPU with vertical high entitlement specifies that this
|
|
vCPU gets 100% of the real CPU provisioning.
|
|
|
|
- a vCPU with vertical medium entitlement specifies that this
|
|
vCPU shares the real CPU with other vCPUs.
|
|
|
|
- a vCPU with vertical low entitlement specifies that this
|
|
vCPU only gets real CPU provisioning when no other vCPUs needs it.
|
|
|
|
In the case a vCPU with vertical high entitlement does not use
|
|
the real CPU, the unused "slack" can be dispatched to other vCPU
|
|
with medium or low entitlement.
|
|
|
|
A vCPU can be "dedicated" in which case the vCPU is fully dedicated to a single
|
|
real CPU.
|
|
|
|
The dedicated bit is an indication of affinity of a vCPU for a real CPU
|
|
while the entitlement indicates the sharing or exclusivity of use.
|
|
|
|
Defining the topology on the command line
|
|
-----------------------------------------
|
|
|
|
The topology can entirely be defined using -device cpu statements,
|
|
with the exception of CPU 0 which must be defined with the -smp
|
|
argument.
|
|
|
|
For example, here we set the position of the cores 1,2,3 to
|
|
drawer 1, book 1, socket 2 and cores 0,9 and 14 to drawer 0,
|
|
book 0, socket 0 without defining entitlement or dedication.
|
|
Core 4 will be set on its default position on socket 1
|
|
(since we have 4 core per socket) and we define it as dedicated and
|
|
with vertical high entitlement.
|
|
|
|
.. code-block:: bash
|
|
|
|
$ qemu-system-s390x -accel kvm -m 2G \
|
|
-cpu gen16b,ctop=on \
|
|
-smp cpus=1,sockets=8,cores=4,maxcpus=32 \
|
|
\
|
|
-device gen16b-s390x-cpu,drawer-id=1,book-id=1,socket-id=2,core-id=1 \
|
|
-device gen16b-s390x-cpu,drawer-id=1,book-id=1,socket-id=2,core-id=2 \
|
|
-device gen16b-s390x-cpu,drawer-id=1,book-id=1,socket-id=2,core-id=3 \
|
|
\
|
|
-device gen16b-s390x-cpu,drawer-id=0,book-id=0,socket-id=0,core-id=9 \
|
|
-device gen16b-s390x-cpu,drawer-id=0,book-id=0,socket-id=0,core-id=14 \
|
|
\
|
|
-device gen16b-s390x-cpu,core-id=4,dedicated=on,entitlement=high
|
|
|
|
The entitlement defined for the CPU 4 will only be used after the guest
|
|
successfully enables vertical polarization by using the PTF instruction.
|