Lines Matching +full:cpu +full:- +full:2
10 # This work is licensed under the terms of the GNU GPL, version 2 or
11 # later. See the COPYING file in the top-level directory.
21 S390x CPU topology consists of 4 topology layers, from bottom to top,
22 the cores, sockets, books and drawers and 2 modifiers attributes,
24 See: docs/system/s390x/cpu-topology.rst.
26 S390x CPU topology is setup in different ways:
27 - implicitly from the '-smp' argument by completing each topology
30 - explicitly from the '-device' argument on the QEMU command line
31 - explicitly by hotplug of a new CPU using QMP or HMP
32 - it is modified by using QMP 'set-cpu-topology'
47 '/fedora-secondary/releases/35/Server/s390x/os'
53 '/fedora-secondary/releases/35/Server/s390x/os'
59 failure_message='Kernel panic - not syncing',
63 res = self.vm.qmp('query-cpus-fast')
65 for cpu in cpus:
66 core = cpu['props']['core-id']
67 socket = cpu['props']['socket-id']
68 book = cpu['props']['book-id']
69 drawer = cpu['props']['drawer-id']
70 entitlement = cpu.get('entitlement')
71 dedicated = cpu.get('dedicated')
81 We need a VM that supports CPU topology,
83 We need a kernel supporting the CPU topology.
92 self.vm.add_args('-nographic',
93 '-enable-kvm',
94 '-cpu', 'max,ctop=on',
95 '-m', '512',
96 '-kernel', kernel_path,
97 '-initrd', initrd_path,
98 '-append', kernel_command_line)
103 """ mount proc -t proc /proc;
104 mount sys -t sysfs /sys;
105 cat /sys/devices/system/cpu/dispatching """,
110 This test checks the simplest topology with a single CPU.
112 self.set_machine('s390-ccw-virtio')
122 self.set_machine('s390-ccw-virtio')
124 self.vm.add_args('-smp',
125 '13,drawers=2,books=2,sockets=3,cores=2,maxcpus=24')
130 self.check_topology(2, 1, 0, 0, 'medium', False)
132 self.check_topology(4, 2, 0, 0, 'medium', False)
133 self.check_topology(5, 2, 0, 0, 'medium', False)
138 self.check_topology(10, 2, 1, 0, 'medium', False)
139 self.check_topology(11, 2, 1, 0, 'medium', False)
144 This test checks the topology modification by moving a CPU
145 to another socket: CPU 0 is moved from socket 0 to socket 2.
147 self.set_machine('s390-ccw-virtio')
149 self.vm.add_args('-smp',
150 '1,drawers=2,books=2,sockets=3,cores=2,maxcpus=24')
155 res = self.vm.qmp('set-cpu-topology',
156 {'core-id': 0, 'socket-id': 2, 'entitlement': 'low'})
158 self.check_topology(0, 2, 0, 0, 'low', False)
162 This test verifies that a CPU defined with the '-device'
165 self.set_machine('s390-ccw-virtio')
167 self.vm.add_args('-smp',
168 '1,drawers=2,books=2,sockets=3,cores=2,maxcpus=24')
169 self.vm.add_args('-device', 'max-s390x-cpu,core-id=10')
170 self.vm.add_args('-device',
171 'max-s390x-cpu,'
172 'core-id=1,socket-id=0,book-id=1,drawer-id=1,entitlement=low')
173 self.vm.add_args('-device',
174 'max-s390x-cpu,'
175 'core-id=2,socket-id=0,book-id=1,drawer-id=1,entitlement=medium')
176 self.vm.add_args('-device',
177 'max-s390x-cpu,'
178 'core-id=3,socket-id=1,book-id=1,drawer-id=1,entitlement=high')
179 self.vm.add_args('-device',
180 'max-s390x-cpu,'
181 'core-id=4,socket-id=1,book-id=1,drawer-id=1')
182 self.vm.add_args('-device',
183 'max-s390x-cpu,'
184 'core-id=5,socket-id=2,book-id=1,drawer-id=1,dedicated=true')
189 self.check_topology(10, 2, 1, 0, 'medium', False)
191 self.check_topology(2, 0, 1, 1, 'medium', False)
194 self.check_topology(5, 2, 1, 1, 'high', True)
199 f'echo {dispatching} > /sys/devices/system/cpu/dispatching')
202 'cat /sys/devices/system/cpu/dispatching', dispatching)
210 self.set_machine('s390-ccw-virtio')
216 res = self.vm.qmp('query-s390x-cpu-polarization')
221 res = self.vm.qmp('query-s390x-cpu-polarization')
226 res = self.vm.qmp('query-s390x-cpu-polarization')
235 "timeout 1 sh -c 'while true",
237 ' syspath="/sys/devices/system/cpu/cpu0/polarization"',
254 self.set_machine('s390-ccw-virtio')
268 res = self.vm.qmp('set-cpu-topology',
269 {'core-id': 0, 'entitlement': 'low'})
274 res = self.vm.qmp('set-cpu-topology',
275 {'core-id': 0, 'entitlement': 'medium'})
280 res = self.vm.qmp('set-cpu-topology',
281 {'core-id': 0, 'entitlement': 'high'})
294 CPU is made dedicated.
298 self.set_machine('s390-ccw-virtio')
307 res = self.vm.qmp('set-cpu-topology',
308 {'core-id': 0, 'dedicated': True})
325 The socket-id 0 on book-id 0 already contains CPUs 0 and 1 and can
326 not accept any new CPU while socket-id 0 on book-id 1 is free.
328 self.set_machine('s390-ccw-virtio')
330 self.vm.add_args('-smp',
331 '3,drawers=2,books=2,sockets=3,cores=2,maxcpus=24')
337 res = self.vm.qmp('set-cpu-topology',
338 {'core-id': 2, 'socket-id': 0, 'book-id': 0})
341 res = self.vm.qmp('set-cpu-topology',
342 {'core-id': 2, 'socket-id': 0, 'book-id': 1})
348 of a dedicated CPU
350 self.set_machine('s390-ccw-virtio')
357 res = self.vm.qmp('set-cpu-topology',
358 {'core-id': 0, 'dedicated': True})
367 res = self.vm.qmp('set-cpu-topology',
368 {'core-id': 0, 'entitlement': 'low', 'dedicated': True})
371 res = self.vm.qmp('set-cpu-topology',
372 {'core-id': 0, 'entitlement': 'low'})
375 res = self.vm.qmp('set-cpu-topology',
376 {'core-id': 0, 'entitlement': 'medium', 'dedicated': True})
379 res = self.vm.qmp('set-cpu-topology',
380 {'core-id': 0, 'entitlement': 'medium'})
383 res = self.vm.qmp('set-cpu-topology',
384 {'core-id': 0, 'entitlement': 'low', 'dedicated': False})
387 res = self.vm.qmp('set-cpu-topology',
388 {'core-id': 0, 'entitlement': 'medium', 'dedicated': False})
393 This test verifies that QEMU refuses to move a CPU to an
396 self.set_machine('s390-ccw-virtio')
403 res = self.vm.qmp('set-cpu-topology', {'core-id': 0, 'drawer-id': 1})
406 res = self.vm.qmp('set-cpu-topology', {'core-id': 0, 'book-id': 1})
409 res = self.vm.qmp('set-cpu-topology', {'core-id': 0, 'socket-id': 1})