Blame SOURCES/kvm-migration-savevm.c-set-MAX_VM_CMD_PACKAGED_SIZE-to-1.patch

4a2fec
From a3df1677bfe1f2ae0a6bcb54f745b08b211369ce Mon Sep 17 00:00:00 2001
4a2fec
From: Laurent Vivier <lvivier@redhat.com>
4a2fec
Date: Wed, 7 Feb 2018 15:47:54 +0100
4a2fec
Subject: [PATCH 02/15] migration/savevm.c: set MAX_VM_CMD_PACKAGED_SIZE to 1ul
4a2fec
 << 32
4a2fec
4a2fec
RH-Author: Laurent Vivier <lvivier@redhat.com>
4a2fec
Message-id: <20180207154754.9064-1-lvivier@redhat.com>
4a2fec
Patchwork-id: 78921
4a2fec
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH] migration/savevm.c: set MAX_VM_CMD_PACKAGED_SIZE to 1ul << 32
4a2fec
Bugzilla: 1540003
4a2fec
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4a2fec
RH-Acked-by: David Gibson <dgibson@redhat.com>
4a2fec
RH-Acked-by: Thomas Huth <thuth@redhat.com>
4a2fec
4a2fec
From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
4a2fec
4a2fec
MAX_VM_CMD_PACKAGED_SIZE is a constant used in qemu_savevm_send_packaged
4a2fec
and loadvm_handle_cmd_packaged to determine whether a package is too
4a2fec
big to be sent or received. qemu_savevm_send_packaged is called inside
4a2fec
postcopy_start (migration/migration.c) to send the MigrationState
4a2fec
in a single blob to the destination, using the MIG_CMD_PACKAGED subcommand,
4a2fec
which will read it up using loadvm_handle_cmd_packaged. If the blob is
4a2fec
larger than MAX_VM_CMD_PACKAGED_SIZE, an error is thrown and the postcopy
4a2fec
migration is aborted. Both MAX_VM_CMD_PACKAGED_SIZE and MIG_CMD_PACKAGED
4a2fec
were introduced by commit 11cf1d984b ("MIG_CMD_PACKAGED: Send a packaged
4a2fec
chunk ..."). The constant has its original value of 1ul << 24 (16MB).
4a2fec
4a2fec
The current MAX_VM_CMD_PACKAGED_SIZE value is not enough to support postcopy
4a2fec
migration of bigger pseries guests. The blob size for a postcopy migration of
4a2fec
a pseries guest with the following setup:
4a2fec
4a2fec
qemu-system-ppc64 --nographic -vga none -machine pseries,accel=kvm -m 64G \
4a2fec
-smp 1,maxcpus=32 -device virtio-blk-pci,drive=rootdisk \
4a2fec
-drive file=f27.qcow2,if=none,cache=none,format=qcow2,id=rootdisk \
4a2fec
-netdev user,id=u1 -net nic,netdev=u1
4a2fec
4a2fec
Goes around 12MB. Bumping the RAM to 128G makes the blob sizes goes to 20MB.
4a2fec
With 256G the blob goes to 37MB - more than twice the current maximum size.
4a2fec
At this moment the pseries machine can handle guests with up to 1TB of RAM,
4a2fec
making this postcopy blob goes to 128MB of size approximately.
4a2fec
4a2fec
Following the discussions made in [1], there is a need to understand what
4a2fec
devices are aggressively consuming the blob in that manner and see if that
4a2fec
can be mitigated. Until then, we can set MAX_VM_CMD_PACKAGED_SIZE to the
4a2fec
maximum value allowed. Since the size is a 32 bit int variable, we can set
4a2fec
it as 1ul << 32, giving a maximum blob size of 4G that is enough to support
4a2fec
postcopy migration of 32TB RAM guests given the above constraints.
4a2fec
4a2fec
[1] https://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg06313.html
4a2fec
4a2fec
Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
4a2fec
Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
4a2fec
Reviewed-by: Juan Quintela <quintela@redhat.com>
4a2fec
Signed-off-by: Juan Quintela <quintela@redhat.com>
4a2fec
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4a2fec
(cherry picked from commit ee555cdf4d495ddd83633406e3099c5d1ef22e0a)
4a2fec
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 migration/savevm.c | 2 +-
4a2fec
 1 file changed, 1 insertion(+), 1 deletion(-)
4a2fec
4a2fec
diff --git a/migration/savevm.c b/migration/savevm.c
4a2fec
index 5eb3504..c466921 100644
4a2fec
--- a/migration/savevm.c
4a2fec
+++ b/migration/savevm.c
4a2fec
@@ -83,7 +83,7 @@ enum qemu_vm_cmd {
4a2fec
 };
4a2fec
 bool shadow_bios_after_incoming;
4a2fec
 
4a2fec
-#define MAX_VM_CMD_PACKAGED_SIZE (1ul << 24)
4a2fec
+#define MAX_VM_CMD_PACKAGED_SIZE UINT32_MAX
4a2fec
 static struct mig_cmd_args {
4a2fec
     ssize_t     len; /* -1 = variable */
4a2fec
     const char *name;
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec