[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/25] tests/avocado: s390x cpu topology entitlement tests
From: |
Thomas Huth |
Subject: |
[PULL 17/25] tests/avocado: s390x cpu topology entitlement tests |
Date: |
Wed, 18 Oct 2023 15:07:08 +0200 |
From: Pierre Morel <pmorel@linux.ibm.com>
Test changes in the entitlement from both a guest and a host point of
view, depending on the polarization.
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
Reviewed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Co-developed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Message-ID: <20231016183925.2384704-18-nsg@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/avocado/s390_topology.py | 62 ++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git a/tests/avocado/s390_topology.py b/tests/avocado/s390_topology.py
index 8166cee134..24fac9a54d 100644
--- a/tests/avocado/s390_topology.py
+++ b/tests/avocado/s390_topology.py
@@ -243,3 +243,65 @@ def test_polarization(self):
res = self.vm.qmp('query-s390x-cpu-polarization')
self.assertEqual(res['return']['polarization'], 'horizontal')
self.check_topology(0, 0, 0, 0, 'medium', False)
+
+
+ def check_polarization(self, polarization):
+ #We need to wait for the change to have been propagated to the kernel
+ exec_command_and_wait_for_pattern(self,
+ "\n".join([
+ "timeout 1 sh -c 'while true",
+ 'do',
+ ' syspath="/sys/devices/system/cpu/cpu0/polarization"',
+ ' polarization="$(cat "$syspath")" || exit',
+ f' if [ "$polarization" = "{polarization}" ]; then',
+ ' exit 0',
+ ' fi',
+ ' sleep 0.01',
+ #searched for strings mustn't show up in command, '' to
obfuscate
+ "done' && echo succ''ess || echo fail''ure",
+ ]),
+ "success", "failure")
+
+
+ def test_entitlement(self):
+ """
+ This test verifies that QEMU modifies the entitlement
+ after a guest request and that the guest sees the change.
+
+ :avocado: tags=arch:s390x
+ :avocado: tags=machine:s390-ccw-virtio
+ """
+ self.kernel_init()
+ self.vm.launch()
+ self.wait_until_booted()
+
+ self.system_init()
+
+ self.check_polarization('horizontal')
+ self.check_topology(0, 0, 0, 0, 'medium', False)
+
+ self.guest_set_dispatching('1')
+ self.check_polarization('vertical:medium')
+ self.check_topology(0, 0, 0, 0, 'medium', False)
+
+ res = self.vm.qmp('set-cpu-topology',
+ {'core-id': 0, 'entitlement': 'low'})
+ self.assertEqual(res['return'], {})
+ self.check_polarization('vertical:low')
+ self.check_topology(0, 0, 0, 0, 'low', False)
+
+ res = self.vm.qmp('set-cpu-topology',
+ {'core-id': 0, 'entitlement': 'medium'})
+ self.assertEqual(res['return'], {})
+ self.check_polarization('vertical:medium')
+ self.check_topology(0, 0, 0, 0, 'medium', False)
+
+ res = self.vm.qmp('set-cpu-topology',
+ {'core-id': 0, 'entitlement': 'high'})
+ self.assertEqual(res['return'], {})
+ self.check_polarization('vertical:high')
+ self.check_topology(0, 0, 0, 0, 'high', False)
+
+ self.guest_set_dispatching('0');
+ self.check_polarization("horizontal")
+ self.check_topology(0, 0, 0, 0, 'high', False)
--
2.41.0
- Re: [PULL 06/25] s390x/cpu topology: resetting the Topology-Change-Report, (continued)
[PULL 08/25] target/s390x/cpu topology: activate CPU topology, Thomas Huth, 2023/10/18
[PULL 02/25] CPU topology: extend with s390 specifics, Thomas Huth, 2023/10/18
[PULL 04/25] target/s390x/cpu topology: handle STSI(15) and build the SYSIB, Thomas Huth, 2023/10/18
[PULL 10/25] machine: adding s390 topology to query-cpu-fast, Thomas Huth, 2023/10/18
[PULL 11/25] machine: adding s390 topology to info hotpluggable-cpus, Thomas Huth, 2023/10/18
[PULL 09/25] qapi/s390x/cpu topology: set-cpu-topology qmp command, Thomas Huth, 2023/10/18
[PULL 12/25] qapi/s390x/cpu topology: CPU_POLARIZATION_CHANGE QAPI event, Thomas Huth, 2023/10/18
[PULL 17/25] tests/avocado: s390x cpu topology entitlement tests,
Thomas Huth <=
[PULL 13/25] qapi/s390x/cpu topology: add query-s390x-cpu-polarization command, Thomas Huth, 2023/10/18
[PULL 21/25] tests/avocado: s390x cpu topology bad move, Thomas Huth, 2023/10/18
[PULL 24/25] target/s390x/kvm: Simplify the GPRs, ACRs, CRs and prefix synchronization code, Thomas Huth, 2023/10/18
[PULL 22/25] hw/s390x: Clean up global variable shadowing in quiesce_powerdown_req(), Thomas Huth, 2023/10/18
[PULL 15/25] tests/avocado: s390x cpu topology core, Thomas Huth, 2023/10/18
[PULL 14/25] docs/s390x/cpu topology: document s390x cpu topology, Thomas Huth, 2023/10/18
[PULL 18/25] tests/avocado: s390x cpu topology test dedicated CPU, Thomas Huth, 2023/10/18
[PULL 19/25] tests/avocado: s390x cpu topology test socket full, Thomas Huth, 2023/10/18
[PULL 20/25] tests/avocado: s390x cpu topology dedicated errors, Thomas Huth, 2023/10/18
[PULL 23/25] target/s390x/kvm: Turn KVM_CAP_SYNC_REGS into a hard requirement, Thomas Huth, 2023/10/18