S390x: CPU Topology Information
v5 cover S390x: CPU Topology Information
Hi,
new version of the series with corrections.
When facility 11 is available inside the S390x architecture, 2 new instructions are available: PTF and STSI with function code 15.
Let's check their availability in QEMU/KVM and their coherence with the CPU topology provided to the QEMU -smp parameter and as argument for the test.
To run these tests successfully you will Linux 6.0 and the following QEMU patches (or newer):
https://lore.kernel.org/all/[email protected]/#r
To start the test just do:
# ./run_tests.sh topology
or
# ./s390x-run s390x/topology.elf \ -smp 5,sockets=4,cores=4,maxcpus=16 \ -append "-mnest 2 -sockets 4 -cores 4"
Of course the declaration of the number of socket and core must be coherent in -smp and -append arguments.
The "mnest" argument represent the expected nesting level it will be 2 until books and drawer are added to the topology.
Regards,
Pierre
Pierre Morel (2):
s390x: topology: Check the Perform Topology Function
s390x: topology: Checking Configuration Topology Information
lib/s390x/stsi.h | 44 ++++++ s390x/Makefile | 1 + s390x/topology.c | 366 ++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 4 + 4 files changed, 415 insertions(+) create mode 100644 s390x/topology.c
Signature · 7 lines
2.31.1 Changelog: From v4: - Simplify the tests for socket and cores only.
PATCH v5 1/2 s390x: topology: Check the Perform Topology Function
We check the PTF instruction.
- We check polarization only for KVM.
- We do not expect KVM to support vertical polarization.
- We do not expect the Topology Change Report to be pending or not at the moment the first PTF instruction with PTF_CHECK function code is done as some code already did run a polarization change may have occur.
--- s390x/Makefile | 1 + s390x/topology.c | 132 ++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 3 + 3 files changed, 136 insertions(+) create mode 100644 s390x/topology.c
s390x/Makefile +1 -0
@@ -39,6 +39,7 @@ tests += $(TEST_DIR)/panic-loop-extint.elf tests += $(TEST_DIR)/panic-loop-pgm.elf tests += $(TEST_DIR)/migration-sck.elf tests += $(TEST_DIR)/exittime.elf +tests += $(TEST_DIR)/topology.elf pv-tests += $(TEST_DIR)/pv-diags.elf
s390x/topology.c new file +132 -0
132 lines not on this page · raw message
s390x/unittests.cfg +3 -0
@@ -208,3 +208,6 @@ groups = migration [exittime] file = exittime.elf smp = 2 + +[topology] +file = topology.elf
Signature · 1 line
2.31.1
PATCH v5 2/2 s390x: topology: Checking Configuration Topology Information
In reply to Pierre MorelSTSI with function code 15 is used to store the CPU configuration topology.
We check :
- if the topology stored is coherent between the QEMU -smp parameters and kernel parameters.
- the number of CPUs
- the maximum number of CPUs
- the number of containers of each levels for every STSI(15.1.x) instruction allowed by the machine.
--- lib/s390x/stsi.h | 44 ++++++++ s390x/topology.c | 238 +++++++++++++++++++++++++++++++++++++++++++- s390x/unittests.cfg | 1 + 3 files changed, 281 insertions(+), 2 deletions(-)
lib/s390x/stsi.h +44 -0
@@ -29,4 +29,48 @@ struct sysinfo_3_2_2 {uint8_t ext_names[8 ][256 ]; }; +struct topology_core { +uint8_t nl; +uint8_t reserved1[3 ]; +uint8_t reserved4:5 ; +uint8_t d:1 ; +uint8_t pp:2 ; +uint8_t type; +uint16_t origin; +uint64_t mask; +}; + +struct topology_container { +uint8_t nl; +uint8_t reserved[6 ]; +uint8_t id; +}; + +union topology_entry { +uint8_t nl; +struct topology_core cpu; +struct topology_container container; +}; + +#define CPU_TOPOLOGY_MAX_LEVEL 6 +struct sysinfo_15_1_x { +uint8_t reserved0[2 ]; +uint16_t length; +uint8_t mag[CPU_TOPOLOGY_MAX_LEVEL ]; +uint8_t reserved0a; +uint8_t mnest; +uint8_t reserved0c[4 ]; +union topology_entry tle[0 ]; +}; + +static inline int cpus_in_tle_mask (uint64_t val) +{ +int i, n; + +for (i =0 , n =0 ; i <64 ; i++, val >>=1 ) +if (val &0x01 ) + n++; +return n; +} +#endif /* _S390X_STSI_H_ */
s390x/topology.c +236 -2
267 lines not on this page · raw message
s390x/unittests.cfg +1 -0
@@ -211,3 +211,4 @@ smp = 2 [topology] file = topology.elf +extra_params=-smp 5,sockets=4,cores=4,maxcpus=16 -append '-mnest 2 -sockets 4 -cores 4'
Signature · 1 line
2.31.1