Message ID | 1423064635-19045-9-git-send-email-marcel@redhat.com |
---|---|
State | New |
Headers | show |
On Wed, Feb 04, 2015 at 05:43:55PM +0200, Marcel Apfelbaum wrote: > Fixes a QEMU crash when passing mem_merge parameter in command line. > > Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Can you rebase this one on top of my pci branch pls? > --- > 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: > -- > 2.1.0
On 03/10/2015 05:11 PM, Michael S. Tsirkin wrote: > On Wed, Feb 04, 2015 at 05:43:55PM +0200, Marcel Apfelbaum wrote: >> Fixes a QEMU crash when passing mem_merge parameter in command line. >> >> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> > > Can you rebase this one on top of my pci branch pls? I'll submit again only 8/8 after rebase. Thanks, Marcel > >> --- >> 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: >> -- >> 2.1.0
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:
Fixes a QEMU crash when passing mem_merge parameter in command line. Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> --- exec.c | 2 +- hw/core/machine.c | 6 ++++++ include/hw/boards.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-)