diff mbox series

[2/2] multifd: Fix flush of zero copy page send request

Message ID 20221017075351.2974642-2-zhenzhong.duan@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/2] multifd: Fix a race on reading MultiFDPages_t.block | expand

Commit Message

Duan, Zhenzhong Oct. 17, 2022, 7:53 a.m. UTC
Make IO channel flush call after the inflight request has been drained
in multifd thread, or else we may missed to flush the inflight request.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 migration/multifd.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Juan Quintela Feb. 2, 2023, 8:14 p.m. UTC | #1
Zhenzhong Duan <zhenzhong.duan@intel.com> wrote:
> Make IO channel flush call after the inflight request has been drained
> in multifd thread, or else we may missed to flush the inflight request.
>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>

Good catch!!!!!

Reviewed-by: Juan Quintela <quintela@redhat.com>

queued the whole series.
diff mbox series

Patch

diff --git a/migration/multifd.c b/migration/multifd.c
index 36e2139995cf..1e01873128f6 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -618,6 +618,12 @@  int multifd_send_sync_main(QEMUFile *f)
         ram_counters.transferred += p->packet_len;
         qemu_mutex_unlock(&p->mutex);
         qemu_sem_post(&p->sem);
+    }
+    for (i = 0; i < migrate_multifd_channels(); i++) {
+        MultiFDSendParams *p = &multifd_send_state->params[i];
+
+        trace_multifd_send_sync_main_wait(p->id);
+        qemu_sem_wait(&p->sem_sync);
 
         if (flush_zero_copy && p->c) {
             int ret;
@@ -632,12 +638,6 @@  int multifd_send_sync_main(QEMUFile *f)
             }
         }
     }
-    for (i = 0; i < migrate_multifd_channels(); i++) {
-        MultiFDSendParams *p = &multifd_send_state->params[i];
-
-        trace_multifd_send_sync_main_wait(p->id);
-        qemu_sem_wait(&p->sem_sync);
-    }
     trace_multifd_send_sync_main(multifd_send_state->packet_num);
 
     return 0;