qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Emilio G. Cota" <cota@braap.org>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>,
	Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH 2/2] translate-all: add missing munmap of the code_gen guard page for MIPS
Date: Thu, 21 Apr 2016 20:01:54 -0400	[thread overview]
Message-ID: <1461283314-2353-2-git-send-email-cota@braap.org> (raw)
In-Reply-To: <1461283314-2353-1-git-send-email-cota@braap.org>

Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 translate-all.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/translate-all.c b/translate-all.c
index e700399..bba9b62 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -668,39 +668,39 @@ static inline void *alloc_code_gen_buffer(void)
     buf = mmap((void *)start, size + qemu_real_host_page_size,
                PROT_NONE, flags, -1, 0);
     if (buf == MAP_FAILED) {
         return NULL;
     }
 
 #ifdef __mips__
     if (cross_256mb(buf, size)) {
         /* Try again, with the original still mapped, to avoid re-acquiring
            that 256mb crossing.  This time don't specify an address.  */
         size_t size2;
         void *buf2 = mmap(NULL, size + qemu_real_host_page_size,
                           PROT_NONE, flags, -1, 0);
         switch (buf2 != MAP_FAILED) {
         case 1:
             if (!cross_256mb(buf2, size)) {
                 /* Success!  Use the new buffer.  */
-                munmap(buf, size);
+                munmap(buf, size + qemu_real_host_page_size);
                 break;
             }
             /* Failure.  Work with what we had.  */
-            munmap(buf2, size);
+            munmap(buf2, size + qemu_real_host_page_size);
             /* fallthru */
         default:
             /* Split the original buffer.  Free the smaller half.  */
             buf2 = split_cross_256mb(buf, size);
             size2 = tcg_ctx.code_gen_buffer_size;
             if (buf == buf2) {
                 munmap(buf + size2 + qemu_real_host_page_size, size - size2);
             } else {
                 munmap(buf, size - size2);
             }
             size = size2;
             break;
         }
         buf = buf2;
     }
 #endif
 
-- 
2.5.0

  reply	other threads:[~2016-04-22  0:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22  0:01 [Qemu-devel] [PATCH 1/2] translate-all: remove redundant setting of tcg_ctx.code_gen_buffer_size Emilio G. Cota
2016-04-22  0:01 ` Emilio G. Cota [this message]
2016-04-24 22:56   ` [Qemu-devel] [PATCH 2/2] translate-all: add missing munmap of the code_gen guard page for MIPS Richard Henderson
2016-04-24 22:55 ` [Qemu-devel] [PATCH 1/2] translate-all: remove redundant setting of tcg_ctx.code_gen_buffer_size Richard Henderson

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=1461283314-2353-2-git-send-email-cota@braap.org \
    --to=cota@braap.org \
    --cc=crosthwaite.peter@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).