From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVhaL-0000n1-2d for qemu-devel@nongnu.org; Wed, 11 Mar 2015 10:26:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVhaG-0006Oz-Ht for qemu-devel@nongnu.org; Wed, 11 Mar 2015 10:26:09 -0400 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]:46454) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVhaG-0006On-Bz for qemu-devel@nongnu.org; Wed, 11 Mar 2015 10:26:04 -0400 Received: by wesk11 with SMTP id k11so9560569wes.13 for ; Wed, 11 Mar 2015 07:26:03 -0700 (PDT) Message-ID: <55005075.30606@gmail.com> Date: Wed, 11 Mar 2015 16:25:57 +0200 From: Marcel Apfelbaum MIME-Version: 1.0 References: <1423064635-19045-1-git-send-email-marcel@redhat.com> <1423064635-19045-8-git-send-email-marcel@redhat.com> In-Reply-To: <1423064635-19045-8-git-send-email-marcel@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 7/8] machine: query dump-guest-core machine property rather than qemu opts Reply-To: marcel@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mst@redhat.com, qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, james.hogan@imgtec.com, jan.kiszka@siemens.com, agraf@suse.de, scottwood@freescale.com, borntraeger@de.ibm.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com, leon.alrae@imgtec.com, aurelien@aurel32.net On 02/04/2015 05:43 PM, Marcel Apfelbaum wrote: > Fixes a QEMU crash when passing dump_guest_core parameter in command line. > > Signed-off-by: Marcel Apfelbaum Please amend commit message: 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 > --- > exec.c | 4 ++-- > hw/core/machine.c | 6 ++++++ > include/hw/boards.h | 1 + > 3 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/exec.c b/exec.c > index 6b79ad1..bfca528 100644 > --- a/exec.c > +++ b/exec.c > @@ -26,6 +26,7 @@ > #include "cpu.h" > #include "tcg.h" > #include "hw/hw.h" > +#include "hw/boards.h" > #include "hw/qdev.h" > #include "qemu/osdep.h" > #include "sysemu/kvm.h" > @@ -1213,8 +1214,7 @@ static void qemu_ram_setup_dump(void *addr, ram_addr_t size) > int ret; > > /* Use MADV_DONTDUMP, if user doesn't want the guest memory in the core */ > - if (!qemu_opt_get_bool(qemu_get_machine_opts(), > - "dump-guest-core", true)) { > + if (!machine_dump_guest_core(current_machine)) { > ret = qemu_madvise(addr, size, QEMU_MADV_DONTDUMP); > if (ret) { > perror("qemu_madvise"); > diff --git a/hw/core/machine.c b/hw/core/machine.c > index 5ad2409..8033683 100644 > --- a/hw/core/machine.c > +++ b/hw/core/machine.c > @@ -285,6 +285,7 @@ static void machine_initfn(Object *obj) > > ms->kernel_irqchip_allowed = true; > ms->kvm_shadow_mem = -1; > + ms->dump_guest_core = true; > > object_property_add_str(obj, "accel", > machine_get_accel, machine_set_accel, NULL); > @@ -425,6 +426,11 @@ int machine_phandle_start(MachineState *machine) > return machine->phandle_start; > } > > +bool machine_dump_guest_core(MachineState *machine) > +{ > + return machine->dump_guest_core; > +} > + > static const TypeInfo machine_info = { > .name = TYPE_MACHINE, > .parent = TYPE_OBJECT, > diff --git a/include/hw/boards.h b/include/hw/boards.h > index 1f21bdf..7de308e 100644 > --- a/include/hw/boards.h > +++ b/include/hw/boards.h > @@ -71,6 +71,7 @@ bool machine_kernel_irqchip_allowed(MachineState *machine); > bool machine_kernel_irqchip_required(MachineState *machine); > int machine_kvm_shadow_mem(MachineState *machine); > int machine_phandle_start(MachineState *machine); > +bool machine_dump_guest_core(MachineState *machine); > > /** > * MachineClass: >