diff options
author | Bill Randle <william.c.randle@intel.com> | 2016-08-16 16:08:11 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-08-18 09:27:53 +0100 |
commit | f479e3866df545dc48544940e5194b318dfcdbbc (patch) | |
tree | 10ef7bab99269c563d070a5d482e230bcc6376fd /meta/lib | |
parent | ff3a455ee84b91e797052760c8d4618109b54c63 (diff) | |
download | poky-f479e3866df545dc48544940e5194b318dfcdbbc.tar.gz |
testimage: allow using kvm when running qemux86* machines
Using kvm can provide significant speedups when running qemux86* machines
on an x86* host. Enabled by using the new QEMU_USE_KVM variable.
[YOCTO #9298]
(From OE-Core rev: ebac2c8d1fcd09ebce0659a4abb445e4f1c18571)
Signed-off-by: Bill Randle <william.c.randle@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/targetcontrol.py | 7 | ||||
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 11 |
2 files changed, 16 insertions, 2 deletions
diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py index 768c463076..3209ef0430 100644 --- a/meta/lib/oeqa/targetcontrol.py +++ b/meta/lib/oeqa/targetcontrol.py | |||
@@ -125,6 +125,12 @@ class QemuTarget(BaseTarget): | |||
125 | dump_target_cmds = d.getVar("testimage_dump_target", True) | 125 | dump_target_cmds = d.getVar("testimage_dump_target", True) |
126 | dump_host_cmds = d.getVar("testimage_dump_host", True) | 126 | dump_host_cmds = d.getVar("testimage_dump_host", True) |
127 | dump_dir = d.getVar("TESTIMAGE_DUMP_DIR", True) | 127 | dump_dir = d.getVar("TESTIMAGE_DUMP_DIR", True) |
128 | if d.getVar("QEMU_USE_KVM", False) is not None \ | ||
129 | and d.getVar("QEMU_USE_KVM", False) == "True" \ | ||
130 | and "x86" in d.getVar("MACHINE", True): | ||
131 | use_kvm = True | ||
132 | else: | ||
133 | use_kvm = False | ||
128 | 134 | ||
129 | # Log QemuRunner log output to a file | 135 | # Log QemuRunner log output to a file |
130 | import oe.path | 136 | import oe.path |
@@ -153,6 +159,7 @@ class QemuTarget(BaseTarget): | |||
153 | display = d.getVar("BB_ORIGENV", False).getVar("DISPLAY", True), | 159 | display = d.getVar("BB_ORIGENV", False).getVar("DISPLAY", True), |
154 | logfile = self.qemulog, | 160 | logfile = self.qemulog, |
155 | boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT", True)), | 161 | boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT", True)), |
162 | use_kvm = use_kvm, | ||
156 | dump_dir = dump_dir, | 163 | dump_dir = dump_dir, |
157 | dump_host_cmds = d.getVar("testimage_dump_host", True)) | 164 | dump_host_cmds = d.getVar("testimage_dump_host", True)) |
158 | 165 | ||
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index df73120254..69a5ae1eef 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
@@ -29,7 +29,7 @@ re_control_char = re.compile('[%s]' % re.escape("".join(control_chars))) | |||
29 | 29 | ||
30 | class QemuRunner: | 30 | class QemuRunner: |
31 | 31 | ||
32 | def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds): | 32 | def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds, use_kvm): |
33 | 33 | ||
34 | # Popen object for runqemu | 34 | # Popen object for runqemu |
35 | self.runqemu = None | 35 | self.runqemu = None |
@@ -49,6 +49,7 @@ class QemuRunner: | |||
49 | self.boottime = boottime | 49 | self.boottime = boottime |
50 | self.logged = False | 50 | self.logged = False |
51 | self.thread = None | 51 | self.thread = None |
52 | self.use_kvm = use_kvm | ||
52 | 53 | ||
53 | self.runqemutime = 60 | 54 | self.runqemutime = 60 |
54 | self.host_dumper = HostDumper(dump_host_cmds, dump_dir) | 55 | self.host_dumper = HostDumper(dump_host_cmds, dump_dir) |
@@ -133,7 +134,13 @@ class QemuRunner: | |||
133 | self.origchldhandler = signal.getsignal(signal.SIGCHLD) | 134 | self.origchldhandler = signal.getsignal(signal.SIGCHLD) |
134 | signal.signal(signal.SIGCHLD, self.handleSIGCHLD) | 135 | signal.signal(signal.SIGCHLD, self.handleSIGCHLD) |
135 | 136 | ||
136 | launch_cmd = 'runqemu tcpserial=%s %s %s %s' % (self.serverport, self.machine, self.rootfs, self.qemuparams) | 137 | launch_cmd = 'runqemu ' |
138 | if self.use_kvm: | ||
139 | logger.info('Using kvm for runqemu') | ||
140 | launch_cmd += 'kvm ' | ||
141 | else: | ||
142 | logger.info('Not using kvm for runqemu') | ||
143 | launch_cmd += 'tcpserial=%s %s %s %s' % (self.serverport, self.machine, self.rootfs, self.qemuparams) | ||
137 | # FIXME: We pass in stdin=subprocess.PIPE here to work around stty | 144 | # FIXME: We pass in stdin=subprocess.PIPE here to work around stty |
138 | # blocking at the end of the runqemu script when using this within | 145 | # blocking at the end of the runqemu script when using this within |
139 | # oe-selftest (this makes stty error out immediately). There ought | 146 | # oe-selftest (this makes stty error out immediately). There ought |