From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50110) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVnIh-0003bA-SC for qemu-devel@nongnu.org; Wed, 11 Mar 2015 16:32:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVnIc-0005jo-5q for qemu-devel@nongnu.org; Wed, 11 Mar 2015 16:32:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47691) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVnIb-0005jk-U2 for qemu-devel@nongnu.org; Wed, 11 Mar 2015 16:32:14 -0400 Date: Wed, 11 Mar 2015 20:51:22 +0100 From: "Michael S. Tsirkin" Message-ID: <20150311205122-mutt-send-email-mst@redhat.com> References: <1426096767-30494-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1426096767-30494-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 14/25] machine: query mem-merge machine property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Peter Maydell , Paolo Bonzini From: Marcel Apfelbaum Running qemu-bin ... -machine pc,mem-merge=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 Acked-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Paolo Bonzini --- include/hw/boards.h | 1 + exec.c | 2 +- hw/core/machine.c | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index bbac39d..cd6deb0 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -74,6 +74,7 @@ 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); +bool machine_mem_merge(MachineState *machine); /** * MachineClass: diff --git a/exec.c b/exec.c index f55270b..fe64009 100644 --- a/exec.c +++ b/exec.c @@ -1326,7 +1326,7 @@ void qemu_ram_unset_idstr(ram_addr_t addr) static int memory_try_enable_merging(void *addr, size_t len) { - if (!qemu_opt_get_bool(qemu_get_machine_opts(), "mem-merge", true)) { + if (!machine_mem_merge(current_machine)) { /* disabled by the user */ return 0; } diff --git a/hw/core/machine.c b/hw/core/machine.c index 8033683..e3a3e2a 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -286,6 +286,7 @@ static void machine_initfn(Object *obj) ms->kernel_irqchip_allowed = true; ms->kvm_shadow_mem = -1; ms->dump_guest_core = true; + ms->mem_merge = true; object_property_add_str(obj, "accel", machine_get_accel, machine_set_accel, NULL); @@ -431,6 +432,11 @@ bool machine_dump_guest_core(MachineState *machine) return machine->dump_guest_core; } +bool machine_mem_merge(MachineState *machine) +{ + return machine->mem_merge; +} + static const TypeInfo machine_info = { .name = TYPE_MACHINE, .parent = TYPE_OBJECT, -- MST