mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
dump: introduce GuestPhysBlockList
The vmcore must use physical addresses that are visible to the guest, not addresses that point into linear RAMBlocks. As first step, introduce the list type into which we'll collect the physical mappings in effect at the time of the dump. Related RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=981582 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
2cac260768
commit
5ee163e8ea
3 changed files with 65 additions and 19 deletions
45
dump.c
45
dump.c
|
@ -59,6 +59,7 @@ static uint64_t cpu_convert_to_target64(uint64_t val, int endian)
|
|||
}
|
||||
|
||||
typedef struct DumpState {
|
||||
GuestPhysBlockList guest_phys_blocks;
|
||||
ArchDumpInfo dump_info;
|
||||
MemoryMappingList list;
|
||||
uint16_t phdr_num;
|
||||
|
@ -81,6 +82,7 @@ static int dump_cleanup(DumpState *s)
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
guest_phys_blocks_free(&s->guest_phys_blocks);
|
||||
memory_mapping_list_free(&s->list);
|
||||
if (s->fd != -1) {
|
||||
close(s->fd);
|
||||
|
@ -728,24 +730,8 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter,
|
|||
s->resume = false;
|
||||
}
|
||||
|
||||
s->errp = errp;
|
||||
s->fd = fd;
|
||||
s->has_filter = has_filter;
|
||||
s->begin = begin;
|
||||
s->length = length;
|
||||
s->start = get_start_block(s);
|
||||
if (s->start == -1) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "begin");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* get dump info: endian, class and architecture.
|
||||
* If the target architecture is not supported, cpu_get_dump_info() will
|
||||
* return -1.
|
||||
*
|
||||
* If we use KVM, we should synchronize the registers before we get dump
|
||||
* info.
|
||||
/* If we use KVM, we should synchronize the registers before we get dump
|
||||
* info or physmap info.
|
||||
*/
|
||||
cpu_synchronize_all_states();
|
||||
nr_cpus = 0;
|
||||
|
@ -753,6 +739,25 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter,
|
|||
nr_cpus++;
|
||||
}
|
||||
|
||||
s->errp = errp;
|
||||
s->fd = fd;
|
||||
s->has_filter = has_filter;
|
||||
s->begin = begin;
|
||||
s->length = length;
|
||||
|
||||
guest_phys_blocks_init(&s->guest_phys_blocks);
|
||||
/* FILL LIST */
|
||||
|
||||
s->start = get_start_block(s);
|
||||
if (s->start == -1) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "begin");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* get dump info: endian, class and architecture.
|
||||
* If the target architecture is not supported, cpu_get_dump_info() will
|
||||
* return -1.
|
||||
*/
|
||||
ret = cpu_get_dump_info(&s->dump_info);
|
||||
if (ret < 0) {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
|
@ -827,6 +832,8 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter,
|
|||
return 0;
|
||||
|
||||
cleanup:
|
||||
guest_phys_blocks_free(&s->guest_phys_blocks);
|
||||
|
||||
if (s->resume) {
|
||||
vm_start();
|
||||
}
|
||||
|
@ -874,7 +881,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
|||
return;
|
||||
}
|
||||
|
||||
s = g_malloc(sizeof(DumpState));
|
||||
s = g_malloc0(sizeof(DumpState));
|
||||
|
||||
ret = dump_init(s, fd, paging, has_begin, begin, length, errp);
|
||||
if (ret < 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue