[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 31/43] Postcopy: Create a fault handler thread be
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PATCH v2 31/43] Postcopy: Create a fault handler thread before marking the ram as userfault |
Date: |
Mon, 11 Aug 2014 15:29:47 +0100 |
From: "Dr. David Alan Gilbert" <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
include/migration/migration.h | 3 +++
postcopy-ram.c | 23 +++++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 21aa8e3..98ebe69 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -87,6 +87,9 @@ struct MigrationIncomingState {
POSTCOPY_RAM_INCOMING_END
} postcopy_ram_state;
+ QemuThread fault_thread;
+ QemuSemaphore fault_thread_sem;
+
QEMUFile *return_path;
QemuMutex rp_mutex; /* We send replies from multiple threads */
PostcopyPMI postcopy_pmi;
diff --git a/postcopy-ram.c b/postcopy-ram.c
index 5b52542..84b36d7 100644
--- a/postcopy-ram.c
+++ b/postcopy-ram.c
@@ -372,8 +372,31 @@ static int postcopy_ram_sensitise_area(const char
*block_name, void *host_addr,
return 0;
}
+/*
+ * Handle faults detected by the USERFAULT markings
+ */
+static void *postcopy_ram_fault_thread(void *opaque)
+{
+ MigrationIncomingState *mis = (MigrationIncomingState *)opaque;
+
+ fprintf(stderr, "postcopy_ram_fault_thread\n");
+ /* TODO: In later patch */
+ qemu_sem_post(&mis->fault_thread_sem);
+ while (1) {
+ /* TODO: In later patch */
+ }
+
+ return NULL;
+}
+
int postcopy_ram_enable_notify(MigrationIncomingState *mis)
{
+ /* Create the fault handler thread and wait for it to be ready */
+ qemu_sem_init(&mis->fault_thread_sem, 0);
+ qemu_thread_create(&mis->fault_thread, "postcopy/fault",
+ postcopy_ram_fault_thread, mis, QEMU_THREAD_JOINABLE);
+ qemu_sem_wait(&mis->fault_thread_sem);
+
/* Mark so that we get notified of accesses to unwritten areas */
if (qemu_ram_foreach_block(postcopy_ram_sensitise_area, NULL)) {
return -1;
--
1.9.3
- [Qemu-devel] [PATCH v2 22/43] qemu_savevm_state_complete: Postcopy changes, (continued)
- [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), 2014/08/11
- [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) <=
- [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
- [Qemu-devel] [PATCH v2 37/43] Postcopy: Use helpers to map pages during migration, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 40/43] Start up a postcopy/listener thread ready for incoming page data, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 41/43] postcopy: Wire up loadvm_postcopy_ram_handle_{run, end} commands, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 39/43] Postcopy; Handle userfault requests, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 42/43] End of migration for postcopy, Dr. David Alan Gilbert (git), 2014/08/11