thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 6 months ago
Clone

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

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