|
From: | Michael R. Hines |
Subject: | Re: [Qemu-devel] [PATCH v11 09/15] rdma: new QEMUFileOps hooks |
Date: | Tue, 25 Jun 2013 09:38:47 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 |
On 06/25/2013 07:51 AM, Juan Quintela wrote:
address@hidden wrote:From: "Michael R. Hines" <address@hidden> 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 <address@hidden> Reviewed-by: Chegu Vinod <address@hidden> Tested-by: Chegu Vinod <address@hidden> Tested-by: Michael R. Hines <address@hidden> Signed-off-by: Michael R. Hines <address@hidden>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.
I'll avoid rebasing if there's no strong objection - as this ordering was suggested by Paolo.
- Michael
[Prev in Thread] | Current Thread | [Next in Thread] |