qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away
Date: Mon, 22 Jun 2009 21:04:34 +0300	[thread overview]
Message-ID: <4A3FC7B2.20503@redhat.com> (raw)
In-Reply-To: <4A3FC30E.5030804@us.ibm.com>

On 06/22/2009 08:44 PM, Anthony Liguori wrote:
> See attached.
> Author: Anthony Liguori<aliguori@us.ibm.com>
> Date:   Mon Jun 22 12:39:00 2009 -0500
>
>      Make sure to zero out memory before calling madvise to increase robustness
>
>      Avi pointed out that it's not entirely safe to rely on madvise zeroing out
>      memory.  So let's do it explicitly before calling madvise.
>
>      Signed-off-by: Anthony Liguori<aliguori@us.ibm.com>
>
> diff --git a/vl.c b/vl.c
> index 60a00e1..1c077b4 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3358,13 +3358,13 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
>
>           if (flags&  RAM_SAVE_FLAG_COMPRESS) {
>               uint8_t ch = qemu_get_byte(f);
> -#if defined(__linux__)
> +            memset(qemu_get_ram_ptr(addr), ch, TARGET_PAGE_SIZE);
> +#ifndef _WIN32
>               if (ch == 0&&
>                   (!kvm_enabled() || kvm_has_sync_mmu())) {
>                   madvise(qemu_get_ram_ptr(addr), TARGET_PAGE_SIZE, MADV_DONTNEED);
> -            } else
> +            }
>   #endif
> -            memset(qemu_get_ram_ptr(addr), ch, TARGET_PAGE_SIZE);
>           } else if (flags&  RAM_SAVE_FLAG_PAGE)
>               qemu_get_buffer(f, qemu_get_ram_ptr(addr), TARGET_PAGE_SIZE);
>       } while (!(flags&  RAM_SAVE_FLAG_EOS));
>    

Pretty similar to my December patch... which had another case, is it 
missing?

http://article.gmane.org/gmane.comp.emulators.qemu/34523

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

  reply	other threads:[~2009-06-22 18:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200906221549.n5MFn3Qd015389@d03av02.boulder.ibm.com>
2009-06-22 16:12 ` [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away Avi Kivity
2009-06-22 16:25   ` Anthony Liguori
2009-06-22 16:38     ` Avi Kivity
2009-06-22 16:58       ` Anthony Liguori
2009-06-22 17:12         ` Avi Kivity
2009-06-22 17:03       ` Anthony Liguori
2009-06-22 17:20         ` Avi Kivity
2009-06-22 17:37           ` Anthony Liguori
2009-06-22 18:01             ` Avi Kivity
2009-06-22 17:44           ` Anthony Liguori
2009-06-22 18:04             ` Avi Kivity [this message]
2009-06-22 19:38         ` Paul Brook
2009-06-22 19:49           ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A3FC7B2.20503@redhat.com \
    --to=avi@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).