From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZF25G-0002FF-Es for qemu-devel@nongnu.org; Tue, 14 Jul 2015 11:25:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZF25C-00038S-EV for qemu-devel@nongnu.org; Tue, 14 Jul 2015 11:25:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZF25C-00038L-9f for qemu-devel@nongnu.org; Tue, 14 Jul 2015 11:25:22 -0400 From: Juan Quintela In-Reply-To: <20150714151538.GA13856@work-vm> (David Alan Gilbert's message of "Tue, 14 Jul 2015 16:15:39 +0100") References: <1434450415-11339-1-git-send-email-dgilbert@redhat.com> <1434450415-11339-38-git-send-email-dgilbert@redhat.com> <87h9p6g4gd.fsf@neno.neno> <20150714151538.GA13856@work-vm> Date: Tue, 14 Jul 2015 17:25:20 +0200 Message-ID: <87r3oaep7j.fsf@neno.neno> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v7 37/42] Postcopy; Handle userfault requests Reply-To: quintela@redhat.com 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, liang.z.li@intel.com, qemu-devel@nongnu.org, luis@cs.umu.se, amit.shah@redhat.com, pbonzini@redhat.com, david@gibson.dropbear.id.au "Dr. David Alan Gilbert" wrote: > * Juan Quintela (quintela@redhat.com) wrote: >> "Dr. David Alan Gilbert (git)" wrote: >> > From: "Dr. David Alan Gilbert" >> > >> > userfaultfd is a Linux syscall that gives an fd that receives a stream >> > of notifications of accesses to pages registered with it and allows >> > the program to acknowledge those stalls and tell the accessing >> > thread to carry on. >> > >> > We convert the requests from the kernel into messages back to the >> > source asking for the pages. >> > >> > Signed-off-by: Dr. David Alan Gilbert >> >> >> > @@ -274,15 +276,41 @@ int postcopy_ram_incoming_init(MigrationIncomingState *mis, size_t ram_pages) >> > */ >> > int postcopy_ram_incoming_cleanup(MigrationIncomingState *mis) >> > { >> > - /* TODO: Join the fault thread once we're sure it will exit */ >> > - if (qemu_ram_foreach_block(cleanup_area, mis)) { >> > - return -1; >> > + trace_postcopy_ram_incoming_cleanup_entry(); >> > + >> > + if (mis->have_fault_thread) { >> > + uint64_t tmp64; >> > + >> > + if (qemu_ram_foreach_block(cleanup_area, mis)) { >> > + return -1; >> > + } >> > + /* >> > + * Tell the fault_thread to exit, it's an eventfd that should >> > + * currently be at 0, we're going to inc it to 1 >> > + */ >> > + tmp64 = 1; >> > + if (write(mis->userfault_quit_fd, &tmp64, 8) == 8) { >> > + trace_postcopy_ram_incoming_cleanup_join(); >> > + qemu_thread_join(&mis->fault_thread); >> > + } else { >> > + /* Not much we can do here, but may as well report it */ >> > + error_report("%s: incing userfault_quit_fd: %s", __func__, >> > + strerror(errno)); >> >> "incing"??? > > Oh, incrementing :-) > Changed. > > Dave > -- > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK Reviewed-by: Juan Quintela