diff mbox series

[v1,12/18] tests/vm: allow us to take advantage of MTTCG

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

Commit Message

Alex Bennée June 22, 2020, 2:31 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>

---
 tests/vm/basevm.py | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
2.20.1

Comments

Robert Foley June 22, 2020, 2:52 p.m. UTC | #1
Reviewed-by: Robert Foley <robert.foley@linaro.org>


On Mon, 22 Jun 2020 at 10:38, Alex Bennée <alex.bennee@linaro.org> wrote:
>

> 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>

> ---

>  tests/vm/basevm.py | 6 ++++++

>  1 file changed, 6 insertions(+)

>

> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py

> index 93859362606..dd96a6d4af6 100644

> --- a/tests/vm/basevm.py

> +++ b/tests/vm/basevm.py

> @@ -553,6 +553,12 @@ def parse_args(vmcls):

>      def get_default_jobs():

>          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

>

> --

> 2.20.1

>

>
Richard Henderson June 26, 2020, 6:30 p.m. UTC | #2
On 6/22/20 7:31 AM, Alex Bennée wrote:
>          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:


And if multiprocessing.cpu_count() == 1?
Seems like we should add max(count, 1) as well.


r~
Alex Bennée June 26, 2020, 7:37 p.m. UTC | #3
Richard Henderson <richard.henderson@linaro.org> writes:

> On 6/22/20 7:31 AM, Alex Bennée wrote:

>>          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:

>

> And if multiprocessing.cpu_count() == 1?

> Seems like we should add max(count, 1) as well.


Or maybe?

   min(math.ceil(multiprocessing.cpu_count() / 2), 8)
>

>

> r~



-- 
Alex Bennée
Alex Bennée June 29, 2020, 2:41 p.m. UTC | #4
Richard Henderson <richard.henderson@linaro.org> writes:

> On 6/22/20 7:31 AM, Alex Bennée wrote:

>>          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:

>

> And if multiprocessing.cpu_count() == 1?

> Seems like we should add max(count, 1) as well.


As it also affects KVM:

    def get_default_jobs():
        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


>

>

> r~



-- 
Alex Bennée
Philippe Mathieu-Daudé June 29, 2020, 2:45 p.m. UTC | #5
On 6/29/20 4:41 PM, Alex Bennée wrote:
> 

> Richard Henderson <richard.henderson@linaro.org> writes:

> 

>> On 6/22/20 7:31 AM, Alex Bennée wrote:

>>>          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:

>>

>> And if multiprocessing.cpu_count() == 1?

>> Seems like we should add max(count, 1) as well.

> 

> As it also affects KVM:

> 

>     def get_default_jobs():

>         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


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


> 

> 

>>

>>

>> r~

> 

>
diff mbox series

Patch

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 93859362606..dd96a6d4af6 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -553,6 +553,12 @@  def parse_args(vmcls):
     def get_default_jobs():
         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