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

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