From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKi9P-0006CI-46 for qemu-devel@nongnu.org; Wed, 06 Jul 2016 04:25:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKi9K-0005mV-1d for qemu-devel@nongnu.org; Wed, 06 Jul 2016 04:25:42 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:58265 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKi9J-0005mR-SS for qemu-devel@nongnu.org; Wed, 06 Jul 2016 04:25:37 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u668O0eE014273 for ; Wed, 6 Jul 2016 04:25:37 -0400 Received: from e28smtp01.in.ibm.com (e28smtp01.in.ibm.com [125.16.236.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 240nehwxb5-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 06 Jul 2016 04:25:36 -0400 Received: from localhost by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 6 Jul 2016 13:55:33 +0530 Date: Wed, 6 Jul 2016 13:55:25 +0530 From: Bharata B Rao Reply-To: bharata@linux.vnet.ibm.com References: <1467693772-7391-1-git-send-email-bharata@linux.vnet.ibm.com> <1467693772-7391-3-git-send-email-bharata@linux.vnet.ibm.com> <20160705091551.544e1ae1@172-15-179-184.lightspeed.austtx.sbcglobal.net> <20160705124322.GC25522@in.ibm.com> <20160706072544.4c379034@172-15-179-184.lightspeed.austtx.sbcglobal.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160706072544.4c379034@172-15-179-184.lightspeed.austtx.sbcglobal.net> Message-Id: <20160706075546.GD25522@in.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v0 2/5] cpu: Optionally use arch_id instead of cpu_index in cpu vmstate_register() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, groug@kaod.org, nikunj@linux.vnet.ibm.com, pbonzini@redhat.com On Wed, Jul 06, 2016 at 07:25:44AM +0200, Igor Mammedov wrote: > On Tue, 5 Jul 2016 18:13:22 +0530 > Bharata B Rao wrote: > > > On Tue, Jul 05, 2016 at 09:15:51AM +0200, Igor Mammedov wrote: > > > On Tue, 5 Jul 2016 10:12:49 +0530 > > > Bharata B Rao wrote: > > > > > > > Introduce CPUState.prefer_arch_id_over_cpu_index and > > > > MachineClass.prefer_arch_id_over_cpu_index that allow target > > > > machines to optionally switch to using arch_id instead of > > > > cpu_index as instance_id in vmstate_register(). This will help > > > > allow successful migration in cases where holes are introduced in > > > > cpu_index range after CPU hot removals. > > > > > > > > Whether to use arch_id or cpu_index is based on machine type > > > > version and hence added > > > > MachineClass.prefer_arch_id_over_cpu_index. However the > > > > enforcement is via and during CPU creation and hence added > > > > CPUState.prefer_arch_id_over_cpu_index. So it becomes a two step > > > > process for the target to enable the use of arch_id: > > > > > > > > 1. Set MachineClass.prefer_arch_id_over_cpu_index. > > > > 2. Ensure CPUState.prefer_arch_id_over_cpu_index is set for all > > > > CPUs based on 1. above. > > > > > > > > Suggested-by: Igor Mammedov > > > > Signed-off-by: Bharata B Rao > > > > --- > > > > exec.c | 10 ++++++++-- > > > > include/hw/boards.h | 1 + > > > > include/qom/cpu.h | 4 ++++ > > > > 3 files changed, 13 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/exec.c b/exec.c > > > > index 8ce8e90..7cc1d06 100644 > > > > --- a/exec.c > > > > +++ b/exec.c > > > > @@ -616,15 +616,21 @@ static void cpu_release_index(CPUState *cpu) > > > > bitmap_clear(cpu_index_map, cpu->cpu_index, 1); > > > > } > > > > > > > > +/* > > > > + * TODO: cpu_index and instance_id are of type int > > > > while .get_arch_id()is > > > > + * of type int64_t. What is the consequence of changing > > > > instance_id to int64_t ? > > > > + */ > > > ARM potentially could have get_arch_id() == MPIDR (return 64bit int) > > > that would get truncated in this case. > > > > > > I wonder if we could add "int CPUState::migration_id" and let > > > machine code set it to what it uses for stable cpu id and then > > > cpu_realize could call vmstate_register with it. > > > > Hmm how would that help ? instance_id argument to vmstate_register() > > is being treated as 32 bit integer as pointed by Greg earlier. > > > > If we want to use 64 bit arch_id/migration_id as instance_id arg in > > vmstate_register, shouldn't we be changing instance_id to 64 bit ? > Trying to extend instance_id from 32bit to 64bit, looks hard to me as > it's on wire format so it's not possible to change without breaking > compatibility. > > That's why dedicated migration_id should also be 32bit integer to keep > it compatible with vmstate_foo() magic. On x86 and ARM that id will be > in range [0..maxcpus), it's stable index in possible_cpus array. Since we were planning to use arch_id (aka device tree id) as the stable index for CPU cores on PowerPC, we would have to use int64_t arch_id itself as int instance_id I suppose. The range could be [0...maxcpus*8] for us. Regards, Bharata.