dump-guest-memory: add "detach" support

If "detach" is provided, one thread is created to do the dump work,
while main thread will return immediately. For each GuestPhysBlock,
adding one more field "mr" to points to MemoryRegion that it
belongs, also ref the mr before use.

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-Id: <1455772616-8668-8-git-send-email-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Peter Xu 2016-02-18 13:16:52 +08:00 committed by Paolo Bonzini
parent 63e27f28f2
commit 1fbeff72c2
4 changed files with 34 additions and 1 deletions

View file

@ -181,6 +181,7 @@ typedef struct DumpState {
bool has_format; /* whether format is provided */
DumpGuestMemoryFormat format; /* valid only if has_format == true */
QemuThread dump_thread; /* thread for detached dump */
} DumpState;
uint16_t cpu_to_dump16(DumpState *s, uint16_t val);

View file

@ -16,6 +16,7 @@
#include "qemu/queue.h"
#include "qemu/typedefs.h"
#include "exec/memory.h"
typedef struct GuestPhysBlock {
/* visible to guest, reflects PCI hole, etc */
@ -27,6 +28,9 @@ typedef struct GuestPhysBlock {
/* points into host memory */
uint8_t *host_addr;
/* points to the MemoryRegion that this block belongs to */
MemoryRegion *mr;
QTAILQ_ENTRY(GuestPhysBlock) next;
} GuestPhysBlock;