From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Swe4H-0001B2-1V for qemu-devel@nongnu.org; Wed, 01 Aug 2012 14:54:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Swe4F-0004b3-SZ for qemu-devel@nongnu.org; Wed, 01 Aug 2012 14:54:48 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:53463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Swe4F-0004ar-Nd for qemu-devel@nongnu.org; Wed, 01 Aug 2012 14:54:47 -0400 Received: by obbta14 with SMTP id ta14so11902128obb.4 for ; Wed, 01 Aug 2012 11:54:47 -0700 (PDT) From: Anthony Liguori In-Reply-To: <20120801182811.GA25130@redhat.com> References: <201208011619.q71GJSqg017150@int-mx01.intmail.prod.int.phx2.redhat.com> <877gti8oca.fsf@codemonkey.ws> <20120801182811.GA25130@redhat.com> Date: Wed, 01 Aug 2012 13:54:44 -0500 Message-ID: <87ipd25tor.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH v2] memory: add cmd line option, to omit guest memory from qemu core dump List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Baron Cc: qemu-devel@nongnu.org, mtosatti@redhat.com, eblake@redhat.com, avi@redhat.com, armbru@redhat.com Jason Baron writes: > On Wed, Aug 01, 2012 at 01:21:57PM -0500, Anthony Liguori wrote: >> Jason Baron 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 >> > --- >> > 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 >> > #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