qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 20/21] target-i386: implement machine->hot_add_c


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH 20/21] target-i386: implement machine->hot_add_cpu hook
Date: Wed, 24 Apr 2013 16:14:29 -0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Apr 24, 2013 at 07:31:44PM +0200, Andreas Färber wrote:
> > +static void do_cpu_hot_add(const int64_t id, Error **errp)
> > +{
> > +    int64_t apic_id = x86_cpu_apic_id_from_index(id);
> > +
> > +    if (cpu_exists(apic_id)) {
> > +        error_setg(errp, "Unable to add CPU: %" PRIi64
> > +                   ", it already exists", id);
> > +        return;
> > +    }
> > +
> > +    if (id >= max_cpus) {
> > +        error_setg(errp, "Unable to add CPU: %" PRIi64
> > +                   ", max allowed: %d", id, max_cpus - 1);
> 
> Why -1?

max_cpus-1 makes sense to me, as the message is about "maximum ID
allowed", not "maximum number of CPUs".

> 
> > +        return;
> > +    }
> > +
> > +    pc_new_cpu(machine_args->cpu_model, apic_id, errp);
> > +}
> > +
> >  void pc_cpus_init(const char *cpu_model)
> >  {
> >      int i;
> > @@ -928,7 +948,9 @@ void pc_cpus_init(const char *cpu_model)
> >  #else
> >          cpu_model = "qemu32";
> >  #endif
> > +        machine_args->cpu_model = cpu_model;
> 
> This could be avoided by changing argument to const char **. :)
> Caller will have access to QEMUMachineArgs*.

I would prefer to simply pass a pointer to QEMUMachineArgs to
pc_cpus_init(), instead of const char **.

-- 
Eduardo



reply via email to

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