colo: Don't dump colo cache if dump-guest-core=off
authorLukas Straub <lukasstraub2@web.de>
Sun, 4 Jul 2021 16:14:44 +0000 (18:14 +0200)
committerJuan Quintela <quintela@trasno.org>
Wed, 3 Nov 2021 08:39:31 +0000 (09:39 +0100)
One might set dump-guest-core=off to make coredumps smaller and
still allow to debug many qemu bugs. Extend this option to the colo
cache.

Signed-off-by: Lukas Straub <lukasstraub2@web.de>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
migration/ram.c

index f5d39db4e4a0af0fc428d96d1da93713f89ccd6e..847af461f23b786b440f2de42889390651104fd4 100644 (file)
@@ -56,6 +56,8 @@
 #include "multifd.h"
 #include "sysemu/runstate.h"
 
+#include "hw/boards.h" /* for machine_dump_guest_core() */
+
 #if defined(__linux__)
 #include "qemu/userfaultfd.h"
 #endif /* defined(__linux__) */
@@ -3542,6 +3544,10 @@ int colo_init_ram_cache(void)
                 }
                 return -errno;
             }
+            if (!machine_dump_guest_core(current_machine)) {
+                qemu_madvise(block->colo_cache, block->used_length,
+                             QEMU_MADV_DONTDUMP);
+            }
         }
     }