qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Zhenzhong Duan <zhenzhong.duan@intel.com>
To: qemu-devel@nongnu.org
Cc: quintela@redhat.com, dgilbert@redhat.com
Subject: [PATCH 2/2] multifd: Fix flush of zero copy page send request
Date: Mon, 17 Oct 2022 15:53:51 +0800	[thread overview]
Message-ID: <20221017075351.2974642-2-zhenzhong.duan@intel.com> (raw)
In-Reply-To: <20221017075351.2974642-1-zhenzhong.duan@intel.com>

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(-)

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;
-- 
2.25.1



  reply	other threads:[~2022-10-17  8:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17  7:53 [PATCH 1/2] multifd: Fix a race on reading MultiFDPages_t.block Zhenzhong Duan
2022-10-17  7:53 ` Zhenzhong Duan [this message]
2023-02-02 20:14   ` [PATCH 2/2] multifd: Fix flush of zero copy page send request Juan Quintela
2023-02-02 20:13 ` [PATCH 1/2] multifd: Fix a race on reading MultiFDPages_t.block Juan Quintela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221017075351.2974642-2-zhenzhong.duan@intel.com \
    --to=zhenzhong.duan@intel.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).