All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests] scripts: Speedup MAX_SMP check
@ 2018-09-03 10:58 Christoffer Dall
  2018-09-03 12:25 ` Andrew Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Christoffer Dall @ 2018-09-03 10:58 UTC (permalink / raw)
  To: kvm; +Cc: marc.zyngier, kvmarm

The current MAX_SMP check launches QEMU for every value of the SMP
parameter to check if the SMP parameter based on the native is higher
than the QEMU maximum supported configuration.

On something like a TX2, which has 224 threads, this takes a very long
time where the test script just sits there with no output.

Reduce the wait time by taking the log2 of MAX_SMP in each iteration of
the loop instead.

Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
---
 scripts/runtime.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index a31ae91..1e2c288 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -140,5 +140,5 @@ function run()
 # just remove it...
 while $RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP \
 		|& grep -qi 'exceeds max CPUs'; do
-	((--MAX_SMP))
+	MAX_SMP=$((MAX_SMP >> 1))
 done
-- 
2.7.4

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

* Re: [PATCH kvm-unit-tests] scripts: Speedup MAX_SMP check
  2018-09-03 10:58 [PATCH kvm-unit-tests] scripts: Speedup MAX_SMP check Christoffer Dall
@ 2018-09-03 12:25 ` Andrew Jones
  2018-09-03 13:13   ` Christoffer Dall
  2018-10-30 12:19   ` Christoffer Dall
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Jones @ 2018-09-03 12:25 UTC (permalink / raw)
  To: Christoffer Dall; +Cc: marc.zyngier, kvmarm, kvm

On Mon, Sep 03, 2018 at 12:58:45PM +0200, Christoffer Dall wrote:
> The current MAX_SMP check launches QEMU for every value of the SMP
> parameter to check if the SMP parameter based on the native is higher
> than the QEMU maximum supported configuration.
> 
> On something like a TX2, which has 224 threads, this takes a very long
> time where the test script just sits there with no output.
> 
> Reduce the wait time by taking the log2 of MAX_SMP in each iteration of
> the loop instead.
> 
> Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
> ---
>  scripts/runtime.bash | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> index a31ae91..1e2c288 100644
> --- a/scripts/runtime.bash
> +++ b/scripts/runtime.bash
> @@ -140,5 +140,5 @@ function run()
>  # just remove it...
>  while $RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP \
>  		|& grep -qi 'exceeds max CPUs'; do
> -	((--MAX_SMP))
> +	MAX_SMP=$((MAX_SMP >> 1))
>  done
> -- 
> 2.7.4
>

Reviewed-by: Andrew Jones <drjones@redhat.com>


Someday I should move this into arch-specific code and replace
it with something like:

if gic-v3
  MAX_SMP = MIN(_SC_NPROCESSORS_ONLN, 255)
else
  MAX_SMP = MIN(_SC_NPROCESSORS_ONLN, 8)

