From: "Andreas Färber" <afaerber@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>,
Eduardo Habkost <ehabkost@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Anthony Liguori <aliguori@amazon.com>
Subject: Re: [Qemu-devel] [PATCH] vl.c: Check max_cpus limit instead of smp_cpus
Date: Thu, 08 May 2014 00:20:34 +0200 [thread overview]
Message-ID: <536AB1B2.4030709@suse.de> (raw)
In-Reply-To: <CAFEAcA-2rQswUTAFWg-mZLnmW8HEbSUGTF+g6dv3+Fsmay-Oxw@mail.gmail.com>
Am 07.05.2014 23:48, schrieb Peter Maydell:
> On 7 May 2014 21:19, Eduardo Habkost <ehabkost@redhat.com> wrote:
>> If a given machine have max_cpus set, not just smp_cpus needs to be
>> limited, but the total number of CPUs (considering CPU hotplug) for the
>> machine.
>>
>> As smp_parse() already ensures smp_cpus <= max_cpus, we just need to
>> check if max_cpus exceeds the limit.
>>
>> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
>> ---
>> vl.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/vl.c b/vl.c
>> index 236f95e..e317cc9 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -4039,9 +4039,9 @@ int main(int argc, char **argv, char **envp)
>> smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL));
>>
>> machine->max_cpus = machine->max_cpus ?: 1; /* Default to UP */
>> - if (smp_cpus > machine->max_cpus) {
>> - fprintf(stderr, "Number of SMP cpus requested (%d), exceeds max cpus "
>> - "supported by machine `%s' (%d)\n", smp_cpus, machine->name,
>> + if (max_cpus > machine->max_cpus) {
>> + fprintf(stderr, "Total number of CPUs (%d), exceeds maximum "
>> + "supported by machine `%s' (%d)\n", max_cpus, machine->name,
>> machine->max_cpus);
>> exit(1);
>
>
> This is confusing. What is max_cpus
Specified via -smp, defaults to actual CPUs.
> and why do we not
> just set max_cpus = machine->max_cpus ?
For the PC, machine->max_cpus specifies the technical (APIC/ACPI/...)
upper limit, whereas -smp limits it to saner values.
If you think KVM, then many machines today will have less than the
maximum number of CPUs and you may want to run multiple VMs and you may
not want their vCPUs competing too much for existing CPUs, so a limit
makes sense.
An interesting question for the 2.x era would be whether we may want to
change the default from no hot-add to machine maximum - does recent
libvirt specify max_cpus by default?
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2014-05-07 22:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-07 20:19 [Qemu-devel] [PATCH] vl.c: Check max_cpus limit instead of smp_cpus Eduardo Habkost
2014-05-07 21:48 ` Peter Maydell
2014-05-07 22:20 ` Andreas Färber [this message]
2014-05-08 8:26 ` Peter Maydell
2014-05-08 15:00 ` Eduardo Habkost
2014-05-08 15:07 ` Peter Maydell
2014-05-08 18:46 ` Eduardo Habkost
2014-05-08 15:10 ` Andreas Färber
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=536AB1B2.4030709@suse.de \
--to=afaerber@suse.de \
--cc=aliguori@amazon.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=mtosatti@redhat.com \
--cc=peter.maydell@linaro.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).