From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVReR-0006iV-OP for qemu-devel@nongnu.org; Tue, 10 Mar 2015 17:25:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVReN-0007EN-M9 for qemu-devel@nongnu.org; Tue, 10 Mar 2015 17:25:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVReN-0007Dn-Eh for qemu-devel@nongnu.org; Tue, 10 Mar 2015 17:25:15 -0400 Date: Tue, 10 Mar 2015 22:24:33 +0100 From: "Michael S. Tsirkin" Message-ID: <20150310222233-mutt-send-email-mst@redhat.com> References: <1423064635-19045-1-git-send-email-marcel@redhat.com> <1423064635-19045-8-git-send-email-marcel@redhat.com> <54FF2EE0.9010401@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <54FF2EE0.9010401@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 7/8] machine: query dump-guest-core machine property rather than qemu opts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, james.hogan@imgtec.com, borntraeger@de.ibm.com, jan.kiszka@siemens.com, Riku Voipio , qemu-devel@nongnu.org, agraf@suse.de, scottwood@freescale.com, cornelia.huck@de.ibm.com, Marcel Apfelbaum , pbonzini@redhat.com, leon.alrae@imgtec.com, aurelien@aurel32.net On Tue, Mar 10, 2015 at 06:50:24PM +0100, Andreas F=E4rber wrote: > Hi, >=20 > Am 04.02.2015 um 16:43 schrieb Marcel Apfelbaum: > > Fixes a QEMU crash when passing dump_guest_core parameter in command = line. >=20 > Explain that, please? Pls note the submission date. It's 1 month late to ask for basic clarifications. I've merged the patches, I'll fix up issues such as prettifying includes by adding patches on top. > >=20 > > 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(-) > >=20 > > 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; > > =20 > > /* Use MADV_DONTDUMP, if user doesn't want the guest memory in t= he core */ > > - if (!qemu_opt_get_bool(qemu_get_machine_opts(), > > - "dump-guest-core", true)) { > > + if (!machine_dump_guest_core(current_machine)) { >=20 > linux-user doesn't have a current_machine, and machine.c shouldn't even > be compiled in, so I'm guessing this function is #ifdef'ed, which means > the header should be #ifdef'ed, too. hw/boards.h has no business being > in *-user. >=20 > Regards, > Andreas >=20 > > ret =3D 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) > > =20 > > ms->kernel_irqchip_allowed =3D true; > > ms->kvm_shadow_mem =3D -1; > > + ms->dump_guest_core =3D true; > > =20 > > object_property_add_str(obj, "accel", > > machine_get_accel, machine_set_accel, NU= LL); > > @@ -425,6 +426,11 @@ int machine_phandle_start(MachineState *machine) > > return machine->phandle_start; > > } > > =20 > > +bool machine_dump_guest_core(MachineState *machine) > > +{ > > + return machine->dump_guest_core; > > +} > > + > > static const TypeInfo machine_info =3D { > > .name =3D TYPE_MACHINE, > > .parent =3D 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 *m= achine); > > 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); > > =20 > > /** > > * MachineClass: > >=20 >=20 >=20 > --=20 > SUSE Linux GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany > GF: Felix Imend=F6rffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu, > Graham Norton; HRB 21284 (AG N=FCrnberg)