From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwQPi-0005qu-Ms for qemu-devel@nongnu.org; Fri, 27 Dec 2013 00:56:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwQPZ-0004pf-OG for qemu-devel@nongnu.org; Fri, 27 Dec 2013 00:56:50 -0500 Received: from e8.ny.us.ibm.com ([32.97.182.138]:34075) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwQPZ-0004pb-Je for qemu-devel@nongnu.org; Fri, 27 Dec 2013 00:56:41 -0500 Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 27 Dec 2013 00:56:41 -0500 Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id BDA3E6E803C for ; Fri, 27 Dec 2013 00:56:35 -0500 (EST) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by b01cxnp22033.gho.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rBR5ucJ35243178 for ; Fri, 27 Dec 2013 05:56:38 GMT Received: from d01av01.pok.ibm.com (localhost [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rBR5ucSm018824 for ; Fri, 27 Dec 2013 00:56:38 -0500 Message-ID: <52BD14FE.6090504@linux.vnet.ibm.com> Date: Fri, 27 Dec 2013 13:49:50 +0800 From: "Michael R. Hines" MIME-Version: 1.0 References: <1385975957-22941-1-git-send-email-lilei@linux.vnet.ibm.com> <1385975957-22941-12-git-send-email-lilei@linux.vnet.ibm.com> In-Reply-To: <1385975957-22941-12-git-send-email-lilei@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 11/17] add argument ram_addr_t to hook_ram_load List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lei Li Cc: aarcange@redhat.com, quintela@redhat.com, qemu-devel@nongnu.org, aliguori@amazon.com, lagarcia@br.ibm.com, pbonzini@redhat.com, rcj@linux.vnet.ibm.com On 12/02/2013 05:19 PM, Lei Li wrote: > Adds argument ram_addr_t to hook_ram_load, and replaces > QEMURamHookFunc with QEMURamLoadHookFunc for it. With this > new argument, it will allow cut almost half of the data > transferred on the Unix socket using by page flipping > migraton. > > Signed-off-by: Lei Li > --- > arch_init.c | 2 +- > include/migration/migration.h | 2 +- > include/migration/qemu-file.h | 11 ++++++++++- > migration-rdma.c | 2 +- > savevm.c | 4 ++-- > 5 files changed, 15 insertions(+), 6 deletions(-) > > diff --git a/arch_init.c b/arch_init.c > index daaa519..0621893 100644 > --- a/arch_init.c > +++ b/arch_init.c > @@ -945,7 +945,7 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) > goto done; > } > } else if (flags & RAM_SAVE_FLAG_HOOK) { > - ram_control_load_hook(f, flags); > + ram_control_load_hook(f, addr, flags); > } > error = qemu_file_get_error(f); > if (error) { > diff --git a/include/migration/migration.h b/include/migration/migration.h > index ca852a8..300e52c 100644 > --- a/include/migration/migration.h > +++ b/include/migration/migration.h > @@ -149,7 +149,7 @@ int64_t xbzrle_cache_resize(int64_t new_size); > > void ram_control_before_iterate(QEMUFile *f, uint64_t flags); > void ram_control_after_iterate(QEMUFile *f, uint64_t flags); > -void ram_control_load_hook(QEMUFile *f, uint64_t flags); > +void ram_control_load_hook(QEMUFile *f, ram_addr_t addr, uint64_t flags); > > /* Whenever this is found in the data stream, the flags > * will be passed to ram_control_load_hook in the incoming-migration > diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h > index 6646e89..176c2d9 100644 > --- a/include/migration/qemu-file.h > +++ b/include/migration/qemu-file.h > @@ -65,6 +65,15 @@ typedef ssize_t (QEMUFileWritevBufferFunc)(void *opaque, struct iovec *iov, > typedef int (QEMURamHookFunc)(QEMUFile *f, void *opaque, uint64_t flags); > > /* > + * This function provides load hook for RAM migration, allows > + * override of where the RAM page is loaded (such as page > + * flipping for example). > + */ > +typedef int (QEMURamLoadHookFunc)(QEMUFile *f, void *opaque, > + ram_addr_t addr, > + uint64_t flags); > + > +/* > * Constants used by ram_control_* hooks > */ > #define RAM_CONTROL_SETUP 0 > @@ -90,7 +99,7 @@ typedef struct QEMUFileOps { > QEMUFileWritevBufferFunc *writev_buffer; > QEMURamHookFunc *before_ram_iterate; > QEMURamHookFunc *after_ram_iterate; > - QEMURamHookFunc *hook_ram_load; > + QEMURamLoadHookFunc *hook_ram_load; > QEMURamSaveFunc *save_page; > } QEMUFileOps; > > diff --git a/migration-rdma.c b/migration-rdma.c > index ae04de4..732ec1a 100644 > --- a/migration-rdma.c > +++ b/migration-rdma.c > @@ -2938,7 +2938,7 @@ err_rdma_dest_wait: > * Keep doing this until the source tells us to stop. > */ > static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque, > - uint64_t flags) > + ram_addr_t offset, uint64_t flags) > { > RDMAControlHeader reg_resp = { .len = sizeof(RDMARegisterResult), > .type = RDMA_CONTROL_REGISTER_RESULT, > diff --git a/savevm.c b/savevm.c > index 137e74f..75e397c 100644 > --- a/savevm.c > +++ b/savevm.c > @@ -647,12 +647,12 @@ void ram_control_after_iterate(QEMUFile *f, uint64_t flags) > } > } > > -void ram_control_load_hook(QEMUFile *f, uint64_t flags) > +void ram_control_load_hook(QEMUFile *f, ram_addr_t offset, uint64_t flags) > { > int ret = -EINVAL; > > if (f->ops->hook_ram_load) { > - ret = f->ops->hook_ram_load(f, f->opaque, flags); > + ret = f->ops->hook_ram_load(f, f->opaque, offset, flags); > if (ret < 0) { > qemu_file_set_error(f, ret); > } Reviewed-by: Michael R. Hines