From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKxXr-0005ZG-0J for qemu-devel@nongnu.org; Wed, 06 Jul 2016 20:52:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKxXo-0004jG-Kd for qemu-devel@nongnu.org; Wed, 06 Jul 2016 20:51:57 -0400 Date: Thu, 7 Jul 2016 10:53:36 +1000 From: David Gibson Message-ID: <20160707005336.GC14675@voom.fritz.box> References: <1467795561-1007-1-git-send-email-bharata@linux.vnet.ibm.com> <1467795561-1007-3-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ALfTUftag+2gvp1h" Content-Disposition: inline In-Reply-To: <1467795561-1007-3-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v1 2/5] cpu: Introduce CPUState::migration_id List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, imammedo@redhat.com, groug@kaod.org, nikunj@linux.vnet.ibm.com, pbonzini@redhat.com --ALfTUftag+2gvp1h Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 06, 2016 at 02:29:18PM +0530, Bharata B Rao wrote: > Add CPUState::migration_id and use that as instance_id in > vmstate_register() call. >=20 > Introduce use-migration-id property that allows target machines to > optionally switch to using migration_id instead of cpu_index. > This will help allow successful migration in cases where holes are > introduced in cpu_index range after CPU hot removals. >=20 > The default implementation of CPUClass:get_migration_id() continues > to return cpu_index. >=20 > Suggested-by: Igor Mammedov > Signed-off-by: Bharata B Rao > --- > exec.c | 5 +++-- > include/qom/cpu.h | 6 ++++++ > qom/cpu.c | 21 +++++++++++++++++++++ > 3 files changed, 30 insertions(+), 2 deletions(-) >=20 > diff --git a/exec.c b/exec.c > index fb73910..a8afeda 100644 > --- a/exec.c > +++ b/exec.c > @@ -619,12 +619,13 @@ static void cpu_release_index(CPUState *cpu) > void cpu_vmstate_register(CPUState *cpu) > { > CPUClass *cc =3D CPU_GET_CLASS(cpu); > + int instance_id =3D cc->get_migration_id(cpu); > =20 > if (qdev_get_vmsd(DEVICE(cpu)) =3D=3D NULL) { > - vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu); > + vmstate_register(NULL, instance_id, &vmstate_cpu_common, cpu); > } > if (cc->vmsd !=3D NULL) { > - vmstate_register(NULL, cpu->cpu_index, cc->vmsd, cpu); > + vmstate_register(NULL, instance_id, cc->vmsd, cpu); > } > } > =20 > diff --git a/include/qom/cpu.h b/include/qom/cpu.h > index 29ccf5c..6d00143 100644 > --- a/include/qom/cpu.h > +++ b/include/qom/cpu.h > @@ -187,6 +187,7 @@ typedef struct CPUClass { > bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request); > =20 > void (*disas_set_info)(CPUState *cpu, disassemble_info *info); > + int (*get_migration_id)(CPUState *cpu); > } CPUClass; > =20 > #ifdef HOST_WORDS_BIGENDIAN > @@ -273,6 +274,9 @@ struct qemu_work_item { > * @kvm_fd: vCPU file descriptor for KVM. > * @work_mutex: Lock to prevent multiple access to queued_work_*. > * @queued_work_first: First asynchronous work pending. > + * @migration_id: Use as instance_id argument in cpu vmstate_register ca= lls > + * @use_migration_id: Set to enforce the use of CPUClass.get_migration_i= d() > + * over cpu_index during vmstate registration. I don't really understand the purpose of the use-migration-id bool. Can't you just leave the migration-id as cpu_index by default if you don't want a different migration id. AFAICT this flag is never tested. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --ALfTUftag+2gvp1h Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXfagQAAoJEGw4ysog2bOSomoQAIegsbw0/Kq0AYCb1hwPXcoI CIHeMQXV4bq3m7n8RIeYHeglR4IvpFkwNbNsNzz2qv9ADIcbUJbdPKUKrulXizLV iYlEWyyafeSnkmT09DuELFUCVyLB9gjR1OQ7IzI70V2kxTt733xcBwFot6nxGy+b F6NvaSbsip5eC5Jk8zAxBCJrflTkBLXFypkwGL29ODkB3Ex+C66/t93Ko/z1JzhV gnOBhvUAYHY7yF7wZYlD6pZYhtr90PrgaVKHBqcMPxnc3UdTNLu+MR8gRDHkVn/Z IWY6ax7XYAoP6gwleLeJGgGkoMBj1kZhdVZ0zfMzCrxpeTdnFiPEja1VR/9et1kP m85C0YOYMX2fCSilJLC22h8j0qA3i2ljYG5JGsIXbROhLOp55HgTjFG+wf+ZmmXZ 3ENc+bM11ZGxh75AJ4MK51vQeWKCCMdvxy1HXZbN5nvTY0H/Q2NC/YGdhqtb3el1 YMc/nJ0zImHcOEPdeEiDDJvmyIBpnXgoEG+uY6MZiEL4vPujZmt10NACUrQofOu3 HZx1YR7FAeiqaV+0su/ny1UB81P/3r6dOSTrEOQhyg9A3oD/UwaaRWLCKuFIcGTz 8bP9ByYg5JQsO2X0VHIa//Xdrus83CrbsSBuc1H4MaqXSewlV5yOsQR2zZuQdBHa 6Wcbw43d8g0KNhVPuxvP =FXqX -----END PGP SIGNATURE----- --ALfTUftag+2gvp1h--