From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Michael Tokarev" <mjt@tls.msk.ru>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Laurent Vivier" <laurent@vivier.eu>,
"Juan Quintela" <quintela@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Peter Xu" <peterx@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
qemu-block@nongnu.org, qemu-trivial@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Fam Zheng" <fam@euphon.net>,
"Leonardo Bras" <leobras@redhat.com>
Subject: [PULL 02/30] migration/multifd/zero-copy: Create helper function for flushing
Date: Tue, 15 Nov 2022 16:34:46 +0100 [thread overview]
Message-ID: <20221115153514.28003-3-quintela@redhat.com> (raw)
In-Reply-To: <20221115153514.28003-1-quintela@redhat.com>
From: Leonardo Bras <leobras@redhat.com>
Move flushing code from multifd_send_sync_main() to a new helper, and call
it in multifd_send_sync_main().
Signed-off-by: Leonardo Bras <leobras@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/multifd.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/migration/multifd.c b/migration/multifd.c
index 586ddc9d65..509bbbe3bf 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -566,6 +566,23 @@ void multifd_save_cleanup(void)
multifd_send_state = NULL;
}
+static int multifd_zero_copy_flush(QIOChannel *c)
+{
+ int ret;
+ Error *err = NULL;
+
+ ret = qio_channel_flush(c, &err);
+ if (ret < 0) {
+ error_report_err(err);
+ return -1;
+ }
+ if (ret == 1) {
+ dirty_sync_missed_zero_copy();
+ }
+
+ return ret;
+}
+
int multifd_send_sync_main(QEMUFile *f)
{
int i;
@@ -616,17 +633,8 @@ int multifd_send_sync_main(QEMUFile *f)
qemu_mutex_unlock(&p->mutex);
qemu_sem_post(&p->sem);
- if (flush_zero_copy && p->c) {
- int ret;
- Error *err = NULL;
-
- ret = qio_channel_flush(p->c, &err);
- if (ret < 0) {
- error_report_err(err);
- return -1;
- } else if (ret == 1) {
- dirty_sync_missed_zero_copy();
- }
+ if (flush_zero_copy && p->c && (multifd_zero_copy_flush(p->c) < 0)) {
+ return -1;
}
}
for (i = 0; i < migrate_multifd_channels(); i++) {
--
2.38.1
next prev parent reply other threads:[~2022-11-15 15:47 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 15:34 [PULL 00/30] Next patches Juan Quintela
2022-11-15 15:34 ` [PULL 01/30] migration/channel-block: fix return value for qio_channel_block_{readv, writev} Juan Quintela
2022-11-15 15:34 ` Juan Quintela [this message]
2022-11-15 15:34 ` [PULL 03/30] migration: check magic value for deciding the mapping of channels Juan Quintela
2022-11-15 15:34 ` [PULL 04/30] multifd: Create page_size fields into both MultiFD{Recv, Send}Params Juan Quintela
2022-11-15 15:34 ` [PULL 05/30] multifd: Create page_count " Juan Quintela
2022-11-15 15:34 ` [PULL 06/30] migration: Export ram_transferred_ram() Juan Quintela
2022-11-15 15:34 ` [PULL 07/30] migration: Export ram_release_page() Juan Quintela
2022-11-15 15:34 ` [PULL 08/30] Update AVX512 support for xbzrle_encode_buffer Juan Quintela
2022-11-15 15:34 ` [PULL 09/30] Unit test code and benchmark code Juan Quintela
2022-11-15 15:34 ` [PULL 10/30] migration: Fix possible infinite loop of ram save process Juan Quintela
2022-11-15 15:34 ` [PULL 11/30] migration: Fix race on qemu_file_shutdown() Juan Quintela
2022-11-15 15:34 ` [PULL 12/30] migration: Disallow postcopy preempt to be used with compress Juan Quintela
2022-11-15 15:34 ` [PULL 13/30] migration: Use non-atomic ops for clear log bitmap Juan Quintela
2022-11-15 15:34 ` [PULL 14/30] migration: Disable multifd explicitly with compression Juan Quintela
2022-11-15 15:34 ` [PULL 15/30] migration: Take bitmap mutex when completing ram migration Juan Quintela
2022-11-15 15:35 ` [PULL 16/30] migration: Add postcopy_preempt_active() Juan Quintela
2022-11-15 15:35 ` [PULL 17/30] migration: Cleanup xbzrle zero page cache update logic Juan Quintela
2022-11-15 15:35 ` [PULL 18/30] migration: Trivial cleanup save_page_header() on same block check Juan Quintela
2022-11-15 15:35 ` [PULL 19/30] migration: Remove RAMState.f references in compression code Juan Quintela
2022-11-15 15:35 ` [PULL 20/30] migration: Yield bitmap_mutex properly when sending/sleeping Juan Quintela
2022-11-15 15:35 ` [PULL 21/30] migration: Use atomic ops properly for page accountings Juan Quintela
2022-11-15 15:35 ` [PULL 22/30] migration: Teach PSS about host page Juan Quintela
2022-11-15 15:35 ` [PULL 23/30] migration: Introduce pss_channel Juan Quintela
2022-11-15 15:35 ` [PULL 24/30] migration: Add pss_init() Juan Quintela
2022-11-15 15:35 ` [PULL 25/30] migration: Make PageSearchStatus part of RAMState Juan Quintela
2022-11-15 15:35 ` [PULL 26/30] migration: Move last_sent_block into PageSearchStatus Juan Quintela
2022-11-15 15:35 ` [PULL 27/30] migration: Send requested page directly in rp-return thread Juan Quintela
2022-11-15 15:35 ` [PULL 28/30] migration: Remove old preempt code around state maintainance Juan Quintela
2022-11-15 15:35 ` [PULL 29/30] migration: Drop rs->f Juan Quintela
2022-11-15 15:35 ` [PULL 30/30] migration: Block migration comment or code is wrong Juan Quintela
2022-11-15 18:06 ` [PULL 00/30] Next patches Daniel P. Berrangé
2022-11-15 18:57 ` Stefan Hajnoczi
2022-11-16 15:35 ` Xu, Ling1
2022-11-15 18:59 ` Stefan Hajnoczi
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=20221115153514.28003-3-quintela@redhat.com \
--to=quintela@redhat.com \
--cc=berrange@redhat.com \
--cc=david@redhat.com \
--cc=dgilbert@redhat.com \
--cc=fam@euphon.net \
--cc=laurent@vivier.eu \
--cc=leobras@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@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).