From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43467) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVhl4-0004dy-CU for qemu-devel@nongnu.org; Wed, 11 Mar 2015 10:37:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVhkz-0002LP-Cb for qemu-devel@nongnu.org; Wed, 11 Mar 2015 10:37:14 -0400 Received: from mail-wg0-x233.google.com ([2a00:1450:400c:c00::233]:42111) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVhky-0002LH-Rm for qemu-devel@nongnu.org; Wed, 11 Mar 2015 10:37:09 -0400 Received: by wggy19 with SMTP id y19so9694310wgg.9 for ; Wed, 11 Mar 2015 07:37:08 -0700 (PDT) Message-ID: <5500530F.1050302@gmail.com> Date: Wed, 11 Mar 2015 16:37:03 +0200 From: Marcel Apfelbaum MIME-Version: 1.0 References: <1423064635-19045-1-git-send-email-marcel@redhat.com> <1423064635-19045-6-git-send-email-marcel@redhat.com> In-Reply-To: <1423064635-19045-6-git-send-email-marcel@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 5/8] machine: query kvm-shadow-mem machine property rather than qemu opts Reply-To: marcel@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, james.hogan@imgtec.com, mst@redhat.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 kvm_shadow_mem parameter in command line. > > Signed-off-by: Marcel Apfelbaum Please amend commit message: Commit e79d5a6 ("machine: remove qemu_machine_opts global list") removed the global option descriptions and moved them to MachineState's QOM properties. Query kvm-shadow-mem by accessing machine properties through designated wrappers. Signed-off-by: Marcel Apfelbaum > --- > hw/core/machine.c | 6 ++++++ > include/hw/boards.h | 1 + > target-i386/kvm.c | 3 +-- > 3 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/hw/core/machine.c b/hw/core/machine.c > index e04e5ab..0ad5b12 100644 > --- a/hw/core/machine.c > +++ b/hw/core/machine.c > @@ -284,6 +284,7 @@ static void machine_initfn(Object *obj) > MachineState *ms = MACHINE(obj); > > ms->kernel_irqchip_allowed = true; > + ms->kvm_shadow_mem = -1; > > object_property_add_str(obj, "accel", > machine_get_accel, machine_set_accel, NULL); > @@ -414,6 +415,11 @@ bool machine_kernel_irqchip_required(MachineState *machine) > return machine->kernel_irqchip_required; > } > > +int machine_kvm_shadow_mem(MachineState *machine) > +{ > + return machine->kvm_shadow_mem; > +} > + > static const TypeInfo machine_info = { > .name = TYPE_MACHINE, > .parent = TYPE_OBJECT, > diff --git a/include/hw/boards.h b/include/hw/boards.h > index 69ab606..4be3cd1 100644 > --- a/include/hw/boards.h > +++ b/include/hw/boards.h > @@ -69,6 +69,7 @@ bool machine_usb(MachineState *machine); > bool machine_iommu(MachineState *machine); > bool machine_kernel_irqchip_allowed(MachineState *machine); > bool machine_kernel_irqchip_required(MachineState *machine); > +int machine_kvm_shadow_mem(MachineState *machine); > > /** > * MachineClass: > diff --git a/target-i386/kvm.c b/target-i386/kvm.c > index ce554e4..acb6831 100644 > --- a/target-i386/kvm.c > +++ b/target-i386/kvm.c > @@ -890,8 +890,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) > } > qemu_register_reset(kvm_unpoison_all, NULL); > > - shadow_mem = qemu_opt_get_size(qemu_get_machine_opts(), > - "kvm_shadow_mem", -1); > + shadow_mem = machine_kvm_shadow_mem(ms); > if (shadow_mem != -1) { > shadow_mem /= 4096; > ret = kvm_vm_ioctl(s, KVM_SET_NR_MMU_PAGES, shadow_mem); >