diff mbox series

[v4,15/40] tests/vm: allow us to take advantage of MTTCG

Message ID 20200701135652.1366-16-alex.bennee@linaro.org
State Superseded
Headers show
Series testing/next (vm, gitlab, fixes) | expand

Commit Message

Alex Bennée July 1, 2020, 1:56 p.m. UTC
We currently limit TCG guests to -smp 1 but now we have added some
aarch64 guests we can do better when running on x86_64 hardware.
Raise the limit for TCG guests when it is safe to do so.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Reviewed-by: Robert Foley <robert.foley@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


---
v4
  - only attempt compute a bigger default_jobs is
    multiprocessing.cpu_count > 1
---
 tests/vm/basevm.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

-- 
2.20.1
diff mbox series

Patch

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 890bbc5549a..21f46d1957d 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -551,8 +551,15 @@  def parse_config(config, args):
 def parse_args(vmcls):
 
     def get_default_jobs():
-        if kvm_available(vmcls.arch):
-            return multiprocessing.cpu_count() // 2
+        if multiprocessing.cpu_count() > 1:
+            if kvm_available(vmcls.arch):
+                return multiprocessing.cpu_count() // 2
+            elif os.uname().machine == "x86_64" and \
+                 vmcls.arch in ["aarch64", "x86_64", "i386"]:
+                # MTTCG is available on these arches and we can allow
+                # more cores. but only up to a reasonable limit. User
+                # can always override these limits with --jobs.
+                return min(multiprocessing.cpu_count() // 2, 8)
         else:
             return 1