On Thu, 18 Feb 2016 10:46:52 +0100
David Hildenbrand <d...@linux.vnet.ibm.com> wrote:

> > >  #if !defined(CONFIG_USER_ONLY)
> > > +void s390_hot_add_cpu(const int64_t id, Error **errp)
> > > +{    
> > to make it future-proof wrt migration it could be better to
> > enforce here that 'id' grows in +1 steps so user
> > won't be able create cpus with gaps.  
> 
> That should be already covered by:
> 
> if (id != next_cpu_id)
> ...
> 
> or am I missing something?
yep, that should do the job, but it might be better to introduce
next_cpu_id in this patch so it would be clear were it comes from
and how it's used while dropping it completely from previous one.

essentially next_cpu_id is (cpu_index + 1) so you don't even need
to create a global var, just get the last CPU and to math,
something like that:
include/qom/cpu.h:
+#define last_cpu QTAILQ_LAST(&cpus)
 
if (id != (last_cpu->cpu_index + 1)) { .... }

> 
> David
> 


Reply via email to