tests/avocado: s390x cpu topology polarization
Polarization is changed on a request from the guest. Let's verify the polarization is accordingly set by QEMU. Signed-off-by: Pierre Morel <pmorel@linux.ibm.com> Co-developed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com> Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com> Message-ID: <20231016183925.2384704-17-nsg@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
e5bc49d54d
commit
cb042c73f3
@ -41,6 +41,7 @@ class S390CPUTopology(QemuSystemTest):
|
|||||||
The polarization is changed on a request from the guest.
|
The polarization is changed on a request from the guest.
|
||||||
"""
|
"""
|
||||||
timeout = 90
|
timeout = 90
|
||||||
|
event_timeout = 10
|
||||||
|
|
||||||
KERNEL_COMMON_COMMAND_LINE = ('printk.time=0 '
|
KERNEL_COMMON_COMMAND_LINE = ('printk.time=0 '
|
||||||
'root=/dev/ram '
|
'root=/dev/ram '
|
||||||
@ -103,6 +104,14 @@ class S390CPUTopology(QemuSystemTest):
|
|||||||
'-initrd', initrd_path,
|
'-initrd', initrd_path,
|
||||||
'-append', kernel_command_line)
|
'-append', kernel_command_line)
|
||||||
|
|
||||||
|
def system_init(self):
|
||||||
|
self.log.info("System init")
|
||||||
|
exec_command_and_wait_for_pattern(self,
|
||||||
|
""" mount proc -t proc /proc;
|
||||||
|
mount sys -t sysfs /sys;
|
||||||
|
cat /sys/devices/system/cpu/dispatching """,
|
||||||
|
'0')
|
||||||
|
|
||||||
def test_single(self):
|
def test_single(self):
|
||||||
"""
|
"""
|
||||||
This test checks the simplest topology with a single CPU.
|
This test checks the simplest topology with a single CPU.
|
||||||
@ -198,3 +207,39 @@ class S390CPUTopology(QemuSystemTest):
|
|||||||
self.check_topology(3, 1, 1, 1, 'high', False)
|
self.check_topology(3, 1, 1, 1, 'high', False)
|
||||||
self.check_topology(4, 1, 1, 1, 'medium', False)
|
self.check_topology(4, 1, 1, 1, 'medium', False)
|
||||||
self.check_topology(5, 2, 1, 1, 'high', True)
|
self.check_topology(5, 2, 1, 1, 'high', True)
|
||||||
|
|
||||||
|
|
||||||
|
def guest_set_dispatching(self, dispatching):
|
||||||
|
exec_command(self,
|
||||||
|
f'echo {dispatching} > /sys/devices/system/cpu/dispatching')
|
||||||
|
self.vm.event_wait('CPU_POLARIZATION_CHANGE', self.event_timeout)
|
||||||
|
exec_command_and_wait_for_pattern(self,
|
||||||
|
'cat /sys/devices/system/cpu/dispatching', dispatching)
|
||||||
|
|
||||||
|
|
||||||
|
def test_polarization(self):
|
||||||
|
"""
|
||||||
|
This test verifies that QEMU modifies the entitlement change after
|
||||||
|
several guest polarization change requests.
|
||||||
|
|
||||||
|
:avocado: tags=arch:s390x
|
||||||
|
:avocado: tags=machine:s390-ccw-virtio
|
||||||
|
"""
|
||||||
|
self.kernel_init()
|
||||||
|
self.vm.launch()
|
||||||
|
self.wait_until_booted()
|
||||||
|
|
||||||
|
self.system_init()
|
||||||
|
res = self.vm.qmp('query-s390x-cpu-polarization')
|
||||||
|
self.assertEqual(res['return']['polarization'], 'horizontal')
|
||||||
|
self.check_topology(0, 0, 0, 0, 'medium', False)
|
||||||
|
|
||||||
|
self.guest_set_dispatching('1');
|
||||||
|
res = self.vm.qmp('query-s390x-cpu-polarization')
|
||||||
|
self.assertEqual(res['return']['polarization'], 'vertical')
|
||||||
|
self.check_topology(0, 0, 0, 0, 'medium', False)
|
||||||
|
|
||||||
|
self.guest_set_dispatching('0');
|
||||||
|
res = self.vm.qmp('query-s390x-cpu-polarization')
|
||||||
|
self.assertEqual(res['return']['polarization'], 'horizontal')
|
||||||
|
self.check_topology(0, 0, 0, 0, 'medium', False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user