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: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] vl.c: Check max_cpus limit instead of smp_cpus
Date: Wed, 7 May 2014 22:48:37 +0100

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 and why do we not
just set max_cpus = machine->max_cpus ?

thanks
-- PMM



reply via email to

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