From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zs9HV-00072S-Fm for qemu-devel@nongnu.org; Fri, 30 Oct 2015 08:59:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zs9HS-0000Ck-6V for qemu-devel@nongnu.org; Fri, 30 Oct 2015 08:59:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zs9HS-0000Be-0U for qemu-devel@nongnu.org; Fri, 30 Oct 2015 08:59:42 -0400 Date: Fri, 30 Oct 2015 12:59:36 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20151030125936.GL2417@work-vm> References: <1443515898-3594-1-git-send-email-dgilbert@redhat.com> <1443515898-3594-43-git-send-email-dgilbert@redhat.com> <87611r9s58.fsf@neno.neno> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87611r9s58.fsf@neno.neno> Subject: Re: [Qemu-devel] [PATCH v8 42/54] Postcopy: Use helpers to map pages during migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: aarcange@redhat.com, liang.z.li@intel.com, qemu-devel@nongnu.org, luis@cs.umu.se, bharata@linux.vnet.ibm.com, amit.shah@redhat.com, pbonzini@redhat.com * Juan Quintela (quintela@redhat.com) wrote: > "Dr. David Alan Gilbert (git)" wrote: > > From: "Dr. David Alan Gilbert" > > > > In postcopy, the destination guest is running at the same time > > as it's receiving pages; as we receive new pages we must put > > them into the guests address space atomically to avoid a running > > CPU accessing a partially written page. > > > > Use the helpers in postcopy-ram.c to map these pages. > > > > qemu_get_buffer_in_place is used to avoid a copy out of qemu_file > > in the case that postcopy is going to do a copy anyway. > > > > Signed-off-by: Dr. David Alan Gilbert > > --- > > migration/ram.c | 128 +++++++++++++++++++++++++++++++++++++++++++++----------- > > 1 file changed, 103 insertions(+), 25 deletions(-) > > > > diff --git a/migration/ram.c b/migration/ram.c > > index 487e838..6d9cfb5 100644 > > --- a/migration/ram.c > > +++ b/migration/ram.c > > @@ -1848,7 +1848,17 @@ static int load_xbzrle(QEMUFile *f, ram_addr_t addr, void *host) > > /* Must be called from within a rcu critical section. > > * Returns a pointer from within the RCU-protected ram_list. > > */ > > +/* > > + * Read a RAMBlock ID from the stream f, find the host address of the > > + * start of that block and add on 'offset' > > + * > > + * f: Stream to read from > > + * mis: MigrationIncomingState > > + * offset: Offset within the block > > + * flags: Page flags (mostly to see if it's a continuation of previous block) > > + */ > > static inline void *host_from_stream_offset(QEMUFile *f, > > + MigrationIncomingState *mis, > > ram_addr_t offset, > > int flags) > > { > > > Uh, oh, we change the prototype of host_from_stream_offset() but not the > function itself? Strange, no? Ah, that's a straggler from an old version of the patches that needed mis; gone. > Hahahaha, just change the if or the variable name. > > having a > > if (!cond) { > f1(); > } else { > f2(); > } > > makes no sense, better to have > > if (cond) { > f2() > } else { > f1() > } > no? Done. Dave > > > > The patch itself is ok. > > Thanks, Juan. -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK