qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 7/8] machine: query dump-guest-core machine prop


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH 7/8] machine: query dump-guest-core machine property rather than qemu opts
Date: Tue, 10 Mar 2015 18:50:24 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

Hi,

Am 04.02.2015 um 16:43 schrieb Marcel Apfelbaum:
> Fixes a QEMU crash when passing dump_guest_core parameter in command line.

Explain that, please?

> 
> Signed-off-by: Marcel Apfelbaum <address@hidden>
> ---
>  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)) {

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.

Regards,
Andreas

>          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:
> 


-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]