qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] vl.c: Check max_cpus limit instead of smp_cpus


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH] vl.c: Check max_cpus limit instead of smp_cpus
Date: Thu, 08 May 2014 00:20:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

Am 07.05.2014 23:48, schrieb Peter Maydell:
> On 7 May 2014 21:19, Eduardo Habkost <address@hidden> 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 <address@hidden>
>> ---
>>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]