From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWSrC-00070D-RI for qemu-devel@nongnu.org; Thu, 18 Feb 2016 12:59:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWSr9-0001o2-KX for qemu-devel@nongnu.org; Thu, 18 Feb 2016 12:59:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59941) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWSr9-0001nY-FH for qemu-devel@nongnu.org; Thu, 18 Feb 2016 12:59:11 -0500 Date: Thu, 18 Feb 2016 18:59:06 +0100 From: Igor Mammedov Message-ID: <20160218185906.4410a5c3@nial.brq.redhat.com> In-Reply-To: <20160218104652.3cfd35ad@thinkpad-w530> References: <1455739955-28139-1-git-send-email-mjrosato@linux.vnet.ibm.com> <1455739955-28139-6-git-send-email-mjrosato@linux.vnet.ibm.com> <20160218104113.23376c1f@nial.brq.redhat.com> <20160218104652.3cfd35ad@thinkpad-w530> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 5/5] s390x/cpu: Allow hotplug of CPUs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Hildenbrand Cc: Matthew Rosato , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, bharata@linux.vnet.ibm.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com, afaerber@suse.de, rth@twiddle.net On Thu, 18 Feb 2016 10:46:52 +0100 David Hildenbrand 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 >