<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Isaku Yamahata wrote:
<blockquote TYPE=CITE>Hi Dave.
<br>I think I can explain it.
<p>Sometimes xen needs to share pages with dom0.
<br>For example shared_info, grant table pages, another domain's pages
<br>and etc.
<br>In such a case, Xen/IA64 puts those pages in the dom0 pseudo physical
<br>addresses space, i.e. it updates dom0 p2m table, thus dom0 can
<br>access those pages.
<br>Pseudo physical addresses are predefined or given by xen or dom0.
<br>Currently shared_info is assigned at pseudo physical address
<br>of 1UL << 40 = 1TB.
<br>This corresponds to the following entry.
<br>>     f00000007d8b0080:  000000007f428000
0000000000000000   ..B.............
<p>Dom0 controls devices so that it needs to access I/O area.
<br>For that purpose, dom0 p2m table has the entry which points I/O area
<br>such that dom0 pseudo physical address = machine address.
<br>I guess that the following entry corresponds to I/O area.
<br>>     f00000007d8b07f0:  0000000000000000
000000007bed4000   .........@.{....
<br>In order to confirm this, The native linux's /proc/iomem is necessary.
<p>thanks.
<br> </blockquote>
<tt>OK, thanks for that explanation...</tt><tt></tt>
<p><tt>It *still* seems to be a huge waste of memory.  Taking the</tt>
<br><tt>example dump, the 1GB of "normal" memory requires 32 p2m_mfn</tt>
<br><tt>values for address translation, plus -- if I understand you</tt>
<br><tt>correctly -- 1 for the shared_info, plus 1 for the I/O area.</tt>
<br><tt>That's a total of 34 8-byte values, or 272 bytes.  Whereas</tt>
<br><tt>this first patch uses 524288 entries, or 4MB of memory.</tt>
<br><tt>It seems to me there should be a better way to handle it,</tt>
<br><tt>even if those two particular pseudo-physical regions are</tt>
<br><tt>"special-cased" for ia64.</tt><tt></tt>
<p><tt>But, in any case, Itsuro, can you do what is possible with</tt>
<br><tt>your patch, and re-submit it?</tt><tt></tt>
<p><tt>Thanks guys,</tt>
<br><tt>  Dave</tt>
<br><tt></tt> 
<blockquote TYPE=CITE> 
<br>On Fri, May 11, 2007 at 10:02:39AM -0400, Dave Anderson wrote:
<br>> Itsuro ODA wrote:
<br>>
<br>>     Hi Dave,
<br>>
<br>>     > This all sounds good, and I agree that
the p2m_mfn should
<br>>     > be added to the ia64 XEN_ELFNOTE_CRASH_INFO.
<br>>     >
<br>>     > However, there's something incorrect in
your calculation of
<br>>     > "xkd->p2m_frames" in your ia64_xen_kdump_p2m_create()
implementation.
<br>>     > It looks like it should be 32, but it's
set to 524288.  As a result
<br>>     > that wastes a lot of memory, and "help
-n" is pretty much unusable
<br>>     > since wants to dump all ~512k entries:
<br>>
<br>>     This is because IA64's pseudo-physical memory
map (domain on xen
<br>>     specific).
<br>>
<br>>     phys-to-machine mapping is managed as 3-level
page table.
<br>>     pgd looks like:
<br>>     -------------------------------------------------------------
<br>>     crash> doms
<br>>        DID      
DOMAIN      ST T  MAXPAGE  TOTPAGE VCPU    
SHARED_I
<br>>     P2M_MFN
<br>>       32753 f000000007dac080 ?? O    
0        0     
0          0
<br>>     ----
<br>>       32754 f000000007ff0080 ?? X    
0        0     
0          0
<br>>     ----
<br>>       32767 f000000007ff4080 ?? I    
0        0     
1          0
<br>>     ----
<br>>     >*    0 f000000007da4080 ??
0   10000    f986     1 
f000000007d90000
<br>>     1f62c
<br>>
<br>>     crash> domain f000000007da4080
<br>>     struct domain {
<br>>       domain_id = 0,
<br>>       shared_info = 0xf000000007d90000,
<br>>     ...
<br>>       arch = {
<br>>         mm = {
<br>>           pgd =
0xf00000007d8b0000
<br>>         },
<br>>     ...
<br>>     crash> rd 0xf00000007d8b0000 256
<br>>     f00000007d8b0000:  000000007c8d8000
0000000000000000   ...|............
<br>>     f00000007d8b0010:  0000000000000000
0000000000000000   ................
<br>>     f00000007d8b0020:  0000000000000000
0000000000000000   ................
<br>>     f00000007d8b0030:  0000000000000000
0000000000000000   ................
<br>>     f00000007d8b0040:  0000000000000000
0000000000000000   ................
<br>>     f00000007d8b0050:  0000000000000000
0000000000000000   ................
<br>>     f00000007d8b0060:  0000000000000000
0000000000000000   ................
<br>>     f00000007d8b0070:  0000000000000000
0000000000000000   ................
<br>>     f00000007d8b0080:  000000007f428000
0000000000000000   ..B.............
<br>>     f00000007d8b0090:  0000000000000000
0000000000000000   ................
<br>>     ...
<br>>     f00000007d8b07c0:  0000000000000000
0000000000000000   ................
<br>>     f00000007d8b07d0:  0000000000000000
0000000000000000   ................
<br>>     f00000007d8b07e0:  0000000000000000
0000000000000000   ................
<br>>     f00000007d8b07f0:  0000000000000000
000000007bed4000   .........@.{....
<br>>     -------------------------------------------------------------------------
<br>>     (256 * 2048 = 524288)
<br>>
<br>>     It is certain that (pseudo-)physical memory
"256GB-" and "-4TB" exits.
<br>>     These area are shared by domain-0 and xen
hypervisor.
<br>>     These area should be accessed in dom0's analysis
session.
<br>>
<br>>     (I said:)
<br>>     > > But this patch is a bit tricky. And the
memory usage is
<br>>     > > large if the machine memory layout is
sparse.
<br>>
<br>>     It is wrong. This should be "the memory usage
is large if
<br>>     pseudo-physical memory layout is sparse."
<br>>     And it is always sparse actually...
<br>>
<br>>     Thanks.
<br>>
<br>>
<br>> Hi Itsuro,
<br>>
<br>> I now understand the difference in the 3rd-level p2m
<br>> frame contents being page table entries instead of mfn
<br>> values.
<br>>
<br>> However, I still do not understand what you mean regarding
<br>> the concept of the pseudo-physical memory being "sparse".
<br>> Looking at the dumpfile again, it appears to have the same
<br>> type of flat pseudo-physical memory layout just like the
<br>> other architectures.
<br>>
<br>> Dom0 has ~1GB of pseudo-physical memory:
<br>>
<br>> crash> sys
<br>>       KERNEL: ../20070510-sample-dump-2/vmlinux-xen-ia64
<br>>     DUMPFILE: ../20070510-sample-dump-2/vmcore.tiger.iomem_machine
<br>>         CPUS: 1
<br>>         DATE: Mon May 
7 04:07:43 2007
<br>>       UPTIME: 00:01:47
<br>> LOAD AVERAGE: 0.11, 0.04, 0.01
<br>>        TASKS: 21
<br>>     NODENAME: (none)
<br>>      RELEASE: 2.6.18-xen
<br>>      VERSION: #3 SMP Mon May 7 13:14:41
JST 2007
<br>>      MACHINE: ia64  (1296 Mhz)
<br>>       MEMORY: 1 GB
<br>>        PANIC: "SysRq : Trigger
a crashdump"
<br>> crash>
<br>>
<br>> And as far as dom0's VM is concerned, its memory map only knows
<br>> about the 64512 pages in DMA zone 0:
<br>>
<br>> crash> kmem -n
<br>> NODE    SIZE      PGLIST_DATA      
BOOTMEM_DATA       NODE_ZONES
<br>>   0    64512    a000000100482f80 
a000000100608950  a000000100482f80
<br>>                                                    
a000000100483500
<br>>                                                    
a000000100483a80
<br>>                                                    
a000000100484000
<br>>     MEM_MAP      
START_PADDR  START_MAPNR
<br>> e0000000010b0000       0           
0
<br>>
<br>> ZONE  NAME         SIZE      
MEM_MAP      START_PADDR  START_MAPNR
<br>>   0   DMA        
64512  e0000000010b0000           
0            0
<br>>   1   DMA32          
0                
0            0           
0
<br>>   2   Normal         
0                
0            0           
0
<br>>   3   HighMem        
0                
0            0           
0
<br>> crash>
<br>>
<br>> So the "end of memory" would be just below 1GB:
<br>>
<br>> crash> eval 64512 * 16k
<br>> hexadecimal: 3f000000  (1008MB)
<br>>     decimal: 1056964608
<br>>       octal: 7700000000
<br>>      binary: 0000000000000000000000000000000000111111000000000000000000000000
<br>> crash>
<br>>
<br>> So, with respect to dom0, how would it ever go beyond 32
<br>> p2m_frames?  Putting a debug printf in xen_kdump_p2m, it
<br>> shows this:
<br>>
<br>> crash> rd -p 3f000000
<br>> xen_kdump_p2m: mfn_idx for 3f000000: 31
<br>>         3f000000:  0000000000000000                   
........
<br>> crash>
<br>>
<br>> So that shows that there only needs to be 32 p2m_frames
<br>> for accessing all of dom0 pseudo-physical memory.
<br>>
<br>> But it also shows that you are allowing access to memory
<br>> that is *beyond* the end of dom0 pseudo-physical memory,
<br>> since 3f000000 should not be readable.  There is not a
<br>> page structure associated with 3f000000:
<br>>
<br>> crash> kmem -p | tail
<br>> e000000001421dd0 3efd8000      -------      
-----   1 0
<br>> e000000001421e08 3efdc000      -------      
-----   1 0
<br>> e000000001421e40 3efe0000      -------      
-----   1 60
<br>> e000000001421e78 3efe4000      -------      
-----   1 60
<br>> e000000001421eb0 3efe8000      -------      
-----   1 60
<br>> e000000001421ee8 3efec000      -------      
-----   1 60
<br>> e000000001421f20 3eff0000      -------      
-----   2 0
<br>> e000000001421f58 3eff4000      -------      
-----   1 80
<br>> e000000001421f90 3eff8000      -------      
-----   1 80
<br>> e000000001421fc8 3effc000      -------      
-----   1 80
<br>> crash>
<br>>
<br>> By doing few other "rd -p" commands, I see that you seem
<br>> to be allowing memory accesses based upon what's in the ELF
<br>> header PT_LOAD segments, which are "machine" physical memory
<br>> descriptors:
<br>>
<br>> crash> help -n | grep phys_end
<br>>               
phys_end: 1000
<br>>               
phys_end: 7000
<br>>               
phys_end: 9000
<br>>               
phys_end: 82000
<br>>               
phys_end: 85000
<br>>               
phys_end: a0000
<br>>               
phys_end: 4000000
<br>>               
phys_end: 81b3000
<br>>               
phys_end: ffc0000
<br>>               
phys_end: 10000000
<br>>               
phys_end: 7ab06000
<br>>               
phys_end: 7c8d2000
<br>>               
phys_end: 7c92e000
<br>>               
phys_end: 7c938000
<br>>               
phys_end: 7c97e000
<br>>               
phys_end: 7cdf6000
<br>>               
phys_end: 7cdfc000
<br>>               
phys_end: 7ce2a000
<br>>               
phys_end: 7d001000
<br>>               
phys_end: 7d002000
<br>>               
phys_end: 7d044000
<br>>               
phys_end: 7d045000
<br>>               
phys_end: 7d37e000
<br>>               
phys_end: 7d700000
<br>>               
phys_end: 7d77e000
<br>>               
phys_end: 7d8b4000
<br>>               
phys_end: 7f980000
<br>>               
phys_end: 7fa00000
<br>>               
phys_end: 7feda000
<br>> crash>
<br>>
<br>> So it appears that the physical machine running the
<br>> dom0 and hypervisor has almost 2GB of "real" physical
<br>> memory.  And if I try to read the limit address of
<br>> 7feda000, it fails:
<br>>
<br>> crash> rd -p 7feda000
<br>> xen_kdump_p2m: mfn_idx for 7feda000: 63
<br>> rd: read error: physical address: 7feda000  type: "64-bit PHYSADDR"
<br>> crash>
<br>>
<br>> But the last page of physical memory can be read:
<br>>
<br>> crash> rd -p 7fed9000
<br>> xen_kdump_p2m: mfn_idx for 7fed9000: 63
<br>>         7fed9000:  000000007f9da0a0                   
........
<br>> crash>
<br>>
<br>> "rd -p" is supposed to read pseudo-physical memory in xen
<br>> kernels, but it seems to be allowing reads based upon the
<br>> PT_LOAD segment contents?  In other words, it seems to
<br>> be mixing dom0 pseudo-physical memory and the system's
<br>> machine memory, because 7fed9000 is not a legitimate dom0
<br>> pseudo-physical address.
<br>>
<br>> (And even with that happening, the maximum p2m_frame index
<br>> is still only 63 -- how can it ever be 512k with respect
<br>> to dom0's pseudo-physical memory?)
<br>>
<br>> So I'm sorry, but this does not make sense to me...
<br>>
<br>> Dave
<br>>
<br>>
<br>>
<p>> --
<br>> Crash-utility mailing list
<br>> Crash-utility@redhat.com
<br>> <a href="https://www.redhat.com/mailman/listinfo/crash-utility">https://www.redhat.com/mailman/listinfo/crash-utility</a>
<p>--
<br>yamahata
<p>--
<br>Crash-utility mailing list
<br>Crash-utility@redhat.com
<br><a href="https://www.redhat.com/mailman/listinfo/crash-utility">https://www.redhat.com/mailman/listinfo/crash-utility</a></blockquote>
</html>