CSIT-470 Add option to configure CFS scheduler priority for QEMU 31/3831/4
authorpmikus <pmikus@cisco.com>
Tue, 15 Nov 2016 13:47:38 +0000 (14:47 +0100)
committerPeter Mikus <pmikus@cisco.com>
Wed, 16 Nov 2016 08:38:16 +0000 (08:38 +0000)
Add option to configure CFS scheduler priority for QEMU

Change-Id: I76da7f536e70a23a57cf5215ab60002f95532b19
Signed-off-by: pmikus <pmikus@cisco.com>
resources/libraries/python/QemuUtils.py
resources/libraries/robot/performance.robot

index 76f8606..cfdbc7f 100644 (file)
@@ -149,6 +149,22 @@ class QemuUtils(object):
                 raise RuntimeError('Set affinity failed on {0}'.format(
                     self._node['host']))
 
+    def qemu_set_scheduler_policy(self):
+        """Set scheduler policy to SCHED_RR with priority 1 for all Qemu CPU
+        processes.
+
+       :raises RuntimeError: Set scheduler policy failed.
+        """
+        qemu_cpus = self._qemu_qmp_exec('query-cpus')['return']
+
+        for qemu_cpu in qemu_cpus:
+            cmd = 'chrt -r -p 1 {0}'.format(qemu_cpu['thread_id'])
+            (ret_code, _, stderr) = self._ssh.exec_command_sudo(cmd)
+            if int(ret_code) != 0:
+                logger.debug('Set SCHED_RR failed {0}'.format(stderr))
+                raise RuntimeError('Set SCHED_RR failed on {0}'.format(
+                    self._node['host']))
+
     def qemu_set_node(self, node):
         """Set node to run QEMU on.
 
index c33e9f3..28f02f9 100644 (file)
 | | Run keyword | ${vm_name}.Qemu Set Disk Image | ${glob_vm_image}
 | | ${vm}= | Run keyword | ${vm_name}.Qemu Start
 | | Run keyword | ${vm_name}.Qemu Set Affinity | 5 | 6 | 7
+| | Run keyword | ${vm_name}.Qemu Set Scheduler Policy
 | | Dpdk Testpmd Start | ${vm} | eal_coremask=0x7
 | | ...                | eal_mem_channels=4
 | | ...                | pmd_fwd_mode=io
 | | Run keyword | ${vm_name}.Qemu Set Disk Image | ${glob_vm_image}
 | | ${vm}= | Run keyword | ${vm_name}.Qemu Start
 | | Run keyword | ${vm_name}.Qemu Set Affinity | 5 | 6 | 7
+| | Run keyword | ${vm_name}.Qemu Set Scheduler Policy
 | | Dpdk Testpmd Start | ${vm} | eal_coremask=0x7
 | | ...                | eal_mem_channels=4
 | | ...                | pmd_fwd_mode=mac
 | | Run keyword | ${vm_name}.Qemu Set Disk Image | ${glob_vm_image}
 | | ${vm}= | Run keyword | ${vm_name}.Qemu Start
 | | Run keyword | ${vm_name}.Qemu Set Affinity | 5 | 6 | 7
+| | Run keyword | ${vm_name}.Qemu Set Scheduler Policy
 | | ${br}= | Set Variable | br0
 | | ${vhost1}= | Get Vhost User If Name By Sock | ${vm} | ${sock1}
 | | ${vhost2}= | Get Vhost User If Name By Sock | ${vm} | ${sock2}

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.