* [Qemu-devel] [PATCH v2] memory: add cmd line option, to omit guest memory from qemu core dump
@ 2012-08-01 16:19 Jason Baron
2012-08-01 18:21 ` Anthony Liguori
0 siblings, 1 reply; 5+ messages in thread
From: Jason Baron @ 2012-08-01 16:19 UTC (permalink / raw)
To: avi, anthony, eblake; +Cc: mtosatti, armbru, qemu-devel
Add a new '[,dump_guest_core=on|off]' option to the '-machine' option. When
'dump_guest_core=off' is specified, guest memory is omitted from the core dump.
The default behavior continues to be to include guest memory when a core dump is
triggered. In my testing, this brought the core dump size down from 384MB to 6MB
on a 2GB guest.
Changelog:
v2: move the option from -m to -machine, rename option dump -> dump_guest_core
Signed-off-by: Jason Baron <jbaron@redhat.com>
---
exec.c | 13 +++++++++++++
osdep.h | 7 +++++++
qemu-config.c | 4 ++++
qemu-options.hx | 5 ++++-
sysemu.h | 1 +
vl.c | 4 ++++
6 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/exec.c b/exec.c
index feb4795..0764818 100644
--- a/exec.c
+++ b/exec.c
@@ -35,6 +35,7 @@
#include "qemu-timer.h"
#include "memory.h"
#include "exec-memory.h"
+#include "sysemu.h"
#if defined(CONFIG_USER_ONLY)
#include <qemu.h>
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
@@ -2514,6 +2515,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
MemoryRegion *mr)
{
RAMBlock *new_block;
+ int ret;
size = TARGET_PAGE_ALIGN(size);
new_block = g_malloc0(sizeof(*new_block));
@@ -2555,6 +2557,17 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
last_ram_offset() >> TARGET_PAGE_BITS);
cpu_physical_memory_set_dirty_range(new_block->offset, size, 0xff);
+
+ /* Use MADV_DONTDUMP, if user doesn't want the guest memory in the core */
+ if (dont_dump_guest_core) {
+ ret = qemu_madvise(new_block->host, size, QEMU_MADV_DONTDUMP);
+ if (ret) {
+ perror("qemu_madvise");
+ fprintf(stderr, "madvise doesn't support MADV_DONTDUMP, "
+ "but dump_guest_core=off specified\n");
+ }
+ }
+
if (kvm_enabled())
kvm_setup_guest_memory(new_block->host, size);
diff --git a/osdep.h b/osdep.h
index 1e15a4b..e2d0f57 100644
--- a/osdep.h
+++ b/osdep.h
@@ -102,6 +102,11 @@ void qemu_vfree(void *ptr);
#else
#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
#endif
+#ifdef MADV_DONTDUMP
+#define QEMU_MADV_DONTDUMP MADV_DONTDUMP
+#else
+#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
+#endif
#elif defined(CONFIG_POSIX_MADVISE)
@@ -109,6 +114,7 @@ void qemu_vfree(void *ptr);
#define QEMU_MADV_DONTNEED POSIX_MADV_DONTNEED
#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
+#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
#else /* no-op */
@@ -116,6 +122,7 @@ void qemu_vfree(void *ptr);
#define QEMU_MADV_DONTNEED QEMU_MADV_INVALID
#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
+#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
#endif
diff --git a/qemu-config.c b/qemu-config.c
index 5c3296b..5c2c9a9 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -595,6 +595,10 @@ static QemuOptsList qemu_machine_opts = {
.name = "dt_compatible",
.type = QEMU_OPT_STRING,
.help = "Overrides the \"compatible\" property of the dt root node",
+ }, {
+ .name = "dump_guest_core",
+ .type = QEMU_OPT_BOOL,
+ .help = "Include guest memory in a core dump",
},
{ /* End of list */ }
},
diff --git a/qemu-options.hx b/qemu-options.hx
index dc68e15..e917829 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -33,7 +33,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
" property accel=accel1[:accel2[:...]] selects accelerator\n"
" supported accelerators are kvm, xen, tcg (default: tcg)\n"
" kernel_irqchip=on|off controls accelerated irqchip support\n"
- " kvm_shadow_mem=size of KVM shadow MMU\n",
+ " kvm_shadow_mem=size of KVM shadow MMU\n"
+ " dump_guest_core=on|off include guest memory in a core dump (default=on)\n",
QEMU_ARCH_ALL)
STEXI
@item -machine [type=]@var{name}[,prop=@var{value}[,...]]
@@ -50,6 +51,8 @@ to initialize.
Enables in-kernel irqchip support for the chosen accelerator when available.
@item kvm_shadow_mem=size
Defines the size of the KVM shadow MMU.
+@item dump_guest_core=on|off
+Include guest memory in a core dump. The default is on.
@end table
ETEXI
diff --git a/sysemu.h b/sysemu.h
index 6540c79..caf33ce 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -132,6 +132,7 @@ extern uint8_t *boot_splash_filedata;
extern int boot_splash_filedata_size;
extern uint8_t qemu_extra_params_fw[2];
extern QEMUClock *rtc_clock;
+extern int dont_dump_guest_core;
#define MAX_NODES 64
extern int nb_numa_nodes;
diff --git a/vl.c b/vl.c
index c18bb80..accfd28 100644
--- a/vl.c
+++ b/vl.c
@@ -226,6 +226,7 @@ int boot_menu;
uint8_t *boot_splash_filedata;
int boot_splash_filedata_size;
uint8_t qemu_extra_params_fw[2];
+int dont_dump_guest_core;
typedef struct FWBootEntry FWBootEntry;
@@ -2976,6 +2977,9 @@ int main(int argc, char **argv, char **envp)
if (optarg) {
machine = machine_parse(optarg);
}
+ if (!qemu_opt_get_bool(opts, "dump_guest_core", true)) {
+ dont_dump_guest_core = 1;
+ }
break;
case QEMU_OPTION_usb:
usb_enabled = 1;
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v2] memory: add cmd line option, to omit guest memory from qemu core dump
2012-08-01 16:19 [Qemu-devel] [PATCH v2] memory: add cmd line option, to omit guest memory from qemu core dump Jason Baron
@ 2012-08-01 18:21 ` Anthony Liguori
2012-08-01 18:28 ` Jason Baron
2012-08-02 18:05 ` Luiz Capitulino
0 siblings, 2 replies; 5+ messages in thread
From: Anthony Liguori @ 2012-08-01 18:21 UTC (permalink / raw)
To: Jason Baron, avi, eblake; +Cc: mtosatti, armbru, qemu-devel
Jason Baron <jbaron@redhat.com> writes:
> Add a new '[,dump_guest_core=on|off]' option to the '-machine' option. When
> 'dump_guest_core=off' is specified, guest memory is omitted from the core dump.
> The default behavior continues to be to include guest memory when a core dump is
> triggered. In my testing, this brought the core dump size down from 384MB to 6MB
> on a 2GB guest.
>
> Changelog:
> v2: move the option from -m to -machine, rename option dump -> dump_guest_core
>
> Signed-off-by: Jason Baron <jbaron@redhat.com>
> ---
> exec.c | 13 +++++++++++++
> osdep.h | 7 +++++++
> qemu-config.c | 4 ++++
> qemu-options.hx | 5 ++++-
> sysemu.h | 1 +
> vl.c | 4 ++++
> 6 files changed, 33 insertions(+), 1 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index feb4795..0764818 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -35,6 +35,7 @@
> #include "qemu-timer.h"
> #include "memory.h"
> #include "exec-memory.h"
> +#include "sysemu.h"
> #if defined(CONFIG_USER_ONLY)
> #include <qemu.h>
> #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
> @@ -2514,6 +2515,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
> MemoryRegion *mr)
> {
> RAMBlock *new_block;
> + int ret;
>
> size = TARGET_PAGE_ALIGN(size);
> new_block = g_malloc0(sizeof(*new_block));
> @@ -2555,6 +2557,17 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
> last_ram_offset() >> TARGET_PAGE_BITS);
> cpu_physical_memory_set_dirty_range(new_block->offset, size, 0xff);
>
> +
> + /* Use MADV_DONTDUMP, if user doesn't want the guest memory in the core */
> + if (dont_dump_guest_core) {
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
if (machine_opts && qemu_opt_get_bool(machine_opts, "dump-guest-core")) {
> + ret = qemu_madvise(new_block->host, size, QEMU_MADV_DONTDUMP);
> + if (ret) {
> + perror("qemu_madvise");
> + fprintf(stderr, "madvise doesn't support MADV_DONTDUMP, "
> + "but dump_guest_core=off specified\n");
> + }
> + }
> +
> if (kvm_enabled())
> kvm_setup_guest_memory(new_block->host, size);
>
> diff --git a/osdep.h b/osdep.h
> index 1e15a4b..e2d0f57 100644
> --- a/osdep.h
> +++ b/osdep.h
> @@ -102,6 +102,11 @@ void qemu_vfree(void *ptr);
> #else
> #define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
> #endif
> +#ifdef MADV_DONTDUMP
> +#define QEMU_MADV_DONTDUMP MADV_DONTDUMP
> +#else
> +#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
> +#endif
>
> #elif defined(CONFIG_POSIX_MADVISE)
>
> @@ -109,6 +114,7 @@ void qemu_vfree(void *ptr);
> #define QEMU_MADV_DONTNEED POSIX_MADV_DONTNEED
> #define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
> #define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
> +#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
>
> #else /* no-op */
>
> @@ -116,6 +122,7 @@ void qemu_vfree(void *ptr);
> #define QEMU_MADV_DONTNEED QEMU_MADV_INVALID
> #define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
> #define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
> +#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
>
> #endif
>
> diff --git a/qemu-config.c b/qemu-config.c
> index 5c3296b..5c2c9a9 100644
> --- a/qemu-config.c
> +++ b/qemu-config.c
> @@ -595,6 +595,10 @@ static QemuOptsList qemu_machine_opts = {
> .name = "dt_compatible",
> .type = QEMU_OPT_STRING,
> .help = "Overrides the \"compatible\" property of the dt root node",
> + }, {
> + .name = "dump_guest_core",
"dump-guest-core"
> + .type = QEMU_OPT_BOOL,
> + .help = "Include guest memory in a core dump",
> },
> { /* End of list */ }
> },
> diff --git a/qemu-options.hx b/qemu-options.hx
> index dc68e15..e917829 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -33,7 +33,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
> " property accel=accel1[:accel2[:...]] selects accelerator\n"
> " supported accelerators are kvm, xen, tcg (default: tcg)\n"
> " kernel_irqchip=on|off controls accelerated irqchip support\n"
> - " kvm_shadow_mem=size of KVM shadow MMU\n",
> + " kvm_shadow_mem=size of KVM shadow MMU\n"
> + " dump_guest_core=on|off include guest memory in a core dump (default=on)\n",
> QEMU_ARCH_ALL)
> STEXI
> @item -machine [type=]@var{name}[,prop=@var{value}[,...]]
> @@ -50,6 +51,8 @@ to initialize.
> Enables in-kernel irqchip support for the chosen accelerator when available.
> @item kvm_shadow_mem=size
> Defines the size of the KVM shadow MMU.
> +@item dump_guest_core=on|off
> +Include guest memory in a core dump. The default is on.
> @end table
> ETEXI
>
> diff --git a/sysemu.h b/sysemu.h
> index 6540c79..caf33ce 100644
> --- a/sysemu.h
> +++ b/sysemu.h
> @@ -132,6 +132,7 @@ extern uint8_t *boot_splash_filedata;
> extern int boot_splash_filedata_size;
> extern uint8_t qemu_extra_params_fw[2];
> extern QEMUClock *rtc_clock;
> +extern int dont_dump_guest_core;
>
> #define MAX_NODES 64
> extern int nb_numa_nodes;
> diff --git a/vl.c b/vl.c
> index c18bb80..accfd28 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -226,6 +226,7 @@ int boot_menu;
> uint8_t *boot_splash_filedata;
> int boot_splash_filedata_size;
> uint8_t qemu_extra_params_fw[2];
> +int dont_dump_guest_core;
Drop the globals.
>
> typedef struct FWBootEntry FWBootEntry;
>
> @@ -2976,6 +2977,9 @@ int main(int argc, char **argv, char **envp)
> if (optarg) {
> machine = machine_parse(optarg);
> }
> + if (!qemu_opt_get_bool(opts, "dump_guest_core", true)) {
> + dont_dump_guest_core = 1;
> + }
> break;
The -machine option is not the only way to set machine options so this
is incorrect. But if you do what I suggest above, you can just drop
this whole bit and not worry about it.
Regards,
Anthony Liguori
> case QEMU_OPTION_usb:
> usb_enabled = 1;
> --
> 1.7.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v2] memory: add cmd line option, to omit guest memory from qemu core dump
2012-08-01 18:21 ` Anthony Liguori
@ 2012-08-01 18:28 ` Jason Baron
2012-08-01 18:54 ` Anthony Liguori
2012-08-02 18:05 ` Luiz Capitulino
1 sibling, 1 reply; 5+ messages in thread
From: Jason Baron @ 2012-08-01 18:28 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-devel, mtosatti, eblake, avi, armbru
On Wed, Aug 01, 2012 at 01:21:57PM -0500, Anthony Liguori wrote:
> Jason Baron <jbaron@redhat.com> writes:
>
> > Add a new '[,dump_guest_core=on|off]' option to the '-machine' option. When
> > 'dump_guest_core=off' is specified, guest memory is omitted from the core dump.
> > The default behavior continues to be to include guest memory when a core dump is
> > triggered. In my testing, this brought the core dump size down from 384MB to 6MB
> > on a 2GB guest.
> >
> > Changelog:
> > v2: move the option from -m to -machine, rename option dump -> dump_guest_core
> >
> > Signed-off-by: Jason Baron <jbaron@redhat.com>
> > ---
> > exec.c | 13 +++++++++++++
> > osdep.h | 7 +++++++
> > qemu-config.c | 4 ++++
> > qemu-options.hx | 5 ++++-
> > sysemu.h | 1 +
> > vl.c | 4 ++++
> > 6 files changed, 33 insertions(+), 1 deletions(-)
> >
> > diff --git a/exec.c b/exec.c
> > index feb4795..0764818 100644
> > --- a/exec.c
> > +++ b/exec.c
> > @@ -35,6 +35,7 @@
> > #include "qemu-timer.h"
> > #include "memory.h"
> > #include "exec-memory.h"
> > +#include "sysemu.h"
> > #if defined(CONFIG_USER_ONLY)
> > #include <qemu.h>
> > #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
> > @@ -2514,6 +2515,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
> > MemoryRegion *mr)
> > {
> > RAMBlock *new_block;
> > + int ret;
> >
> > size = TARGET_PAGE_ALIGN(size);
> > new_block = g_malloc0(sizeof(*new_block));
> > @@ -2555,6 +2557,17 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
> > last_ram_offset() >> TARGET_PAGE_BITS);
> > cpu_physical_memory_set_dirty_range(new_block->offset, size, 0xff);
> >
> > +
> > + /* Use MADV_DONTDUMP, if user doesn't want the guest memory in the core */
> > + if (dont_dump_guest_core) {
>
> machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
> if (machine_opts && qemu_opt_get_bool(machine_opts, "dump-guest-core")) {
>
should be:
... && !qemu_opt_get_bool(machine_opts, "dump-guest-core", true)
??
> > + ret = qemu_madvise(new_block->host, size, QEMU_MADV_DONTDUMP);
> > + if (ret) {
> > + perror("qemu_madvise");
> > + fprintf(stderr, "madvise doesn't support MADV_DONTDUMP, "
> > + "but dump_guest_core=off specified\n");
> > + }
> > + }
> > +
> > if (kvm_enabled())
> > kvm_setup_guest_memory(new_block->host, size);
> >
> > diff --git a/osdep.h b/osdep.h
> > index 1e15a4b..e2d0f57 100644
> > --- a/osdep.h
> > +++ b/osdep.h
> > @@ -102,6 +102,11 @@ void qemu_vfree(void *ptr);
> > #else
> > #define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
> > #endif
> > +#ifdef MADV_DONTDUMP
> > +#define QEMU_MADV_DONTDUMP MADV_DONTDUMP
> > +#else
> > +#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
> > +#endif
> >
> > #elif defined(CONFIG_POSIX_MADVISE)
> >
> > @@ -109,6 +114,7 @@ void qemu_vfree(void *ptr);
> > #define QEMU_MADV_DONTNEED POSIX_MADV_DONTNEED
> > #define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
> > #define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
> > +#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
> >
> > #else /* no-op */
> >
> > @@ -116,6 +122,7 @@ void qemu_vfree(void *ptr);
> > #define QEMU_MADV_DONTNEED QEMU_MADV_INVALID
> > #define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
> > #define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
> > +#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
> >
> > #endif
> >
> > diff --git a/qemu-config.c b/qemu-config.c
> > index 5c3296b..5c2c9a9 100644
> > --- a/qemu-config.c
> > +++ b/qemu-config.c
> > @@ -595,6 +595,10 @@ static QemuOptsList qemu_machine_opts = {
> > .name = "dt_compatible",
> > .type = QEMU_OPT_STRING,
> > .help = "Overrides the \"compatible\" property of the dt root node",
> > + }, {
> > + .name = "dump_guest_core",
>
> "dump-guest-core"
>
ok.
> > + .type = QEMU_OPT_BOOL,
> > + .help = "Include guest memory in a core dump",
> > },
> > { /* End of list */ }
> > },
> > diff --git a/qemu-options.hx b/qemu-options.hx
> > index dc68e15..e917829 100644
> > --- a/qemu-options.hx
> > +++ b/qemu-options.hx
> > @@ -33,7 +33,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
> > " property accel=accel1[:accel2[:...]] selects accelerator\n"
> > " supported accelerators are kvm, xen, tcg (default: tcg)\n"
> > " kernel_irqchip=on|off controls accelerated irqchip support\n"
> > - " kvm_shadow_mem=size of KVM shadow MMU\n",
> > + " kvm_shadow_mem=size of KVM shadow MMU\n"
> > + " dump_guest_core=on|off include guest memory in a core dump (default=on)\n",
> > QEMU_ARCH_ALL)
> > STEXI
> > @item -machine [type=]@var{name}[,prop=@var{value}[,...]]
> > @@ -50,6 +51,8 @@ to initialize.
> > Enables in-kernel irqchip support for the chosen accelerator when available.
> > @item kvm_shadow_mem=size
> > Defines the size of the KVM shadow MMU.
> > +@item dump_guest_core=on|off
> > +Include guest memory in a core dump. The default is on.
> > @end table
> > ETEXI
> >
> > diff --git a/sysemu.h b/sysemu.h
> > index 6540c79..caf33ce 100644
> > --- a/sysemu.h
> > +++ b/sysemu.h
> > @@ -132,6 +132,7 @@ extern uint8_t *boot_splash_filedata;
> > extern int boot_splash_filedata_size;
> > extern uint8_t qemu_extra_params_fw[2];
> > extern QEMUClock *rtc_clock;
> > +extern int dont_dump_guest_core;
> >
> > #define MAX_NODES 64
> > extern int nb_numa_nodes;
> > diff --git a/vl.c b/vl.c
> > index c18bb80..accfd28 100644
> > --- a/vl.c
> > +++ b/vl.c
> > @@ -226,6 +226,7 @@ int boot_menu;
> > uint8_t *boot_splash_filedata;
> > int boot_splash_filedata_size;
> > uint8_t qemu_extra_params_fw[2];
> > +int dont_dump_guest_core;
>
> Drop the globals.
>
ok.
> >
> > typedef struct FWBootEntry FWBootEntry;
> >
> > @@ -2976,6 +2977,9 @@ int main(int argc, char **argv, char **envp)
> > if (optarg) {
> > machine = machine_parse(optarg);
> > }
> > + if (!qemu_opt_get_bool(opts, "dump_guest_core", true)) {
> > + dont_dump_guest_core = 1;
> > + }
> > break;
>
> The -machine option is not the only way to set machine options so this
> is incorrect. But if you do what I suggest above, you can just drop
> this whole bit and not worry about it.
>
ok. oops.
Thanks,
-Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v2] memory: add cmd line option, to omit guest memory from qemu core dump
2012-08-01 18:28 ` Jason Baron
@ 2012-08-01 18:54 ` Anthony Liguori
0 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2012-08-01 18:54 UTC (permalink / raw)
To: Jason Baron; +Cc: qemu-devel, mtosatti, eblake, avi, armbru
Jason Baron <jbaron@redhat.com> writes:
> On Wed, Aug 01, 2012 at 01:21:57PM -0500, Anthony Liguori wrote:
>> Jason Baron <jbaron@redhat.com> writes:
>>
>> > Add a new '[,dump_guest_core=on|off]' option to the '-machine' option. When
>> > 'dump_guest_core=off' is specified, guest memory is omitted from the core dump.
>> > The default behavior continues to be to include guest memory when a core dump is
>> > triggered. In my testing, this brought the core dump size down from 384MB to 6MB
>> > on a 2GB guest.
>> >
>> > Changelog:
>> > v2: move the option from -m to -machine, rename option dump -> dump_guest_core
>> >
>> > Signed-off-by: Jason Baron <jbaron@redhat.com>
>> > ---
>> > exec.c | 13 +++++++++++++
>> > osdep.h | 7 +++++++
>> > qemu-config.c | 4 ++++
>> > qemu-options.hx | 5 ++++-
>> > sysemu.h | 1 +
>> > vl.c | 4 ++++
>> > 6 files changed, 33 insertions(+), 1 deletions(-)
>> >
>> > diff --git a/exec.c b/exec.c
>> > index feb4795..0764818 100644
>> > --- a/exec.c
>> > +++ b/exec.c
>> > @@ -35,6 +35,7 @@
>> > #include "qemu-timer.h"
>> > #include "memory.h"
>> > #include "exec-memory.h"
>> > +#include "sysemu.h"
>> > #if defined(CONFIG_USER_ONLY)
>> > #include <qemu.h>
>> > #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
>> > @@ -2514,6 +2515,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
>> > MemoryRegion *mr)
>> > {
>> > RAMBlock *new_block;
>> > + int ret;
>> >
>> > size = TARGET_PAGE_ALIGN(size);
>> > new_block = g_malloc0(sizeof(*new_block));
>> > @@ -2555,6 +2557,17 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
>> > last_ram_offset() >> TARGET_PAGE_BITS);
>> > cpu_physical_memory_set_dirty_range(new_block->offset, size, 0xff);
>> >
>> > +
>> > + /* Use MADV_DONTDUMP, if user doesn't want the guest memory in the core */
>> > + if (dont_dump_guest_core) {
>>
>> machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
>> if (machine_opts && qemu_opt_get_bool(machine_opts, "dump-guest-core")) {
>>
>
> should be:
>
> ... && !qemu_opt_get_bool(machine_opts, "dump-guest-core", true)
>
> ??
Yes.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v2] memory: add cmd line option, to omit guest memory from qemu core dump
2012-08-01 18:21 ` Anthony Liguori
2012-08-01 18:28 ` Jason Baron
@ 2012-08-02 18:05 ` Luiz Capitulino
1 sibling, 0 replies; 5+ messages in thread
From: Luiz Capitulino @ 2012-08-02 18:05 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Jason Baron, mtosatti, qemu-devel, armbru, avi, eblake
On Wed, 01 Aug 2012 13:21:57 -0500
Anthony Liguori <anthony@codemonkey.ws> wrote:
> > diff --git a/qemu-config.c b/qemu-config.c
> > index 5c3296b..5c2c9a9 100644
> > --- a/qemu-config.c
> > +++ b/qemu-config.c
> > @@ -595,6 +595,10 @@ static QemuOptsList qemu_machine_opts = {
> > .name = "dt_compatible",
> > .type = QEMU_OPT_STRING,
> > .help = "Overrides the \"compatible\" property of the dt root node",
> > + }, {
> > + .name = "dump_guest_core",
>
> "dump-guest-core"
Without your patch to accept both "-" and "_", this will be inconsistent
with the other options.
It's not like I mind too much, but then my patch adding mem-merge could
also be applied (Jan objected because of -/_ mixture).
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-02 18:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-01 16:19 [Qemu-devel] [PATCH v2] memory: add cmd line option, to omit guest memory from qemu core dump Jason Baron
2012-08-01 18:21 ` Anthony Liguori
2012-08-01 18:28 ` Jason Baron
2012-08-01 18:54 ` Anthony Liguori
2012-08-02 18:05 ` Luiz Capitulino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).