All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikhail Ilin <m.ilin@samsung.com>
To: qemu-devel@nongnu.org,
	"y >> 'Yury Gribov'" <y.gribov@samsung.com>,
	Slava Garbuzov <v.garbuzov@samsung.com>
Cc: peter.maydell@linaro.org, pbonzini@redhat.com, mst@redhat.com,
	afaerber@suse.de, rth@twiddle.net
Subject: [Qemu-devel] Fix a bug in debug printing of memory translation tables
Date: Wed, 23 Jul 2014 14:55:18 +0400	[thread overview]
Message-ID: <53CF9496.1030107@samsung.com> (raw)

Hi,

I've enabled DEBUG_MMAP in linux-user/mmap.c and got debug info of memory
layout.

This is the debug output of guest memory layout from qemu (including
the last mmap call marked with *).

mmap: start=0x0804a000 len=0x00021000 prot=rw- flags=MAP_ANON 
MAP_PRIVATE fd=0 offset=00000000
ret=0x0804a000
   start    end      size     prot
   00048000-00049000 00001000 r-x
* 00049000-0006b000 00022000 rw-
   002f6400-002f7400 00001000 rw-
   002f7400-003ff400 00108000 r-x
   003ff400-003ff400 00000000 r--
   003ff400-003f6400 ffff7000 rw-
   003fe400-003ff400 00001000 rw-
   003ff400-003ff400 00000000 r-x
   003ff400-003fe400 fffff000 r--
   003fe400-003ff400 00001000 rw-
   003ff400-000f6800 ffcf7400 ---
   000f6800-000f7000 00000800 rw-

It looks completely insane with weird records where the start is bigger
than the end, the size is likely negative and in general all addresses are
in wrong boundaries.

Found a bug in the function which textualize memory translation tables. Made
a fix. Now I have the following output:

mmap: start=0x0804a000 len=0x00021000 prot=rw- flags=MAP_ANON 
MAP_PRIVATE fd=0 offset=00000000
ret=0x0804a000
   start    end      size     prot
   08048000-08049000 00001000 r-x
* 08049000-0806b000 00022000 rw-
   f6612000-f6615000 00003000 rw-
   f6615000-f67bb000 001a6000 r-x
   f67bb000-f67bd000 00002000 r--
   f67bd000-f67c2000 00005000 rw-
   f67da000-f67dd000 00003000 rw-
   f67dd000-f67fd000 00020000 r-x
   f67fd000-f67fe000 00001000 r--
   f67fe000-f67ff000 00001000 rw-
   f67ff000-f6800000 00001000 ---

This looks much better.

 From 297045c6e7da0089c6ea4ee271000c507c5a8bf8 Mon Sep 17 00:00:00 2001
From: Mikhail Ilyin <m.ilin@samsung.com>
Date: Wed, 23 Jul 2014 13:06:15 +0400
Subject: [PATCH] Fix a bug in debug printing of memory translation tables.

Signed-off-by: Mikhail Ilyin <m.ilin@samsung.com>
---
  translate-all.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/translate-all.c b/translate-all.c
index 8f7e11b..cb7a33d 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -1728,9 +1728,8 @@ int walk_memory_regions(void *priv, 
walk_memory_regions_fn fn)
      data.prot = 0;

      for (i = 0; i < V_L1_SIZE; i++) {
-        int rc = walk_memory_regions_1(&data, (abi_ulong)i << V_L1_SHIFT,
+        int rc = walk_memory_regions_1(&data, (abi_ulong)i << 
(V_L1_SHIFT + TARGET_PAGE_BITS),
                                         V_L1_SHIFT / V_L2_BITS - 1, 
l1_map + i);
-
          if (rc != 0) {
              return rc;
          }
-- 
1.9.1

             reply	other threads:[~2014-07-23 10:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 10:55 Mikhail Ilin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-08-05  5:40 [Qemu-devel] Fix a bug in debug printing of memory translation tables Mikhail Ilin

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=53CF9496.1030107@samsung.com \
    --to=m.ilin@samsung.com \
    --cc=afaerber@suse.de \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=v.garbuzov@samsung.com \
    --cc=y.gribov@samsung.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.