qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: "Alex Bennée" <alex.bennee@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/5] tests/vm: Do not abuse parallelism when KVM is not available
Date: Tue, 17 Jul 2018 21:37:57 +0800	[thread overview]
Message-ID: <20180717133757.GA8120@lemon.usersys.redhat.com> (raw)
In-Reply-To: <20180717024827.27897-4-f4bug@amsat.org>

On Mon, 07/16 23:48, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  tests/vm/basevm.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> index 1f4ad04c32..715e433142 100755
> --- a/tests/vm/basevm.py
> +++ b/tests/vm/basevm.py
> @@ -233,7 +233,7 @@ def main(vmcls):
>              return 1
>          logging.basicConfig(level=(logging.DEBUG if args.debug
>                                     else logging.WARN))
> -        vm = vmcls(debug=args.debug, vcpus=args.jobs)
> +        vm = vmcls(debug=args.debug, vcpus=args.jobs if kvm_available() else 0)
>          if args.build_image:
>              if os.path.exists(args.image) and not args.force:
>                  sys.stderr.writelines(["Image file exists: %s\n" % args.image,
> @@ -244,7 +244,7 @@ def main(vmcls):
>              vm.add_source_dir(args.build_qemu)
>              cmd = [vm.BUILD_SCRIPT.format(
>                     configure_opts = " ".join(argv),
> -                   jobs=args.jobs)]
> +                   jobs=args.jobs if kvm_available() else 1)]
>          else:
>              cmd = argv
>          vm.boot(args.image + ",snapshot=on")
> -- 
> 2.18.0
> 

Could you instead change this line

    parser.add_option("--jobs", type=int, default=multiprocessing.cpu_count() / 2,
                      help="number of virtual CPUs")

to use kvm_available()? With another helper function to contain the line width,
probably:

    ..., default=get_default_jobs(), help=...

and

    def get_default_jobs():
        if kvm_available():
            return ...
        else:
            return ...

Fam

  reply	other threads:[~2018-07-17 13:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-17  2:48 [Qemu-devel] [PATCH 0/5] tests/vm: Improvements when KVM is not available Philippe Mathieu-Daudé
2018-07-17  2:48 ` [Qemu-devel] [PATCH 1/5] tests/vm: Extract the kvm_available() handy function Philippe Mathieu-Daudé
2018-07-17  2:48 ` [Qemu-devel] [PATCH 2/5] tests/vm: Use 'host' cpu when KVM is available, else default to 'max' Philippe Mathieu-Daudé
2018-07-17  2:48 ` [Qemu-devel] [PATCH 3/5] tests/vm: Do not abuse parallelism when KVM is not available Philippe Mathieu-Daudé
2018-07-17 13:37   ` Fam Zheng [this message]
2018-07-17  2:48 ` [Qemu-devel] [RFC PATCH 4/5] tests/vm: Display remaining seconds to wait for a VM to start Philippe Mathieu-Daudé
2018-07-17  2:48 ` [Qemu-devel] [RFC PATCH 5/5] tests/vm: When using TCG, wait longer " Philippe Mathieu-Daudé

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=20180717133757.GA8120@lemon.usersys.redhat.com \
    --to=famz@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=f4bug@amsat.org \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).