From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrRmh-0006jJ-Af for qemu-devel@nongnu.org; Tue, 25 Jun 2013 07:51:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UrRmY-00072g-Vw for qemu-devel@nongnu.org; Tue, 25 Jun 2013 07:51:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrRmY-00072V-PL for qemu-devel@nongnu.org; Tue, 25 Jun 2013 07:51:34 -0400 From: Juan Quintela In-Reply-To: <1372125485-11795-10-git-send-email-mrhines@linux.vnet.ibm.com> (mrhines@linux.vnet.ibm.com's message of "Mon, 24 Jun 2013 21:57:59 -0400") References: <1372125485-11795-1-git-send-email-mrhines@linux.vnet.ibm.com> <1372125485-11795-10-git-send-email-mrhines@linux.vnet.ibm.com> Date: Tue, 25 Jun 2013 13:51:28 +0200 Message-ID: <87wqpiz9vj.fsf@elfo.elfo> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v11 09/15] rdma: new QEMUFileOps hooks Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mrhines@linux.vnet.ibm.com Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, owasserm@redhat.com, abali@us.ibm.com, mrhines@us.ibm.com, gokul@us.ibm.com, pbonzini@redhat.com, chegu_vinod@hp.com, knoel@redhat.com mrhines@linux.vnet.ibm.com wrote: > From: "Michael R. Hines" > > These are the prototypes and implementation of new hooks that > RDMA takes advantage of to perform dynamic page registration. > > An optional hook is also introduced for a custom function > to be able to override the default save_page function. > > Also included are the prototypes and accessor methods used by > arch_init.c which invoke funtions inside savevm.c to call out > to the hooks that may or may not have been overridden > inside of QEMUFileOps. > > Reviewed-by: Paolo Bonzini > Reviewed-by: Chegu Vinod > Tested-by: Chegu Vinod > Tested-by: Michael R. Hines > Signed-off-by: Michael R. Hines Hi > +void ram_control_before_iterate(QEMUFile *f, uint64_t flags) > +{ > + int ret = 0; > + > + if (f->ops->before_ram_iterate) { > + ret = f->ops->before_ram_iterate(f, f->opaque, flags); > + if (ret < 0) { > + qemu_file_set_error(f, ret); > + } > + } > +} > + > +void ram_control_after_iterate(QEMUFile *f, uint64_t flags) > +{ > + int ret = 0; > + > + if (f->ops->after_ram_iterate) { > + ret = f->ops->after_ram_iterate(f, f->opaque, flags); > + if (ret < 0) { > + qemu_file_set_error(f, ret); > + } > + } > +} > + > +void ram_control_load_hook(QEMUFile *f, uint64_t flags) > +{ > + int ret = 0; > + > + if (f->ops->hook_ram_load) { > + ret = f->ops->hook_ram_load(f, f->opaque, flags); > + if (ret < 0) { > + qemu_file_set_error(f, ret); > + } > + } else { > + qemu_file_set_error(f, ret); > + } > +} > + > +size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, > + ram_addr_t offset, size_t size, int *bytes_sent) > +{ > + if (f->ops->save_page) { > + int ret = f->ops->save_page(f, f->opaque, block_offset, > + offset, size, bytes_sent); > + > + if (ret != RAM_SAVE_CONTROL_DELAYED) { > + if (*bytes_sent > 0) { > + qemu_update_position(f, *bytes_sent); > + } else if (ret < 0) { > + qemu_file_set_error(f, ret); > + } > + } > + > + return ret; > + } > + > + return RAM_SAVE_CONTROL_NOT_SUPP; > +} > + > static void qemu_fill_buffer(QEMUFile *f) > { > int len; I wou0ld clame that the calls to this functions belong to this patch. Not that it makes a lot of difference though. Later, Juan.