[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 27/43] postcopy: ram_enable_notify to switch on u
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PATCH v2 27/43] postcopy: ram_enable_notify to switch on userfault |
Date: |
Mon, 11 Aug 2014 15:29:43 +0100 |
From: "Dr. David Alan Gilbert" <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
include/migration/postcopy-ram.h | 5 +++++
postcopy-ram.c | 36 +++++++++++++++++++++++++++++++++++-
2 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/include/migration/postcopy-ram.h b/include/migration/postcopy-ram.h
index ca2045b..fc23558 100644
--- a/include/migration/postcopy-ram.h
+++ b/include/migration/postcopy-ram.h
@@ -28,6 +28,11 @@ int postcopy_send_discard_bitmap(MigrationState *ms);
int postcopy_ram_discard_range(MigrationIncomingState *mis, uint8_t *start,
uint8_t *end);
+/*
+ * 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
diff --git a/postcopy-ram.c b/postcopy-ram.c
index b1fbabd..5b52542 100644
--- a/postcopy-ram.c
+++ b/postcopy-ram.c
@@ -352,9 +352,38 @@ int postcopy_ram_incoming_cleanup(MigrationIncomingState
*mis)
return 0;
}
+/*
+ * Mark the given area of RAM as requiring notification to unwritten areas
+ * Used as a callback on qemu_ram_foreach_block.
+ * host_addr: Base of area to mark
+ * offset: Offset in the whole ram arena
+ * length: Length of the section
+ * opaque: Unused
+ * Returns 0 on success
+ */
+static int postcopy_ram_sensitise_area(const char *block_name, void *host_addr,
+ ram_addr_t offset, ram_addr_t length,
+ void *opaque)
+{
+ if (madvise(host_addr, length, MADV_USERFAULT)) {
+ perror("postcopy_ram_sensitise_area");
+ return -1;
+ }
+ return 0;
+}
+
+int postcopy_ram_enable_notify(MigrationIncomingState *mis)
+{
+ /* Mark so that we get notified of accesses to unwritten areas */
+ if (qemu_ram_foreach_block(postcopy_ram_sensitise_area, NULL)) {
+ return -1;
+ }
+
+ return 0;
+}
+
#else
/* No target OS support, stubs just fail */
-
int postcopy_ram_hosttest(void)
{
error_report("postcopy_ram_hosttest: No OS support");
@@ -387,6 +416,11 @@ int postcopy_ram_incoming_cleanup(MigrationIncomingState
*mis)
return -1;
}
+int postcopy_ram_enable_notify(MigrationIncomingState *mis)
+{
+ fprintf(stderr, "postcopy_ram_enable_notify: No OS support\n");
+ return -1;
+}
#endif
/* ------------------------------------------------------------------------- */
--
1.9.3
- [Qemu-devel] [PATCH v2 16/43] QEMU_VM_CMD_PACKAGED: Send a packaged chunk of migration stream, (continued)
- [Qemu-devel] [PATCH v2 16/43] QEMU_VM_CMD_PACKAGED: Send a packaged chunk of migration stream, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 17/43] migrate_init: Call from savevm, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 19/43] postcopy: OS support test, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 18/43] Allow savevm handlers to state whether they could go into postcopy, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 20/43] migrate_start_postcopy: Command to trigger transition to postcopy, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 22/43] qemu_savevm_state_complete: Postcopy changes, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 24/43] Postcopy page-map-incoming (PMI) structure, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 21/43] MIG_STATE_POSTCOPY_ACTIVE: Add new migration state, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 25/43] postcopy: Add incoming_init/cleanup functions, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 23/43] Postcopy: Maintain sentmap during postcopy pre phase, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 27/43] postcopy: ram_enable_notify to switch on userfault,
Dr. David Alan Gilbert (git) <=
- [Qemu-devel] [PATCH v2 26/43] postcopy: Incoming initialisation, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 28/43] Postcopy: postcopy_start, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 29/43] Postcopy: Rework migration thread for postcopy mode, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 30/43] mig fd_connect: open return path, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 31/43] Postcopy: Create a fault handler thread before marking the ram as userfault, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 33/43] Page request: Process incoming page request, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 34/43] Page request: Consume pages off the post-copy queue, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 36/43] postcopy_ram.c: place_page and helpers, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 35/43] Add assertion to check migration_dirty_pages, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 38/43] qemu_ram_block_from_host, Dr. David Alan Gilbert (git), 2014/08/11