Blame SOURCES/kvm-migration-multifd-Report-to-user-when-zerocopy-not-w.patch

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