[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/46] ram_debug_dump_bitmap: Dump a migration bitma
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PATCH 14/46] ram_debug_dump_bitmap: Dump a migration bitmap as text |
Date: |
Fri, 4 Jul 2014 18:41:25 +0100 |
From: "Dr. David Alan Gilbert" <address@hidden>
Misses out lines that are all 0 so can be quite compact
depending on the circumstance.
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
arch_init.c | 39 +++++++++++++++++++++++++++++++++++++++
include/migration/migration.h | 1 +
2 files changed, 40 insertions(+)
diff --git a/arch_init.c b/arch_init.c
index eb6455a..a3c468e 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -767,6 +767,45 @@ static void reset_ram_globals(void)
#define MAX_WAIT 50 /* ms, half buffered_file limit */
+/*
+ * 'expected' is the value you expect the bitmap mostly to be full
+ * of and it won't bother printing lines that are all this value
+ * if 'todump' is null the migration bitmap is dumped.
+ */
+void ram_debug_dump_bitmap(unsigned long *todump, bool expected)
+{
+ int64_t ram_pages = last_ram_offset() >> TARGET_PAGE_BITS;
+
+ int64_t cur;
+ int64_t linelen = 128l;
+ char linebuf[129];
+
+ if (!todump) {
+ todump = migration_bitmap;
+ }
+
+ for (cur = 0; cur < ram_pages; cur += linelen) {
+ int64_t curb;
+ bool found = false;
+ /*
+ * Last line; catch the case where the line length
+ * is longer than remaining ram
+ */
+ if (cur+linelen > ram_pages) {
+ linelen = ram_pages - cur;
+ }
+ for (curb = 0; curb < linelen; curb++) {
+ bool thisbit = test_bit(cur+curb, todump);
+ linebuf[curb] = thisbit ? '1' : '.';
+ found |= (thisbit ^ expected);
+ }
+ if (found) {
+ linebuf[curb] = '\0';
+ fprintf(stderr, "0x%08lx : %s\n", cur, linebuf);
+ }
+ }
+}
+
static int ram_save_setup(QEMUFile *f, void *opaque)
{
RAMBlock *block;
diff --git a/include/migration/migration.h b/include/migration/migration.h
index f722f06..a1ed7a3 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -155,6 +155,7 @@ uint64_t xbzrle_mig_pages_cache_miss(void);
double xbzrle_mig_cache_miss_rate(void);
void ram_handle_compressed(void *host, uint8_t ch, uint64_t size);
+void ram_debug_dump_bitmap(unsigned long *todump, bool expected);
/**
* @migrate_add_blocker - prevent migration from proceeding
--
1.9.3
- Re: [Qemu-devel] [PATCH 15/46] Rework loadvm path for subloops, (continued)
[Qemu-devel] [PATCH 40/46] qemu_ram_block_from_host, Dr. David Alan Gilbert (git), 2014/07/04
[Qemu-devel] [PATCH 21/46] postcopy: OS support test, Dr. David Alan Gilbert (git), 2014/07/04
[Qemu-devel] [PATCH 22/46] Migration parameters: Add qmp/hmp commands for setting/viewing, Dr. David Alan Gilbert (git), 2014/07/04
[Qemu-devel] [PATCH 19/46] migrate_init: Call from savevm, Dr. David Alan Gilbert (git), 2014/07/04
[Qemu-devel] [PATCH 20/46] Allow savevm handlers to state whether they could go into postcopy, Dr. David Alan Gilbert (git), 2014/07/04
[Qemu-devel] [PATCH 41/46] Handle userfault requests (although userfaultfd not done yet), Dr. David Alan Gilbert (git), 2014/07/04
[Qemu-devel] [PATCH 13/46] qemu_loadvm debug, Dr. David Alan Gilbert (git), 2014/07/04
[Qemu-devel] [PATCH 14/46] ram_debug_dump_bitmap: Dump a migration bitmap as text,
Dr. David Alan Gilbert (git) <=
[Qemu-devel] [PATCH 18/46] QEMU_VM_CMD_PACKAGED: Send a packaged chunk of migration stream, Dr. David Alan Gilbert (git), 2014/07/04
[Qemu-devel] [PATCH 42/46] Start up a postcopy/listener thread ready for incoming page data, Dr. David Alan Gilbert (git), 2014/07/04
Re: [Qemu-devel] [PATCH 00/46] Postcopy implementation, Paolo Bonzini, 2014/07/05
- Re: [Qemu-devel] [PATCH 00/46] Postcopy implementation, Dr. David Alan Gilbert, 2014/07/07
- Re: [Qemu-devel] [PATCH 00/46] Postcopy implementation, Paolo Bonzini, 2014/07/07
- Re: [Qemu-devel] [PATCH 00/46] Postcopy implementation, Dr. David Alan Gilbert, 2014/07/07
- Re: [Qemu-devel] [PATCH 00/46] Postcopy implementation, Dr. David Alan Gilbert, 2014/07/10
- Re: [Qemu-devel] [PATCH 00/46] Postcopy implementation, Eric Blake, 2014/07/10
- Re: [Qemu-devel] [PATCH 00/46] Postcopy implementation, Dr. David Alan Gilbert, 2014/07/10
- Re: [Qemu-devel] [PATCH 00/46] Postcopy implementation, Andrea Arcangeli, 2014/07/10