public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH] testimage: allow using kvm when running qemux86* machines
@ 2016-08-16 23:08 Bill Randle
  2016-08-17 22:11 ` Aníbal Limón
  0 siblings, 1 reply; 2+ messages in thread
From: Bill Randle @ 2016-08-16 23:08 UTC (permalink / raw)
  To: openembedded-core

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]

Signed-off-by: Bill Randle <william.c.randle@intel.com>
---
 meta/lib/oeqa/targetcontrol.py    |  7 +++++++
 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 768c463..3209ef0 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -125,6 +125,12 @@ class QemuTarget(BaseTarget):
         dump_target_cmds = d.getVar("testimage_dump_target", True)
         dump_host_cmds = d.getVar("testimage_dump_host", True)
         dump_dir = d.getVar("TESTIMAGE_DUMP_DIR", True)
+        if d.getVar("QEMU_USE_KVM", False) is not None \
+           and d.getVar("QEMU_USE_KVM", False) == "True" \
+           and "x86" in d.getVar("MACHINE", True):
+            use_kvm = True
+        else:
+            use_kvm = False
 
         # Log QemuRunner log output to a file
         import oe.path
@@ -153,6 +159,7 @@ class QemuTarget(BaseTarget):
                             display = d.getVar("BB_ORIGENV", False).getVar("DISPLAY", True),
                             logfile = self.qemulog,
                             boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT", True)),
+                            use_kvm = use_kvm,
                             dump_dir = dump_dir,
                             dump_host_cmds = d.getVar("testimage_dump_host", True))
 
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index df73120..77e506f 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)))
 
 class QemuRunner:
 
-    def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds):
+    def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds, use_kvm):
 
         # Popen object for runqemu
         self.runqemu = None
@@ -49,6 +49,7 @@ class QemuRunner:
         self.boottime = boottime
         self.logged = False
         self.thread = None
+        self.use_kvm = use_kvm
 
         self.runqemutime = 60
         self.host_dumper = HostDumper(dump_host_cmds, dump_dir)
@@ -133,7 +134,13 @@ class QemuRunner:
         self.origchldhandler = signal.getsignal(signal.SIGCHLD)
         signal.signal(signal.SIGCHLD, self.handleSIGCHLD)
 
-        launch_cmd = 'runqemu tcpserial=%s %s %s %s' % (self.serverport, self.machine, self.rootfs, self.qemuparams)
+        launch_cmd = 'runqemu '
+        if self.use_kvm:
+            logger.info('Using kvm for runqemu')
+            launch_cmd += 'kvm '
+        else:
+            logger.info('Not using kvm for runqemu')
+        launch_cmd += 'tcpserial=%s %s %s %s' % (self.serverport, self.machine, self.rootfs, self.qemuparams)
         # FIXME: We pass in stdin=subprocess.PIPE here to work around stty
         # blocking at the end of the runqemu script when using this within
         # oe-selftest (this makes stty error out immediately). There ought
-- 
2.5.5



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] testimage: allow using kvm when running qemux86* machines
  2016-08-16 23:08 [PATCH] testimage: allow using kvm when running qemux86* machines Bill Randle
@ 2016-08-17 22:11 ` Aníbal Limón
  0 siblings, 0 replies; 2+ messages in thread
From: Aníbal Limón @ 2016-08-17 22:11 UTC (permalink / raw)
  To: Bill Randle, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 3614 bytes --]



On 08/16/2016 06:08 PM, Bill Randle wrote:
> 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]
> 
> Signed-off-by: Bill Randle <william.c.randle@intel.com>
Acked-by: Aníbal Limón <anibal.limon@linux.intel.com>
> ---
>  meta/lib/oeqa/targetcontrol.py    |  7 +++++++
>  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 768c463..3209ef0 100644
> --- a/meta/lib/oeqa/targetcontrol.py
> +++ b/meta/lib/oeqa/targetcontrol.py
> @@ -125,6 +125,12 @@ class QemuTarget(BaseTarget):
>          dump_target_cmds = d.getVar("testimage_dump_target", True)
>          dump_host_cmds = d.getVar("testimage_dump_host", True)
>          dump_dir = d.getVar("TESTIMAGE_DUMP_DIR", True)
> +        if d.getVar("QEMU_USE_KVM", False) is not None \
> +           and d.getVar("QEMU_USE_KVM", False) == "True" \
> +           and "x86" in d.getVar("MACHINE", True):
> +            use_kvm = True
> +        else:
> +            use_kvm = False
>  
>          # Log QemuRunner log output to a file
>          import oe.path
> @@ -153,6 +159,7 @@ class QemuTarget(BaseTarget):
>                              display = d.getVar("BB_ORIGENV", False).getVar("DISPLAY", True),
>                              logfile = self.qemulog,
>                              boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT", True)),
> +                            use_kvm = use_kvm,
>                              dump_dir = dump_dir,
>                              dump_host_cmds = d.getVar("testimage_dump_host", True))
>  
> diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
> index df73120..77e506f 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)))
>  
>  class QemuRunner:
>  
> -    def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds):
> +    def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds, use_kvm):
>  
>          # Popen object for runqemu
>          self.runqemu = None
> @@ -49,6 +49,7 @@ class QemuRunner:
>          self.boottime = boottime
>          self.logged = False
>          self.thread = None
> +        self.use_kvm = use_kvm
>  
>          self.runqemutime = 60
>          self.host_dumper = HostDumper(dump_host_cmds, dump_dir)
> @@ -133,7 +134,13 @@ class QemuRunner:
>          self.origchldhandler = signal.getsignal(signal.SIGCHLD)
>          signal.signal(signal.SIGCHLD, self.handleSIGCHLD)
>  
> -        launch_cmd = 'runqemu tcpserial=%s %s %s %s' % (self.serverport, self.machine, self.rootfs, self.qemuparams)
> +        launch_cmd = 'runqemu '
> +        if self.use_kvm:
> +            logger.info('Using kvm for runqemu')
> +            launch_cmd += 'kvm '
> +        else:
> +            logger.info('Not using kvm for runqemu')
> +        launch_cmd += 'tcpserial=%s %s %s %s' % (self.serverport, self.machine, self.rootfs, self.qemuparams)
>          # FIXME: We pass in stdin=subprocess.PIPE here to work around stty
>          # blocking at the end of the runqemu script when using this within
>          # oe-selftest (this makes stty error out immediately). There ought
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-17 22:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-16 23:08 [PATCH] testimage: allow using kvm when running qemux86* machines Bill Randle
2016-08-17 22:11 ` Aníbal Limón

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox