qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Fix a bug in debug printing of memory translation tables
@ 2014-08-05  5:40 Mikhail Ilin
  0 siblings, 0 replies; 2+ messages in thread
From: Mikhail Ilin @ 2014-08-05  5:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, pbonzini, mst, afaerber, rth

ping

http://patchwork.ozlabs.org/patch/372865/

On 23.07.2014 14:44, Mikhail Ilin wrote:
 > 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 <address@hidden>
 > 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 <address@hidden>
 > ---
 >  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;
 >          }
 >

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [Qemu-devel] Fix a bug in debug printing of memory translation tables
@ 2014-07-23 10:55 Mikhail Ilin
  0 siblings, 0 replies; 2+ messages in thread
From: Mikhail Ilin @ 2014-07-23 10:55 UTC (permalink / raw)
  To: qemu-devel, y >> 'Yury Gribov', Slava Garbuzov
  Cc: peter.maydell, pbonzini, mst, afaerber, rth

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-05  5:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-05  5:40 [Qemu-devel] Fix a bug in debug printing of memory translation tables Mikhail Ilin
  -- strict thread matches above, loose matches on Subject: below --
2014-07-23 10:55 Mikhail Ilin

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).