Message ID | 1382412341-1173-10-git-send-email-lilei@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
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 <lilei@linux.vnet.ibm.com> > --- > 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"? > + 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
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 <lilei@linux.vnet.ibm.com> >> --- >> 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 >
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 <lilei@linux.vnet.ibm.com> >> --- >> 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"? > >> + 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. Just want to confirm, normally, should I take these 'otherwise looks good/ok' as a 'Reviewed-by' from you If the other comment is fixed in the update version? > > Paolo >
Il 25/10/2013 05:38, Lei Li ha scritto: > > Just want to confirm, normally, should I take these 'otherwise looks > good/ok' > as a 'Reviewed-by' from you If the other comment is fixed in the update > version? Depends on how much the patch changes... right now I'm still expecting some changes so I didn't really look much at the patch and didn't test it. I prefer to take a more complete look at v3 before giving a "formal" Reviewed-by. Paolo
On 10/25/2013 03:23 PM, Paolo Bonzini wrote: > Il 25/10/2013 05:38, Lei Li ha scritto: >> Just want to confirm, normally, should I take these 'otherwise looks >> good/ok' >> as a 'Reviewed-by' from you If the other comment is fixed in the update >> version? > Depends on how much the patch changes... right now I'm still expecting > some changes so I didn't really look much at the patch and didn't test > it. I prefer to take a more complete look at v3 before giving a > "formal" Reviewed-by. I see, thanks for your explanation. > > Paolo >
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) { + 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)
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 <lilei@linux.vnet.ibm.com> --- migration-local.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-)