thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
0727d3
From 2516a21205e67078cb735e9fd47ba50156c166b7 Mon Sep 17 00:00:00 2001
0727d3
From: Leonardo Bras <leobras@redhat.com>
0727d3
Date: Mon, 11 Jul 2022 18:11:13 -0300
0727d3
Subject: [PATCH 5/9] migration/multifd: Report to user when zerocopy not
0727d3
 working
0727d3
MIME-Version: 1.0
0727d3
Content-Type: text/plain; charset=UTF-8
0727d3
Content-Transfer-Encoding: 8bit
0727d3
0727d3
RH-Author: Leonardo Brás <leobras@redhat.com>
0727d3
RH-MergeRequest: 201: Zero-copy-send fixes + improvements
0727d3
RH-Commit: [5/8] 0b2e23b7f8ae72936e11369cd44ba474ef3b9e8c
0727d3
RH-Bugzilla: 2110203
0727d3
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
0727d3
RH-Acked-by: Peter Xu <peterx@redhat.com>
0727d3
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
0727d3
0727d3
Some errors, like the lack of Scatter-Gather support by the network
0727d3
interface(NETIF_F_SG) may cause sendmsg(...,MSG_ZEROCOPY) to fail on using
0727d3
zero-copy, which causes it to fall back to the default copying mechanism.
0727d3
0727d3
After each full dirty-bitmap scan there should be a zero-copy flush
0727d3
happening, which checks for errors each of the previous calls to
0727d3
sendmsg(...,MSG_ZEROCOPY). If all of them failed to use zero-copy, then
0727d3
increment dirty_sync_missed_zero_copy migration stat to let the user know
0727d3
about it.
0727d3
0727d3
Signed-off-by: Leonardo Bras <leobras@redhat.com>
0727d3
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
0727d3
Acked-by: Peter Xu <peterx@redhat.com>
0727d3
Message-Id: <20220711211112.18951-4-leobras@redhat.com>
0727d3
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
0727d3
(cherry picked from commit d59c40cc483729f2e67c80e58df769ad19976fe9)
0727d3
Signed-off-by: Leonardo Bras <leobras@redhat.com>
0727d3
---
0727d3
 migration/multifd.c | 2 ++
0727d3
 migration/ram.c     | 5 +++++
0727d3
 migration/ram.h     | 2 ++
0727d3
 3 files changed, 9 insertions(+)
0727d3
0727d3
diff --git a/migration/multifd.c b/migration/multifd.c
0727d3
index 90ab4c4346..7c16523e6b 100644
0727d3
--- a/migration/multifd.c
0727d3
+++ b/migration/multifd.c
0727d3
@@ -631,6 +631,8 @@ int multifd_send_sync_main(QEMUFile *f)
0727d3
             if (ret < 0) {
0727d3
                 error_report_err(err);
0727d3
                 return -1;
0727d3
+            } else if (ret == 1) {
0727d3
+                dirty_sync_missed_zero_copy();
0727d3
             }
0727d3
         }
0727d3
     }
0727d3
diff --git a/migration/ram.c b/migration/ram.c
0727d3
index e7173da217..93cdb456ac 100644
0727d3
--- a/migration/ram.c
0727d3
+++ b/migration/ram.c
0727d3
@@ -403,6 +403,11 @@ static void ram_transferred_add(uint64_t bytes)
0727d3
     ram_counters.transferred += bytes;
0727d3
 }
0727d3
 
0727d3
+void dirty_sync_missed_zero_copy(void)
0727d3
+{
0727d3
+    ram_counters.dirty_sync_missed_zero_copy++;
0727d3
+}
0727d3
+
0727d3
 /* used by the search for pages to send */
0727d3
 struct PageSearchStatus {
0727d3
     /* Current block being searched */
0727d3
diff --git a/migration/ram.h b/migration/ram.h
0727d3
index c515396a9a..69c3ccb26a 100644
0727d3
--- a/migration/ram.h
0727d3
+++ b/migration/ram.h
0727d3
@@ -88,4 +88,6 @@ void ram_write_tracking_prepare(void);
0727d3
 int ram_write_tracking_start(void);
0727d3
 void ram_write_tracking_stop(void);
0727d3
 
0727d3
+void dirty_sync_missed_zero_copy(void);
0727d3
+
0727d3
 #endif
0727d3
-- 
0727d3
2.31.1
0727d3