[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/6] migration/multifd: notify channels_ready when send thread
From: |
Wei Yang |
Subject: |
[PATCH v2 2/6] migration/multifd: notify channels_ready when send thread starts |
Date: |
Sat, 26 Oct 2019 08:45:16 +0800 |
multifd_send_state->channels_ready is initialized to 0. It is proper to
let main thread know we are ready when thread start running.
Current implementation works since ram_save_setup() calls
multifd_send_sync_main() which wake up send thread and posts
channels_ready. This behavior will introduce some unpredictable
situation and disturb the semaphore value.
This is a preparation patch to use another mechanism to do send thread
synchronization to avoid post channels_ready in this case. So this patch
posts channels_ready when send threads start running.
Signed-off-by: Wei Yang <address@hidden>
---
migration/ram.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/migration/ram.c b/migration/ram.c
index 35f147388b..25d477796e 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1107,6 +1107,8 @@ static void *multifd_send_thread(void *opaque)
}
/* initial packet */
p->num_packets = 1;
+ /* let main thread know we are ready */
+ qemu_sem_post(&multifd_send_state->channels_ready);
while (true) {
qemu_sem_wait(&p->sem);
--
2.17.1
- [PATCH v2 0/6] migration/multifd: a new mechanism for send thread sync, Wei Yang, 2019/10/25
- [PATCH v2 2/6] migration/multifd: notify channels_ready when send thread starts,
Wei Yang <=
- [PATCH v2 1/6] migration/multifd: move Params update and pages cleanup into multifd_send_fill_packet(), Wei Yang, 2019/10/25
- [PATCH v2 3/6] migration/multifd: use sync field to synchronize send threads, Wei Yang, 2019/10/25
- [PATCH v2 4/6] migration/multifd: used must not be 0 for a pending job, Wei Yang, 2019/10/25
- [PATCH v2 5/6] migration/multifd: use boolean for pending_job is enough, Wei Yang, 2019/10/25
- [PATCH v2 6/6] migration/multifd: there is no spurious wakeup now, Wei Yang, 2019/10/25