From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvkJl-0000e3-L8 for qemu-devel@nongnu.org; Mon, 09 Nov 2015 06:08:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZvkJi-00040c-AT for qemu-devel@nongnu.org; Mon, 09 Nov 2015 06:08:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41142) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvkJi-00040Y-53 for qemu-devel@nongnu.org; Mon, 09 Nov 2015 06:08:54 -0500 From: Juan Quintela In-Reply-To: <1446747083-18205-36-git-send-email-dgilbert@redhat.com> (David Alan Gilbert's message of "Thu, 5 Nov 2015 18:11:02 +0000") References: <1446747083-18205-1-git-send-email-dgilbert@redhat.com> <1446747083-18205-36-git-send-email-dgilbert@redhat.com> Date: Mon, 09 Nov 2015 12:08:50 +0100 Message-ID: <87mvunctvh.fsf@emacs.mitica> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v9 35/56] Postcopy: Calculate discard Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert (git)" Cc: aarcange@redhat.com, yamahata@private.email.ne.jp, 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, david@gibson.dropbear.id.au "Dr. David Alan Gilbert (git)" wrote: > From: "Dr. David Alan Gilbert" > > Where postcopy is preceeded by a period of precopy, the destination will > have received pages that may have been dirtied on the source after the > page was sent. The destination must throw these pages away before > starting it's CPUs. > > Calculate list of sent & dirty pages > Provide helpers on the destination side to discard these. > > Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela But please, send a fix for: > return ret; > } > > +/** > + * postcopy_ram_discard_range: Discard a range of memory. > + * We can assume that if we've been called postcopy_ram_hosttest returned true. > + * > + * @mis: Current incoming migration state. > + * @start, @length: range of memory to discard. > + * > + * returns: 0 on success. > + */ > +int postcopy_ram_discard_range(MigrationIncomingState *mis, uint8_t *start, > + size_t length) > +{ > + trace_postcopy_ram_discard_range(start, length); > + if (madvise(start, length, MADV_DONTNEED)) { qemu_madvise(start, length, QEMU_MADV_DONTNEED)