From patchwork Wed Feb 4 15:43:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 436440 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D6BCD140180 for ; Thu, 5 Feb 2015 04:38:13 +1100 (AEDT) Received: from localhost ([::1]:37665 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ3u0-0005gR-3f for incoming@patchwork.ozlabs.org; Wed, 04 Feb 2015 12:38:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45831) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ3sn-0003OT-FD for qemu-devel@nongnu.org; Wed, 04 Feb 2015 12:36:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJ3sk-0005e0-Ik for qemu-devel@nongnu.org; Wed, 04 Feb 2015 12:36:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55966) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ3sk-0005dw-6f for qemu-devel@nongnu.org; Wed, 04 Feb 2015 12:36:54 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t14Fibx7024572 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 4 Feb 2015 10:44:38 -0500 Received: from work.redhat.com (vpn1-7-196.ams2.redhat.com [10.36.7.196]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t14Fhu8g010817; Wed, 4 Feb 2015 10:44:33 -0500 From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Wed, 4 Feb 2015 17:43:55 +0200 Message-Id: <1423064635-19045-9-git-send-email-marcel@redhat.com> In-Reply-To: <1423064635-19045-1-git-send-email-marcel@redhat.com> References: <1423064635-19045-1-git-send-email-marcel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, james.hogan@imgtec.com, mst@redhat.com, marcel@redhat.com, jan.kiszka@siemens.com, cornelia.huck@de.ibm.com, agraf@suse.de, borntraeger@de.ibm.com, scottwood@freescale.com, pbonzini@redhat.com, leon.alrae@imgtec.com, aurelien@aurel32.net Subject: [Qemu-devel] [PATCH 8/8] machine: query mem-merge machine property rather than qemu opts X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Fixes a QEMU crash when passing mem_merge parameter in command line. Signed-off-by: Marcel Apfelbaum --- exec.c | 2 +- hw/core/machine.c | 6 ++++++ include/hw/boards.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/exec.c b/exec.c index bfca528..becd122 100644 --- a/exec.c +++ b/exec.c @@ -1277,7 +1277,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, diff --git a/include/hw/boards.h b/include/hw/boards.h index 7de308e..f44d6f5 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -72,6 +72,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: