diff options
author | Peter Xu <peterx@redhat.com> | 2022-03-01 16:39:06 +0800 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2022-03-02 18:20:45 +0000 |
commit | 095c12a4a2df4bb45e8d1b1f74dc7ea80fef9ca4 (patch) | |
tree | 8dd85c62daee6f8e4b1f71ebd85e38e05feef63c /migration/migration.h | |
parent | cfc7dc8abfdb71e39e48bdb297b5e86fe2121d97 (diff) |
migration: Add postcopy_thread_create()
Postcopy create threads. A common manner is we init a sem and use it to sync
with the thread. Namely, we have fault_thread_sem and listen_thread_sem and
they're only used for this.
Make it a shared infrastructure so it's easier to create yet another thread.
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20220301083925.33483-7-peterx@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration/migration.h')
-rw-r--r-- | migration/migration.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/migration/migration.h b/migration/migration.h index 42c7395094..8445e1d14a 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -70,7 +70,11 @@ struct MigrationIncomingState { /* A hook to allow cleanup at the end of incoming migration */ void *transport_data; void (*transport_cleanup)(void *data); - + /* + * Used to sync thread creations. Note that we can't create threads in + * parallel with this sem. + */ + QemuSemaphore thread_sync_sem; /* * Free at the start of the main state load, set as the main thread finishes * loading state. @@ -83,13 +87,11 @@ struct MigrationIncomingState { size_t largest_page_size; bool have_fault_thread; QemuThread fault_thread; - QemuSemaphore fault_thread_sem; /* Set this when we want the fault thread to quit */ bool fault_thread_quit; bool have_listen_thread; QemuThread listen_thread; - QemuSemaphore listen_thread_sem; /* For the kernel to send us notifications */ int userfault_fd; |