diff options
author | Juan Quintela <quintela@redhat.com> | 2017-04-20 13:12:24 +0200 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2017-05-04 10:40:30 +0200 |
commit | be07b0ace82b0f23bee194de9e4481c308645376 (patch) | |
tree | 214f94653990ac6d759b2bf5fd69e00f5d3addc2 /migration | |
parent | 6683061873095ad3f34f73bd32553c1d2c559e82 (diff) |
migration: Move postcopy-ram.h to migration/
It is internal to migration, not intended for other users.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r-- | migration/migration.c | 2 | ||||
-rw-r--r-- | migration/postcopy-ram.c | 2 | ||||
-rw-r--r-- | migration/postcopy-ram.h | 91 | ||||
-rw-r--r-- | migration/ram.c | 2 | ||||
-rw-r--r-- | migration/savevm.c | 2 |
5 files changed, 95 insertions, 4 deletions
diff --git a/migration/migration.c b/migration/migration.c index 353f2728cf..799952ce99 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -26,7 +26,7 @@ #include "qemu/sockets.h" #include "qemu/rcu.h" #include "migration/block.h" -#include "migration/postcopy-ram.h" +#include "postcopy-ram.h" #include "qemu/thread.h" #include "qmp-commands.h" #include "trace.h" diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index e3f4a37b46..cdadaf6578 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -20,7 +20,7 @@ #include "qemu-common.h" #include "migration/migration.h" -#include "migration/postcopy-ram.h" +#include "postcopy-ram.h" #include "sysemu/sysemu.h" #include "sysemu/balloon.h" #include "qemu/error-report.h" diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h new file mode 100644 index 0000000000..4c25f03be2 --- /dev/null +++ b/migration/postcopy-ram.h @@ -0,0 +1,91 @@ +/* + * Postcopy migration for RAM + * + * Copyright 2013 Red Hat, Inc. and/or its affiliates + * + * Authors: + * Dave Gilbert <dgilbert@redhat.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ +#ifndef QEMU_POSTCOPY_RAM_H +#define QEMU_POSTCOPY_RAM_H + +/* Return true if the host supports everything we need to do postcopy-ram */ +bool postcopy_ram_supported_by_host(void); + +/* + * Make all of RAM sensitive to accesses to areas that haven't yet been written + * and wire up anything necessary to deal with it. + */ +int postcopy_ram_enable_notify(MigrationIncomingState *mis); + +/* + * Initialise postcopy-ram, setting the RAM to a state where we can go into + * postcopy later; must be called prior to any precopy. + * called from ram.c's similarly named ram_postcopy_incoming_init + */ +int postcopy_ram_incoming_init(MigrationIncomingState *mis, size_t ram_pages); + +/* + * At the end of a migration where postcopy_ram_incoming_init was called. + */ +int postcopy_ram_incoming_cleanup(MigrationIncomingState *mis); + +/* + * Userfault requires us to mark RAM as NOHUGEPAGE prior to discard + * however leaving it until after precopy means that most of the precopy + * data is still THPd + */ +int postcopy_ram_prepare_discard(MigrationIncomingState *mis); + +/* + * Called at the start of each RAMBlock by the bitmap code. + * Returns a new PDS + */ +PostcopyDiscardState *postcopy_discard_send_init(MigrationState *ms, + const char *name); + +/* + * Called by the bitmap code for each chunk to discard. + * May send a discard message, may just leave it queued to + * be sent later. + * @start,@length: a range of pages in the migration bitmap in the + * RAM block passed to postcopy_discard_send_init() (length=1 is one page) + */ +void postcopy_discard_send_range(MigrationState *ms, PostcopyDiscardState *pds, + unsigned long start, unsigned long length); + +/* + * Called at the end of each RAMBlock by the bitmap code. + * Sends any outstanding discard messages, frees the PDS. + */ +void postcopy_discard_send_finish(MigrationState *ms, + PostcopyDiscardState *pds); + +/* + * Place a page (from) at (host) efficiently + * There are restrictions on how 'from' must be mapped, in general best + * to use other postcopy_ routines to allocate. + * returns 0 on success + */ +int postcopy_place_page(MigrationIncomingState *mis, void *host, void *from, + size_t pagesize); + +/* + * Place a zero page at (host) atomically + * returns 0 on success + */ +int postcopy_place_page_zero(MigrationIncomingState *mis, void *host, + size_t pagesize); + +/* + * Allocate a page of memory that can be mapped at a later point in time + * using postcopy_place_page + * Returns: Pointer to allocated page + */ +void *postcopy_get_tmp_page(MigrationIncomingState *mis); + +#endif diff --git a/migration/ram.c b/migration/ram.c index 1f03469c13..4918c11576 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -36,7 +36,7 @@ #include "qemu/timer.h" #include "qemu/main-loop.h" #include "migration/migration.h" -#include "migration/postcopy-ram.h" +#include "postcopy-ram.h" #include "exec/address-spaces.h" #include "migration/page_cache.h" #include "qemu/error-report.h" diff --git a/migration/savevm.c b/migration/savevm.c index ff78a8948d..7668510cfc 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -36,7 +36,7 @@ #include "sysemu/sysemu.h" #include "qemu/timer.h" #include "migration/migration.h" -#include "migration/postcopy-ram.h" +#include "postcopy-ram.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "qemu/queue.h" |