[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 16/47] ram_debug_dump_bitmap: Dump a migration bi
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PATCH v3 16/47] ram_debug_dump_bitmap: Dump a migration bitmap as text |
Date: |
Thu, 28 Aug 2014 16:03:33 +0100 |
From: "Dr. David Alan Gilbert" <address@hidden>
Misses out lines that are all the expected value so the output
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 d2b565e..2568369 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 b87c289..ff47987 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -157,6 +157,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
- [Qemu-devel] [PATCH v3 04/47] qemu_ram_foreach_block: pass up error value, and down the ramblock name, (continued)
- [Qemu-devel] [PATCH v3 04/47] qemu_ram_foreach_block: pass up error value, and down the ramblock name, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 03/47] Start documenting how postcopy works., Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 02/47] Tests: QEMUSizedBuffer/QEMUBuffer, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 05/47] improve DPRINTF macros, add to savevm, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 08/47] socket shutdown, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 10/47] Return path: socket_writev_buffer: Block even on non-blocking fd's, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 14/47] Return path: Source handling of return path, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 09/47] Return path: Open a return path on QEMUFile for sockets, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 12/47] Return path: Control commands, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 13/47] Return path: Send responses from destination to source, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 16/47] ram_debug_dump_bitmap: Dump a migration bitmap as text,
Dr. David Alan Gilbert (git) <=
- [Qemu-devel] [PATCH v3 17/47] Rework loadvm path for subloops, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 06/47] Add qemu_get_counted_string to read a string prefixed by a count byte, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 18/47] Add migration-capability boolean for postcopy-ram., Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 20/47] QEMU_VM_CMD_PACKAGED: Send a packaged chunk of migration stream, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 22/47] Allow savevm handlers to state whether they could go into postcopy, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 23/47] postcopy: OS support test, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 11/47] Migration commands, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 21/47] migrate_init: Call from savevm, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 24/47] migrate_start_postcopy: Command to trigger transition to postcopy, Dr. David Alan Gilbert (git), 2014/08/28
- [Qemu-devel] [PATCH v3 25/47] MIG_STATE_POSTCOPY_ACTIVE: Add new migration state, Dr. David Alan Gilbert (git), 2014/08/28