All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Andrew Jones <drjones@redhat.com>, kvm@vger.kernel.org
Cc: rkrcmar@redhat.com
Subject: Re: [kvm-unit-tests PATCH 6/6] runtime: make the MAX_SMP loop a function
Date: Tue, 26 Jan 2016 12:08:54 +0100	[thread overview]
Message-ID: <56A753C6.1020604@redhat.com> (raw)
In-Reply-To: <1453474709-10679-7-git-send-email-drjones@redhat.com>



On 22/01/2016 15:58, Andrew Jones wrote:
> We can now source scripts/runtime.bash multiple times without
> always running the MAX_SMP loop. runtime.bash is now ready to
> be sourced by arch run scripts (when not running in standalone
> mode). Patches coming soon will add a couple of arch-neutral
> functions to the arch run scripts.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  run_tests.sh            |  2 ++
>  scripts/mkstandalone.sh |  1 +
>  scripts/runtime.bash    | 12 +++++++++---
>  3 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/run_tests.sh b/run_tests.sh
> index 558b8e7431d8e..c0c5a72b1ceee 100755
> --- a/run_tests.sh
> +++ b/run_tests.sh
> @@ -28,6 +28,8 @@ EOF
>  RUNTIME_arch_run="./$TEST_DIR/run"
>  source scripts/runtime.bash
>  
> +probe_max_smp
> +
>  while getopts "g:hv" opt; do
>      case $opt in
>          g)
> diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
> index b0f1e7c098afb..c31a5f10519a1 100755
> --- a/scripts/mkstandalone.sh
> +++ b/scripts/mkstandalone.sh
> @@ -60,6 +60,7 @@ generate_test ()
>  
>  	cat scripts/runtime.bash
>  
> +	echo probe_max_smp
>  	echo "run ${args[@]}"
>  }
>  
> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> index 63d1b9653007b..dd700f24cffa3 100644
> --- a/scripts/runtime.bash
> +++ b/scripts/runtime.bash
> @@ -1,5 +1,9 @@
>  : "${RUNTIME_arch_run?}"
>  
> +if [ -z "$MAX_SMP" ]; then
> +    MAX_SMP=$(getconf _NPROCESSORS_CONF)
> +fi
> +
>  qemu=${QEMU:-qemu-system-$ARCH}
>  
>  function run()
> @@ -57,7 +61,6 @@ function run()
>      return $ret
>  }
>  
> -MAX_SMP=$(getconf _NPROCESSORS_CONF)
>  #
>  # Probe for MAX_SMP, in case it's less than the number of host cpus.
>  #
> @@ -67,7 +70,10 @@ MAX_SMP=$(getconf _NPROCESSORS_CONF)
>  # "arm/arm64: KVM: Remove 'config KVM_ARM_MAX_VCPUS'". So, at some
>  # point when maintaining the while loop gets too tiresome, we can
>  # just remove it...
> -while $RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP \
> +function probe_max_smp()
> +{
> +    while $RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP \
>  		|& grep -qi 'exceeds max CPUs'; do
>  	((--MAX_SMP))
> -done
> +    done
> +}
> 

This kinda goes against the idea of removing duplication between
runtests and mkstandalone...

I wonder if you should instead remove the

    : "${RUNTIME_arch_run?}"

and conditionalize the MAX_SMP test on the existence of
RUNTIME_arch_run.  Is it set during execution of the arch run scripts?

Paolo

  reply	other threads:[~2016-01-26 11:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22 14:58 [kvm-unit-tests PATCH 0/6] run_tests fixes and new functionality prep Andrew Jones
2016-01-22 14:58 ` [kvm-unit-tests PATCH 1/6] run_tests.sh: a few rewrite fixups Andrew Jones
2016-01-22 14:58 ` [kvm-unit-tests PATCH 2/6] mkstandalone: fix generation for arm Andrew Jones
2016-01-26 11:01   ` Paolo Bonzini
2016-01-26 12:21     ` Andrew Jones
2016-01-22 14:58 ` [kvm-unit-tests PATCH 3/6] arch-run: DRYRUN is no longer needed, kill it Andrew Jones
2016-01-22 14:58 ` [kvm-unit-tests PATCH 4/6] arm/run: allow tests to run in AArch32 mode Andrew Jones
2016-01-22 14:58 ` [kvm-unit-tests PATCH 5/6] runtime: move getopts to run_tests.sh Andrew Jones
2016-01-26 11:06   ` Paolo Bonzini
2016-01-26 12:24     ` Andrew Jones
2016-01-22 14:58 ` [kvm-unit-tests PATCH 6/6] runtime: make the MAX_SMP loop a function Andrew Jones
2016-01-26 11:08   ` Paolo Bonzini [this message]
2016-01-26 12:28     ` Andrew Jones
2016-01-26 12:38       ` Paolo Bonzini
2016-01-22 15:29 ` [kvm-unit-tests PATCH 0/6] run_tests fixes and new functionality prep Radim Krčmář
2016-01-26 11:09   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56A753C6.1020604@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.