From 696ed9a9b3fee2d033d7b049ba2e6568860a25d1 Mon Sep 17 00:00:00 2001 From: Dr. David Alan Gilbert Date: Thu, 5 Nov 2015 18:11:10 +0000 Subject: postcopy_ram.c: place_page and helpers postcopy_place_page (etc) provide a way for postcopy to place a page into guests memory atomically (using the copy ioctl on the ufd). Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Amit Shah Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- include/migration/migration.h | 1 + include/migration/postcopy-ram.h | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'include') diff --git a/include/migration/migration.h b/include/migration/migration.h index 1491bf32ed..a48471e026 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -96,6 +96,7 @@ struct MigrationIncomingState { int userfault_fd; QEMUFile *to_src_file; QemuMutex rp_mutex; /* We send replies from multiple threads */ + void *postcopy_tmp_page; /* See savevm.c */ LoadStateEntry_Head loadvm_handlers; diff --git a/include/migration/postcopy-ram.h b/include/migration/postcopy-ram.h index b10c03db6e..d7c292fffa 100644 --- a/include/migration/postcopy-ram.h +++ b/include/migration/postcopy-ram.h @@ -69,4 +69,25 @@ void postcopy_discard_send_range(MigrationState *ms, PostcopyDiscardState *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); + +/* + * Place a zero page at (host) atomically + * returns 0 on success + */ +int postcopy_place_page_zero(MigrationIncomingState *mis, void *host); + +/* + * 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 -- cgit v1.2.3-55-g7522