Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NlfDV-0000ZA-Uz for qemu-devel@nongnu.org; Sun, 28 Feb 2010 04:13:38 -0500 Received: from [199.232.76.173] (port=60223 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NlfDV-0000Yz-7f for qemu-devel@nongnu.org; Sun, 28 Feb 2010 04:13:37 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NlfDU-00084m-Bx for qemu-devel@nongnu.org; Sun, 28 Feb 2010 04:13:37 -0500 Received: from mail-bw0-f218.google.com ([209.85.218.218]:33863) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NlfDU-00084W-14 for qemu-devel@nongnu.org; Sun, 28 Feb 2010 04:13:36 -0500 Received: by bwz10 with SMTP id 10so1038492bwz.2 for ; Sun, 28 Feb 2010 01:13:34 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1267038612-21581-1-git-send-email-aliguori@us.ibm.com> References: <1267038612-21581-1-git-send-email-aliguori@us.ibm.com> Date: Sun, 28 Feb 2010 09:13:34 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH] pc: madvise(MADV_DONTNEED) memory on reset From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org On Wed, Feb 24, 2010 at 7:10 PM, Anthony Liguori wrot= e: > This patch addresses this issue by using madvise() during reset. =A0It on= ly > resets RAM areas which means it has to be done in the machine. =A0I've on= ly done > this for the x86 target because I'm fairly confident that this is allowed > architecturally on x86 although I'm not sure this is universely true. > > This does not appear to have an observable cost with a large memory guest= and > I can't really think of any down sides. Preserving the contents of memory across reboot seems to be common on real x86 hardware. (Even if you hard power off and on again quickly.) This behavior is useful for crash analysis. I use it as a tool for debugging gPXE both on real hardware and under QEMU for example: http://git.etherboot.org/?p=3Dpeople/stefanha/gpxe.git;a=3Dcommitdiff;h=3D6= 7344d8c3adca51658e1b8a80541a16e9f693a8d posix_madvise() is fine but Linux MADV_DONTNEED will prevent this sort of tool from working. Would it be possible to make this configurable in some way? I can imagine doing something like: qemu> system_reset -preserve Stefan