qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Emilio G. Cota" <cota@braap.org>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
	Thomas Huth <thuth@redhat.com>,
	Igor Mitsyanko <i.mitsyanko@gmail.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Alistair Francis <alistair.francis@xilinx.com>,
	qemu-arm@nongnu.org, Marcel Apfelbaum <marcel@redhat.com>,
	"Edgar E . Iglesias" <edgar.iglesias@gmail.com>
Subject: Re: [Qemu-devel] [PATCH] hw: add .min_cpus and .default_cpus fields to machine_class
Date: Fri, 10 Nov 2017 14:23:00 -0500	[thread overview]
Message-ID: <20171110192300.GC17844@flamenco> (raw)
In-Reply-To: <20171107201545.GA32606@localhost.localdomain>

On Tue, Nov 07, 2017 at 18:15:45 -0200, Eduardo Habkost wrote:
> On Fri, Nov 03, 2017 at 02:47:33PM -0400, Emilio G. Cota wrote:
> > @@ -4330,12 +4330,34 @@ int main(int argc, char **argv, char **envp)
> >      smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL));
> >  
> >      machine_class->max_cpus = machine_class->max_cpus ?: 1; /* Default to UP */
> > +    machine_class->min_cpus = machine_class->min_cpus ?: 1;
> > +    machine_class->default_cpus = machine_class->default_cpus ?: 1;
> > +
> > +    /* if -smp is not set, default to mc->default_cpus */
> > +    if (!smp_cpus) {
> > +        smp_cpus = machine_class->default_cpus;
> > +        max_cpus = machine_class->default_cpus;
> > +    }
> 
> I suggest doing this before smp_parse(), so any validation of
> smp_cpus inside smp_parse will apply to the value we're setting
> here (e.g. the replay_add_blocker() call in smp_parse() will
> work).
(snip)
> > +    if (max_cpus < machine_class->min_cpus) {
> 
> smp_parse() already ensures max_cpus >= smp_cpus, and you are
> already checking if smp_cpus < machine_class->min_cpus above.  Is
> it really possible to trigger this error message?
> 
> Except for that, the patch looks good to me.

Both very good points! I've modified the patch accordingly.

Thanks,

		Emilio

      reply	other threads:[~2017-11-10 19:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03 18:47 [Qemu-devel] [PATCH] hw: add .min_cpus and .default_cpus fields to machine_class Emilio G. Cota
2017-11-03 18:56 ` Emilio G. Cota
2017-11-03 20:02   ` Eduardo Habkost
2017-11-03 22:24     ` Emilio G. Cota
2017-11-06 14:10       ` Eduardo Habkost
2017-11-06 20:13         ` Emilio G. Cota
2017-11-07  0:43           ` Alistair Francis
2017-11-07 12:31             ` Eduardo Habkost
2017-11-08 21:29           ` Richard Henderson
2017-11-08 21:52             ` Eduardo Habkost
2017-11-08 22:08               ` Alistair Francis
2017-11-06 21:54         ` Emilio G. Cota
2017-11-06 22:32           ` Alistair Francis
2017-11-06 23:21             ` Emilio G. Cota
2017-11-06 23:33               ` Alistair Francis
2017-11-07  0:54                 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-11-07  1:19                   ` Alistair Francis
2017-11-07 16:15           ` Philippe Mathieu-Daudé
2017-11-07 19:32           ` [Qemu-devel] " Eduardo Habkost
2017-11-07 19:48             ` Alistair Francis
2017-11-07 19:54               ` Eduardo Habkost
2017-11-07 20:15 ` Eduardo Habkost
2017-11-10 19:23   ` Emilio G. Cota [this message]

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=20171110192300.GC17844@flamenco \
    --to=cota@braap.org \
    --cc=alistair.francis@xilinx.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=i.mitsyanko@gmail.com \
    --cc=marcel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@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 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).