machine: query dump-guest-core machine property
Running qemu-bin ... -machine pc,dump-guest-core=on leads to crash: x86_64-softmmu/qemu-system-x86_64 -machine pc,dump-guest-core=on qemu-system-x86_64: qemu/util/qemu-option.c:387: qemu_opt_get_bool_helper: Assertion `opt->desc && opt->desc->type == QEMU_OPT_BOOL' failed. Aborted (core dumped) This happens because the commit e79d5a6 ("machine: remove qemu_machine_opts global list") removed the global option descriptions and moved them to MachineState's QOM properties. Fix this by querying machine properties through designated wrappers. Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
66bd56694b
commit
47c8ca533e
4
exec.c
4
exec.c
@ -26,6 +26,7 @@
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "tcg.h"
|
#include "tcg.h"
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
|
#include "hw/boards.h"
|
||||||
#include "hw/qdev.h"
|
#include "hw/qdev.h"
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "sysemu/kvm.h"
|
#include "sysemu/kvm.h"
|
||||||
@ -1250,8 +1251,7 @@ static void qemu_ram_setup_dump(void *addr, ram_addr_t size)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Use MADV_DONTDUMP, if user doesn't want the guest memory in the core */
|
/* Use MADV_DONTDUMP, if user doesn't want the guest memory in the core */
|
||||||
if (!qemu_opt_get_bool(qemu_get_machine_opts(),
|
if (!machine_dump_guest_core(current_machine)) {
|
||||||
"dump-guest-core", true)) {
|
|
||||||
ret = qemu_madvise(addr, size, QEMU_MADV_DONTDUMP);
|
ret = qemu_madvise(addr, size, QEMU_MADV_DONTDUMP);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
perror("qemu_madvise");
|
perror("qemu_madvise");
|
||||||
|
@ -285,6 +285,7 @@ static void machine_initfn(Object *obj)
|
|||||||
|
|
||||||
ms->kernel_irqchip_allowed = true;
|
ms->kernel_irqchip_allowed = true;
|
||||||
ms->kvm_shadow_mem = -1;
|
ms->kvm_shadow_mem = -1;
|
||||||
|
ms->dump_guest_core = true;
|
||||||
|
|
||||||
object_property_add_str(obj, "accel",
|
object_property_add_str(obj, "accel",
|
||||||
machine_get_accel, machine_set_accel, NULL);
|
machine_get_accel, machine_set_accel, NULL);
|
||||||
@ -425,6 +426,11 @@ int machine_phandle_start(MachineState *machine)
|
|||||||
return machine->phandle_start;
|
return machine->phandle_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool machine_dump_guest_core(MachineState *machine)
|
||||||
|
{
|
||||||
|
return machine->dump_guest_core;
|
||||||
|
}
|
||||||
|
|
||||||
static const TypeInfo machine_info = {
|
static const TypeInfo machine_info = {
|
||||||
.name = TYPE_MACHINE,
|
.name = TYPE_MACHINE,
|
||||||
.parent = TYPE_OBJECT,
|
.parent = TYPE_OBJECT,
|
||||||
|
@ -73,6 +73,7 @@ bool machine_kernel_irqchip_allowed(MachineState *machine);
|
|||||||
bool machine_kernel_irqchip_required(MachineState *machine);
|
bool machine_kernel_irqchip_required(MachineState *machine);
|
||||||
int machine_kvm_shadow_mem(MachineState *machine);
|
int machine_kvm_shadow_mem(MachineState *machine);
|
||||||
int machine_phandle_start(MachineState *machine);
|
int machine_phandle_start(MachineState *machine);
|
||||||
|
bool machine_dump_guest_core(MachineState *machine);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MachineClass:
|
* MachineClass:
|
||||||
|
Loading…
Reference in New Issue
Block a user