[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 5/5] s390x/cpu: Allow hotplug of CPUs
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [PATCH v4 5/5] s390x/cpu: Allow hotplug of CPUs |
Date: |
Thu, 18 Feb 2016 18:59:06 +0100 |
On Thu, 18 Feb 2016 10:46:52 +0100
David Hildenbrand <address@hidden> 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
>
- [Qemu-devel] [PATCH v4 2/5] s390x/cpu: Set initial CPU state in common routine, (continued)