[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v17 00/12] s390x: CPU Topology
[PATCH v17 00/12] s390x: CPU Topology
Thu, 9 Mar 2023 13:14:59 +0100
What is new in this new spin:
A) shadow_entitlement stores the vertical entitlement
It serves two purposes:
1) when the host specifies the entitlement, he may not be aware
of the polarization and may provide entitlement which is not
correct for the current polarization.
For exemple, specifying a vertical_high/low/medium entitlement
when defining a vCPU on the QEMU command line or hot plugging a vCPU.
Then we keep in shadow_entitlement the vertical entitlement specified
when the machine is in an horizontal polarization.
(impact on patch ...interception-of-PTF... make me remove Thomas R-B)
2) When the guest specifies a polarization change this allows QEMU to
remember the setting specified on vCPU creation.
The use of set-cpu-topology qmp command is not necessary set the
vertical entitlement after receiving the CPU_TOPOLOGY_CHANGE event
but is only needed to modify it.
B) qapi/machine-common.json is created for definitions common to both
qapi/machine.json and qapi/machine-target.json.
@CpuS390Entitlement is defined there.
C) Drawers and books are added in the output of hmp_hotpluggable_cpus
D) Documentation: put QAPI interface into devel directory,
Since the facility 11, S390_FEAT_CONFIGURATION_TOPOLOGY is already
in the CPU model for old QEMU we could not activate it as usual from
KVM but needed a KVM capability: KVM_CAP_S390_CPU_TOPOLOGY.
Checking and enabling this capability enables facility 11,
It is the responsibility of the admin to ensure the same CPU
model for source and target host in a migration.
When the target guest is started, the Multi-processor Topology Change
Report (MTCR) bit is set during the creation of the vCPU by KVM.
We do not need to migrate its state, in the worst case, the target
guest will see the MTCR and actualize its view of the topology
without necessity, but this will be done only one time.
Reseting the topology is done during subsystem reset, the
polarization is reset to horizontal polarization.
The topology attributes are carried by the CPU object and defined
on object creation.
In the case the new attributes, socket, book, drawer, dedicated,
polarity are not provided QEMU provides defaults values.
- Geometry defaults
The geometry default are based on the core-id of the core to
fill the geometry in a monotone way starting with drawer 0,
book 0, and filling socket 0 with the number of cores per socket,
then filling socket 1, socket 2 ... etc until the book is complete
and all books until the first drawer is complete before starting with
the next drawer.
This allows to keep existing start scripts and Libvirt existing
interface until it is extended.
- Modifiers defaults
Default polarization is horizontal
Default dedication is not dedicated.
Dynamic topology modification
QAPI interface is extended with:
- a command: 'x-set-cpu-topology'
- a query: extension of qmp 'query-cpus-fast'
- a query: extension of hmp 'hotpluggable-cpus'
- an event: 'CPU_POLARITY_CHANGE'
The admin may use query-cpus-fast to verify the topology provided
to the guest and x-set-cpu-topology to modify it.
The event CPU_POLARITY_CHANGE is sent when the guest successfuly
uses the PTF(2) instruction to request a polarization change.
In that case, the admin is supposed to modify the CPU provisioning
To use the QEMU patches, you will need Linux V6-rc1 or newer,
or use the following Linux mainline patches:
f5ecfee94493 2022-07-20 KVM: s390: resetting the Topology-Change-Report
24fe0195bc19 2022-07-20 KVM: s390: guest support for topology function
0130337ec45b 2022-07-20 KVM: s390: Cleanup ipte lock access and SIIF fac..
Currently this code is for KVM only, I have no idea if it is interesting
to provide a TCG patch. If ever it will be done in another series.
To have a better understanding of the S390x CPU Topology and its
implementation in QEMU you can have a look at the documentation in the
last patch of this series.
The admin will want to match the host and the guest topology, taking
into account that the guest does not recognize multithreading.
Consequently, two vCPU assigned to threads of the same real CPU should
preferably be assigned to the same socket of the guest machine.
Pierre Morel (12):
s390x/cpu topology: add s390 specifics to CPU topology
s390x/cpu topology: add topology entries on CPU hotplug
target/s390x/cpu topology: handle STSI(15) and build the SYSIB
s390x/sclp: reporting the maximum nested topology entries
s390x/cpu topology: resetting the Topology-Change-Report
s390x/cpu topology: interception of PTF instruction
target/s390x/cpu topology: activate CPU topology
qapi/s390x/cpu topology: set-cpu-topology qmp command
machine: adding s390 topology to query-cpu-fast
machine: adding s390 topology to info hotpluggable-cpus
qapi/s390x/cpu topology: CPU_POLARIZATION_CHANGE qapi event
docs/s390x/cpu topology: document s390x cpu topology
docs/devel/index-internals.rst | 1 +
docs/devel/s390-cpu-topology.rst | 146 ++++++++
docs/system/s390x/cpu-topology.rst | 238 +++++++++++++
docs/system/target-s390x.rst | 1 +
qapi/machine-common.json | 22 ++
qapi/machine-target.json | 82 +++++
qapi/machine.json | 26 +-
include/hw/boards.h | 10 +-
include/hw/s390x/cpu-topology.h | 82 +++++
include/hw/s390x/s390-virtio-ccw.h | 6 +
include/hw/s390x/sclp.h | 4 +-
target/s390x/cpu.h | 79 +++++
target/s390x/kvm/kvm_s390x.h | 1 +
hw/core/machine-hmp-cmds.c | 6 +
hw/core/machine-qmp-cmds.c | 2 +
hw/core/machine-smp.c | 48 ++-
hw/core/machine.c | 4 +
hw/s390x/cpu-topology.c | 524 +++++++++++++++++++++++++++++
hw/s390x/s390-virtio-ccw.c | 27 +-
hw/s390x/sclp.c | 5 +
softmmu/vl.c | 6 +
target/s390x/cpu-sysemu.c | 13 +
target/s390x/cpu.c | 7 +
target/s390x/cpu_models.c | 1 +
target/s390x/kvm/cpu_topology.c | 310 +++++++++++++++++
target/s390x/kvm/kvm.c | 42 ++-
hw/s390x/meson.build | 1 +
qapi/meson.build | 1 +
qemu-options.hx | 7 +-
target/s390x/kvm/meson.build | 3 +-
30 files changed, 1686 insertions(+), 19 deletions(-)
create mode 100644 docs/devel/s390-cpu-topology.rst
create mode 100644 docs/system/s390x/cpu-topology.rst
create mode 100644 qapi/machine-common.json
create mode 100644 include/hw/s390x/cpu-topology.h
create mode 100644 hw/s390x/cpu-topology.c
create mode 100644 target/s390x/kvm/cpu_topology.c
- documentation, split, bug correction and rephrasing
- create machine-common.json
- use of entitlement_shadow to keep track of the entitlement
- adding drawers and books to query-hotpluggable-cpus
- keep hmp interface for set-cpu-topology for a future series
- Use Enum for polarity and entitlement
- move kvm_vm_enable_cap(KVM_CAP_S390_CPU_TOPOLOGY) to
- Make all CPU attributes optional for set-cpu-topology monitor
- Change use of the prefix "x-" to the use of feature unstable
to declare set-cpu-topology as unstable.
- Make CPU_POLARITY_CHANGE even as unstable
- Documentation update
- move the ordering of TLE to just before filling the SYSIB,
optimize TLE ordering to be done on need only.
(Cedric in previous series)
- remove 'query-topology' and instead extend 'query-cpus-fast'
- rename POLARITY_CHANGE to CPU_POLARITY_CHANGE
- Divers bugs correction and doc changes
- Separate topology and entitlement, simplify pft handling
- add the resetting of all CPU to horizontal polarity
once implementing PTF interpretation
- Suppress the topology device to simplify the code
- moved reset of MTCR from device reset into subsystem
reset and removed previous reviewed-by from Nico and
- No need for Migration
- No need for machine dependencies
- Adding all features, drawer/book and dynamic
- since v12
- suppress new CPU flag "disable-topology" just use ctop
- no use of special fields in CCW machine or in CPU
- modifications in documentation
- insert documentation in tree
- moved cpu-topology.c from target/s390 to target/s390/kvm
to compile smoothly (without topology) for TCG
- since v11
- new CPU flag "disable-topology"
I would have take "topology" if I was able to have
it false on default.
- Build the topology during the interception of the
- return CC3 in case the calculated SYSIB length is
greater than 4096.
- minor corections on documentation
- since v10
- change machine attribute "topology-disable" to "topology"
- Add preliminary patch for machine properties
- Use next machine as 7.2
(Cedric / Connie)
- Remove unecessary mutex
- use ENOTSUP return value for kvm_s390_topology_set_mtcr()
- Add explanation on container and cpu TLEs
- use again cpu and socket count in topology structure
- Suppress the S390TopoTLE structure and integrate
the TLE masks to the socket structure.
- the STSI instruction now finds the topology from the machine
- since v9
- remove books and drawers
- remove thread denying and replace with a merge
of cores * threads to specify the CPUs available
to the guest
- add a class option to avoid topology on older
- Allocate a SYSIB buffer of the maximal length to
- suppress redundancy of smp parameters in topology
and use directly the machine smp structure
- Early check for topology support
- since v8
- Linux patches are now mainline
- simplification of the implementation
- Migration, new machine definition
- since v7
- Coherence with the Linux patch series changes for MTCR get
- check return values during new CPU creation
- Improving codding style and argument usages
- since v6
- Changes on smp args in qemu-options
- changed comments in machine.jason
- Added reset
- since v5
- rebasing on newer QEMU version
- reworked most lines above 80 characters.
- since v4
- Added drawer and books to topology
- Added numa topology
- Added documentation
- since v3
- Added migration
- Separated STSI instruction from KVM to prepare TCG
- Take care of endianess to prepare TCG
- Added comments on STSI CPU container and PFT instruction
- Moved enabling the instructions as the last patch
- [PATCH v17 00/12] s390x: CPU Topology,
Pierre Morel <=
- [PATCH v17 01/12] s390x/cpu topology: add s390 specifics to CPU topology, Pierre Morel, 2023/03/09
- [PATCH v17 04/12] s390x/sclp: reporting the maximum nested topology entries, Pierre Morel, 2023/03/09
- [PATCH v17 02/12] s390x/cpu topology: add topology entries on CPU hotplug, Pierre Morel, 2023/03/09
- [PATCH v17 03/12] target/s390x/cpu topology: handle STSI(15) and build the SYSIB, Pierre Morel, 2023/03/09
- [PATCH v17 06/12] s390x/cpu topology: interception of PTF instruction, Pierre Morel, 2023/03/09
- [PATCH v17 11/12] qapi/s390x/cpu topology: CPU_POLARIZATION_CHANGE qapi event, Pierre Morel, 2023/03/09
- [PATCH v17 12/12] docs/s390x/cpu topology: document s390x cpu topology, Pierre Morel, 2023/03/09
- [PATCH v17 09/12] machine: adding s390 topology to query-cpu-fast, Pierre Morel, 2023/03/09
- [PATCH v17 05/12] s390x/cpu topology: resetting the Topology-Change-Report, Pierre Morel, 2023/03/09