From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVHyG-0000z0-Bh for qemu-devel@nongnu.org; Tue, 10 Mar 2015 07:05:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVHyE-0004TM-Vv for qemu-devel@nongnu.org; Tue, 10 Mar 2015 07:05:08 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:59787) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVHyE-0004Nw-5K for qemu-devel@nongnu.org; Tue, 10 Mar 2015 07:05:06 -0400 Date: Tue, 10 Mar 2015 22:03:42 +1100 From: David Gibson Message-ID: <20150310110342.GJ11973@voom.redhat.com> References: <1424883128-9841-1-git-send-email-dgilbert@redhat.com> <1424883128-9841-15-git-send-email-dgilbert@redhat.com> <20150310061912.GG11973@voom.redhat.com> <20150310101213.GC2338@work-vm> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PpocKf6TCvdC9BKE" Content-Disposition: inline In-Reply-To: <20150310101213.GC2338@work-vm> Subject: Re: [Qemu-devel] [PATCH v5 14/45] Move loadvm_handlers into MigrationIncomingState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert" Cc: aarcange@redhat.com, yamahata@private.email.ne.jp, quintela@redhat.com, qemu-devel@nongnu.org, amit.shah@redhat.com, pbonzini@redhat.com, yanghy@cn.fujitsu.com --PpocKf6TCvdC9BKE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 10, 2015 at 10:12:14AM +0000, Dr. David Alan Gilbert wrote: > * David Gibson (david@gibson.dropbear.id.au) wrote: > > On Wed, Feb 25, 2015 at 04:51:37PM +0000, Dr. David Alan Gilbert (git) = wrote: > > > From: "Dr. David Alan Gilbert" > > >=20 > > > In postcopy we need the loadvm_handlers to be used in a couple > > > of different instances of the loadvm loop/routine, and thus > > > it can't be local any more. > > >=20 > > > Signed-off-by: Dr. David Alan Gilbert > > > --- > > > include/migration/migration.h | 5 +++++ > > > include/migration/vmstate.h | 2 ++ > > > include/qemu/typedefs.h | 1 + > > > migration/migration.c | 2 ++ > > > savevm.c | 28 ++++++++++++++++------------ > > > 5 files changed, 26 insertions(+), 12 deletions(-) > > >=20 > > > diff --git a/include/migration/migration.h b/include/migration/migrat= ion.h > > > index 3776e86..751caa0 100644 > > > --- a/include/migration/migration.h > > > +++ b/include/migration/migration.h > > > @@ -50,10 +50,15 @@ enum mig_rpcomm_cmd { > > > =20 > > > typedef struct MigrationState MigrationState; > > > =20 > > > +typedef QLIST_HEAD(, LoadStateEntry) LoadStateEntry_Head; > > > + > > > /* State for the incoming migration */ > > > struct MigrationIncomingState { > > > QEMUFile *file; > > > =20 > > > + /* See savevm.c */ > > > + LoadStateEntry_Head loadvm_handlers; > > > + > > > QEMUFile *return_path; > > > QemuMutex rp_mutex; /* We send replies from multiple thr= eads */ > > > }; > > > diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h > > > index c20f2d1..18da207 100644 > > > --- a/include/migration/vmstate.h > > > +++ b/include/migration/vmstate.h > > > @@ -797,6 +797,8 @@ extern const VMStateInfo vmstate_info_bitmap; > > > =20 > > > #define SELF_ANNOUNCE_ROUNDS 5 > > > =20 > > > +void loadvm_free_handlers(MigrationIncomingState *mis); > > > + > > > int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, > > > void *opaque, int version_id); > > > void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, > > > diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h > > > index 74dfad3..6fdcbcd 100644 > > > --- a/include/qemu/typedefs.h > > > +++ b/include/qemu/typedefs.h > > > @@ -31,6 +31,7 @@ typedef struct I2CBus I2CBus; > > > typedef struct I2SCodec I2SCodec; > > > typedef struct ISABus ISABus; > > > typedef struct ISADevice ISADevice; > > > +typedef struct LoadStateEntry LoadStateEntry; > > > typedef struct MACAddr MACAddr; > > > typedef struct MachineClass MachineClass; > > > typedef struct MachineState MachineState; > > > diff --git a/migration/migration.c b/migration/migration.c > > > index 34cd4fe..4592060 100644 > > > --- a/migration/migration.c > > > +++ b/migration/migration.c > > > @@ -78,6 +78,7 @@ MigrationIncomingState *migration_incoming_state_ne= w(QEMUFile* f) > > > { > > > mis_current =3D g_malloc0(sizeof(MigrationIncomingState)); > > > mis_current->file =3D f; > > > + QLIST_INIT(&mis_current->loadvm_handlers); > > > qemu_mutex_init(&mis_current->rp_mutex); > > > =20 > > > return mis_current; > > > @@ -85,6 +86,7 @@ MigrationIncomingState *migration_incoming_state_ne= w(QEMUFile* f) > > > =20 > > > void migration_incoming_state_destroy(void) > > > { > > > + loadvm_free_handlers(mis_current); > >=20 > > AFAICT this is the only caler of loadvm_free_handlers(), so why not > > just open-code it here? >=20 > I was keeping this handler list as owned by savevm.c; all it's allocation > and it's use are done in savevm.c, so it would seem odd to open code > freeing the list in a separate file. >=20 > > > g_free(mis_current); > > > mis_current =3D NULL; > > > } > > > diff --git a/savevm.c b/savevm.c > > > index 7084d07..f42713d 100644 > > > --- a/savevm.c > > > +++ b/savevm.c > > > @@ -1019,18 +1019,26 @@ static int loadvm_process_command(QEMUFile *f) > > > return 0; > > > } > > > =20 > > > -typedef struct LoadStateEntry { > > > +struct LoadStateEntry { > >=20 > > Why remove the typedef? >=20 > Because it is now typedef'd in typedefs.h, and older gcc (RHEL6) > object to two typedefs even if they're of the same thing. Ok, makes sense. Reviewed-by: David Gibson --=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 --PpocKf6TCvdC9BKE Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJU/s+OAAoJEGw4ysog2bOSzpMP/0EA+vdPabVSGSod+iIDHFZ+ ZsK6wXTO4F9XHOih9a59mos+/rHIgjd0yVIj3i0nK2sno9dKAvY7Gi5pBOtH2XgJ BEr5TmRvkdfW475/UbiFM4Zayf0absc0MfKTL1Get0aZNMeZHRiJ2QBZBJYowWJQ B0lWo5iJivtulHh5deM2BeQacZIhllQVcWSIiB/gkatAPQzKCAgJqjFlSfCu4/Mg 99lOycghuOz/kwksTQdDBdb99FCgIoeryfrRRGyZEGL2eAcajDFYsMNRZcoxCJLW MzJs/dZ/eaQDdo9bYtKOhNlu+wYU/UIU5zIsSH48miCaqHcCWU/fXJ44RwaCnF6n qEYDnlvXvM0zmHbpn4/+WBh2bDFQLGLhBM8QJSTUEb3kRj5Gxn9HOqYBwNJRoZny uaHp9Sd83fayMQk/+DEhvOALu+w0L9HKZqkY/r6cZfQR6MHOE46uwAUwjT453mdW lpm1wx9xec9sraPkqKywK1zwg8P0DNz4TuNASdfrxLZbIfpMCVX3hezx8kT5kj1f 4rm85TpN0McNN16p8obup7cqefy7vSVUTqo8fwQaijUaPnocYddPROCH4SnnjKK/ Yv2pVjDQrF3cSdk1OTgBT2U4RwYwTcoy/CdCvJm86mSvwtub+aE0CwZ2UwcywWYV HsVAZESq/HfZ7ENjKUhD =5x+Z -----END PGP SIGNATURE----- --PpocKf6TCvdC9BKE--