From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZYpI-00053D-H4 for qemu-devel@nongnu.org; Fri, 25 Oct 2013 00:16:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZYp9-0004gT-Ij for qemu-devel@nongnu.org; Fri, 25 Oct 2013 00:16:44 -0400 Received: from e28smtp06.in.ibm.com ([122.248.162.6]:54666) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZYp8-0004gP-UI for qemu-devel@nongnu.org; Fri, 25 Oct 2013 00:16:35 -0400 Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 25 Oct 2013 09:46:25 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 146323940058 for ; Fri, 25 Oct 2013 09:46:02 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r9P4JH7332571574 for ; Fri, 25 Oct 2013 09:49:17 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r9P4GLPo006493 for ; Fri, 25 Oct 2013 09:46:22 +0530 Message-ID: <5269F093.40509@linux.vnet.ibm.com> Date: Fri, 25 Oct 2013 12:16:19 +0800 From: Lei Li MIME-Version: 1.0 References: <1382412341-1173-1-git-send-email-lilei@linux.vnet.ibm.com> <1382412341-1173-10-git-send-email-lilei@linux.vnet.ibm.com> <526929A9.9030103@redhat.com> In-Reply-To: <526929A9.9030103@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 09/17] migration-local: override before_ram_iterate to send pipefd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: aarcange@redhat.com, aliguori@us.ibm.com, quintela@redhat.com, mdroth@linux.vnet.ibm.com, mrhines@linux.vnet.ibm.com, qemu-devel@nongnu.org, lagarcia@br.ibm.com, rcj@linux.vnet.ibm.com On 10/24/2013 10:07 PM, Paolo Bonzini wrote: > Il 22/10/2013 04:25, Lei Li ha scritto: >> Override befor_ram_iterate to send pipefd. It will write the >> RAM_SAVE_FLAG_HOOK flags which will trigger the load hook to >> receive it. >> >> Signed-off-by: Lei Li >> --- >> migration-local.c | 26 ++++++++++++++++++++++++++ >> 1 files changed, 26 insertions(+), 0 deletions(-) >> >> diff --git a/migration-local.c b/migration-local.c >> index ed0ae6c..92c661c 100644 >> --- a/migration-local.c >> +++ b/migration-local.c >> @@ -114,6 +114,31 @@ static int qemu_local_close(void *opaque) >> return 0; >> } >> >> +static int send_pipefd(int sockfd, int pipefd); >> + >> +static int qemu_local_send_pipefd(QEMUFile *f, void *opaque, >> + uint64_t flags) >> +{ >> + QEMUFileLocal *s = opaque; >> + int ret; >> + >> + if (s->unix_page_flipping) { >> + /* Avoid sending pipe fd again in ram_save_complete() stage */ >> + if (flags != RAM_CONTROL_FINISH) { > Why not "flags == RAM_CONTROL_SETUP"? As now it actually has two stages SETUP and FINISH, 'flags == RAM_CONTROL_SETUP' is more straight forward. Thanks! > >> + qemu_put_be64(f, RAM_SAVE_FLAG_HOOK); >> + qemu_fflush(f); >> + ret = send_pipefd(s->sockfd, s->pipefd[0]); >> + if (ret < 0) { >> + fprintf(stderr, "failed to pass pipe\n"); >> + return ret; >> + } >> + DPRINTF("pipe fd was sent\n"); >> + } >> + } >> + >> + return 0; >> +} >> + >> static const QEMUFileOps pipe_read_ops = { >> .get_fd = qemu_local_get_sockfd, >> .get_buffer = qemu_local_get_buffer, >> @@ -124,6 +149,7 @@ static const QEMUFileOps pipe_write_ops = { >> .get_fd = qemu_local_get_sockfd, >> .writev_buffer = qemu_local_writev_buffer, >> .close = qemu_local_close, >> + .before_ram_iterate = qemu_local_send_pipefd, >> }; >> >> QEMUFile *qemu_fopen_socket_local(int sockfd, const char *mode) >> > Otherwise looks good. > > Paolo > -- Lei