If other archs ever care about it (they currently don't), then
they can implement their own thing.

Thanks,
drew

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

* Re: [PATCH kvm-unit-tests] scripts: Speedup MAX_SMP check
  2018-09-03 12:25 ` Andrew Jones
@ 2018-09-03 13:13   ` Christoffer Dall
  2018-10-30 12:19   ` Christoffer Dall
  1 sibling, 0 replies; 5+ messages in thread
From: Christoffer Dall @ 2018-09-03 13:13 UTC (permalink / raw)
  To: Andrew Jones; +Cc: marc.zyngier, kvmarm, kvm

On Mon, Sep 03, 2018 at 02:25:50PM +0200, Andrew Jones wrote:
> On Mon, Sep 03, 2018 at 12:58:45PM +0200, Christoffer Dall wrote:
> > The current MAX_SMP check launches QEMU for every value of the SMP
> > parameter to check if the SMP parameter based on the native is higher
> > than the QEMU maximum supported configuration.
> > 
> > On something like a TX2, which has 224 threads, this takes a very long
> > time where the test script just sits there with no output.
> > 
> > Reduce the wait time by taking the log2 of MAX_SMP in each iteration of
> > the loop instead.
> > 
> > Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
> > ---
> >  scripts/runtime.bash | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> > index a31ae91..1e2c288 100644
> > --- a/scripts/runtime.bash
> > +++ b/scripts/runtime.bash
> > @@ -140,5 +140,5 @@ function run()
> >  # just remove it...
> >  while $RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP \
> >  		|& grep -qi 'exceeds max CPUs'; do
> > -	((--MAX_SMP))
> > +	MAX_SMP=$((MAX_SMP >> 1))
> >  done
> > -- 
> > 2.7.4
> >
> 
> Reviewed-by: Andrew Jones <drjones@redhat.com>
> 
> 
> Someday I should move this into arch-specific code and replace
> it with something like:
> 
> if gic-v3
>   MAX_SMP = MIN(_SC_NPROCESSORS_ONLN, 255)

Not quite, becasue QEMU can't seem to support more than 123 CPUs with it
current default set of parameters used by kvmtool at least.  But perhaps
that's being fixed with some changes to QEMU/KVM (I lost track).

Thanks for the reviews.

    Christoffer



> else
>   MAX_SMP = MIN(_SC_NPROCESSORS_ONLN, 8)
> 
> If other archs ever care about it (they currently don't), then
> they can implement their own thing.
> 

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

* Re: [PATCH kvm-unit-tests] scripts: Speedup MAX_SMP check
  2018-09-03 12:25 ` Andrew Jones
  2018-09-03 13:13   ` Christoffer Dall
@ 2018-10-30 12:19   ` Christoffer Dall
  2019-01-30 11:54     ` Paolo Bonzini
  1 sibling, 1 reply; 5+ messages in thread
From: Christoffer Dall @ 2018-10-30 12:19 UTC (permalink / raw)
  To: Andrew Jones; +Cc: marc.zyngier, Paolo Bonzini, kvmarm, kvm

On Mon, Sep 03, 2018 at 02:25:50PM +0200, Andrew Jones wrote:
> On Mon, Sep 03, 2018 at 12:58:45PM +0200, Christoffer Dall wrote:
> > The current MAX_SMP check launches QEMU for every value of the SMP
> > parameter to check if the SMP parameter based on the native is higher
> > than the QEMU maximum supported configuration.
> > 
> > On something like a TX2, which has 224 threads, this takes a very long
> > time where the test script just sits there with no output.
> > 
> > Reduce the wait time by taking the log2 of MAX_SMP in each iteration of
> > the loop instead.
> > 
> > Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
> > ---
> >  scripts/runtime.bash | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> > index a31ae91..1e2c288 100644
> > --- a/scripts/runtime.bash
> > +++ b/scripts/runtime.bash
> > @@ -140,5 +140,5 @@ function run()
> >  # just remove it...
> >  while $RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP \
> >  		|& grep -qi 'exceeds max CPUs'; do
> > -	((--MAX_SMP))
> > +	MAX_SMP=$((MAX_SMP >> 1))
> >  done
> > -- 
> > 2.7.4
> >
> 
> Reviewed-by: Andrew Jones <drjones@redhat.com>
> 
> 

Paolo, if you're ok with this patch, could you apply it?

(I failed to CC you the first time around, only had the kvm list.)

Thanks,

    Christoffer

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

* Re: [PATCH kvm-unit-tests] scripts: Speedup MAX_SMP check
  2018-10-30 12:19   ` Christoffer Dall
@ 2019-01-30 11:54     ` Paolo Bonzini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2019-01-30 11:54 UTC (permalink / raw)
  To: Christoffer Dall, Andrew Jones; +Cc: marc.zyngier, kvmarm, kvm

On 30/10/18 13:19, Christoffer Dall wrote:
> On Mon, Sep 03, 2018 at 02:25:50PM +0200, Andrew Jones wrote:
>> On Mon, Sep 03, 2018 at 12:58:45PM +0200, Christoffer Dall wrote:
>>> The current MAX_SMP check launches QEMU for every value of the SMP
>>> parameter to check if the SMP parameter based on the native is higher
>>> than the QEMU maximum supported configuration.
>>>
>>> On something like a TX2, which has 224 threads, this takes a very long
>>> time where the test script just sits there with no output.
>>>
>>> Reduce the wait time by taking the log2 of MAX_SMP in each iteration of
>>> the loop instead.
>>>
>>> Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
>>> ---
>>>  scripts/runtime.bash | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
>>> index a31ae91..1e2c288 100644
>>> --- a/scripts/runtime.bash
>>> +++ b/scripts/runtime.bash
>>> @@ -140,5 +140,5 @@ function run()
>>>  # just remove it...
>>>  while $RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP \
>>>  		|& grep -qi 'exceeds max CPUs'; do
>>> -	((--MAX_SMP))
>>> +	MAX_SMP=$((MAX_SMP >> 1))
>>>  done
>>> -- 
>>> 2.7.4
>>>
>>
>> Reviewed-by: Andrew Jones <drjones@redhat.com>
>>
>>
> 
> Paolo, if you're ok with this patch, could you apply it?
> 
> (I failed to CC you the first time around, only had the kvm list.)
> 
> Thanks,
> 
>     Christoffer
> 

Queued now.

Paolo

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

end of thread, other threads:[~2019-01-30 11:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-03 10:58 [PATCH kvm-unit-tests] scripts: Speedup MAX_SMP check Christoffer Dall
2018-09-03 12:25 ` Andrew Jones
2018-09-03 13:13   ` Christoffer Dall
2018-10-30 12:19   ` Christoffer Dall
2019-01-30 11:54     ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.