From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrQVf-0007G7-Di for qemu-devel@nongnu.org; Wed, 28 Oct 2015 09:11:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrQVZ-0002ls-HD for qemu-devel@nongnu.org; Wed, 28 Oct 2015 09:11:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35571) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrQVZ-0002la-Bt for qemu-devel@nongnu.org; Wed, 28 Oct 2015 09:11:17 -0400 Date: Wed, 28 Oct 2015 13:11:11 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20151028131110.GA3563@work-vm> References: <1443515898-3594-1-git-send-email-dgilbert@redhat.com> <1443515898-3594-42-git-send-email-dgilbert@redhat.com> <87d1vz9tit.fsf@neno.neno> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87d1vz9tit.fsf@neno.neno> Subject: Re: [Qemu-devel] [PATCH v8 41/54] postcopy_ram.c: place_page and helpers 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" > > > > postcopy_place_page (etc) provide a way for postcopy to place a page > > into guests memory atomically (using the copy ioctl on the ufd). > > > > Signed-off-by: Dr. David Alan Gilbert > > Reviewed-by: Amit Shah > > > Reviewed-by: Juan Quintela > > > +int postcopy_place_page_zero(MigrationIncomingState *mis, void *host) > > +{ > > + struct uffdio_zeropage zero_struct; > > + > > + zero_struct.range.start = (uint64_t)(uintptr_t)host; > > + zero_struct.range.len = getpagesize(); > > + zero_struct.mode = 0; > > + > > + if (ioctl(mis->userfault_fd, UFFDIO_ZEROPAGE, &zero_struct)) { > > + int e = errno; > > + error_report("%s: %s zero host: %p", > > + __func__, strerror(e), host); > > + > > + return -e; > > + } > > + > > + trace_postcopy_place_page_zero(host); > > + return 0; > > +} > > Would this be faster than normal precopy way of just copying a zero page? For postcopy we have to do an ioctl anyway (to release any paused tasks waiting on the page), and we can't just write to the page because it's not mapped yet. We could do a UFFDIO_COPY of a zero page but that would take a copy; here the kernel maps the zero page and releases the paused task without needing a zero page to copy from. Dave -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK