<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Takao Indoh wrote:
<blockquote TYPE=CITE>On Tue, 06 Feb 2007 13:52:37 -0500, Dave Anderson
wrote:
<p>>How about changing section #3 above to something like this?:
<br>>
<br>>                
*  to the section with that page
<br>>                
*/
<br>>               
if (mi->flags & ADDRESS_SPECIFIED) {
<br>>-                      
ulong pfn = mi->spec_addr >> PAGESHIFT();
<br>>+                      
ulong pfn;
<br>>+                      
physaddr_t tmp;
<br>>+
<br>>+                      
if (pg_spec) {
<br>>+                              
if (!page_to_phys(mi->spec_addr, &tmp))
<br>>+                                      
return;
<br>>+                              
pfn = tmp >> PAGESHIFT();
<br>>+                      
} else
<br>>+                              
pfn = mi->spec_addr >> PAGESHIFT();
<br>>                       
section_nr = pfn_to_section_nr(pfn);
<br>>               
}
<br>>
<p>Thanks, it looks good, but I found another problem.
<p>I applied your patch and tested kmem command.
<p>crash> kmem -p e000000105090000
<br>      PAGE       
PHYSICAL      MAPPING      
INDEX CNT FLAGS
<p>It seems kmem command entered infinite loop. It is another problem.
<br>I found page_to_phys did not return correct physical address.
<br>When mi->spec_addr is 0xe000000105090000, corresponding physical address
<br>is 0x180000000.
<p>> crash> kmem -p | grep e000000105090000
<br>> e000000105090000 180000000      -------      
-----   0 600200080000
<p>However, page_to_phys returns 0x100000000. I think page_to_phys does
not
<br>support sparsemem system.
<p>Takao Indoh</blockquote>
<tt>Yeah, something's not right.  I tested the patch on an x86_64,</tt>
<br><tt>and passed it the page addresses of the first page struct in each</tt>
<br><tt>sparsmem section, and it looks like it works OK:</tt><tt></tt>
<p><tt>crash> hex</tt>
<br><tt>output radix: 16 (hex)</tt>
<br><tt>crash> kmem -n</tt><tt></tt>
<p><tt>NODE    SIZE      PGLIST_DATA      
BOOTMEM_DATA       NODE_ZONES</tt>
<br><tt>  0    262080   ffff81000000b000 
ffffffff804a2e00  ffff81000000b000</tt>
<br><tt>                                                   
ffff81000000bb00</tt>
<br><tt>                                                   
ffff81000000c600</tt>
<br><tt>                                                   
ffff81000000d100</tt>
<br><tt>    MEM_MAP      
START_PADDR  START_MAPNR</tt>
<br><tt>ffff810009001000       0           
0</tt><tt></tt>
<p><tt>ZONE  NAME        
SIZE       MEM_MAP     
START_PADDR  START_MAPNR</tt>
<br><tt>  0   DMA         
4096  ffff810009001000           
0            0</tt>
<br><tt>  1   DMA32      257984 
ffff810009039000      1000000        
4096</tt>
<br><tt>  2   Normal         
0                
0            0           
0</tt>
<br><tt>  3   HighMem        
0                
0            0           
0</tt><tt></tt>
<p><tt>-------------------------------------------------------------------</tt><tt></tt>
<p><tt>NR      SECTION       
CODED_MEM_MAP        MEM_MAP      
PFN</tt>
<br><tt> 0  ffff810009000000  ffff810009001000  ffff810009001000 
0</tt>
<br><tt> 1  ffff810009000008  ffff810009001000  ffff8100091c1000 
8000</tt>
<br><tt> 2  ffff810009000010  ffff810009001000  ffff810009381000 
10000</tt>
<br><tt> 3  ffff810009000018  ffff810009001000  ffff810009541000 
18000</tt>
<br><tt> 4  ffff810009000020  ffff810009001000  ffff810009701000 
20000</tt>
<br><tt> 5  ffff810009000028  ffff810009001000  ffff8100098c1000 
28000</tt>
<br><tt> 6  ffff810009000030  ffff810009001000  ffff810009a81000 
30000</tt>
<br><tt> 7  ffff810009000038  ffff810009001000  ffff810009c41000 
38000</tt>
<br><tt>crash></tt><tt></tt>
<p><tt>So for each "MEM_MAP" address above, it should show its physical</tt>
<br><tt>address as the "PFN" value shifted into a physical address.</tt>
<br><tt>And that seems to work OK:</tt><tt></tt>
<p><tt>crash> kmem -p ffff810009001000 ffff8100091c1000 ffff810009381000
ffff810009541000 ffff810009701000 ffff8100098c1000 ffff810009a81000 ffff810009c41000</tt>
<br><tt>      PAGE      
PHYSICAL      MAPPING      
INDEX CNT FLAGS</tt>
<br><tt>ffff810009001000        0     
-------       -----   1 400</tt><tt></tt>
<p><tt>      PAGE      
PHYSICAL      MAPPING      
INDEX CNT FLAGS</tt>
<br><tt>ffff8100091c1000  8000000      -------      
-----   1 8080000000400</tt><tt></tt>
<p><tt>      PAGE      
PHYSICAL      MAPPING      
INDEX CNT FLAGS</tt>
<br><tt>ffff810009381000 10000000      -------      
-----   0 10080000080000</tt><tt></tt>
<p><tt>      PAGE      
PHYSICAL      MAPPING      
INDEX CNT FLAGS</tt>
<br><tt>ffff810009541000 18000000      -------      
-----   2 18080000000824</tt><tt></tt>
<p><tt>      PAGE      
PHYSICAL      MAPPING      
INDEX CNT FLAGS</tt>
<br><tt>ffff810009701000 20000000      -------      
-----   0 20080000080000</tt><tt></tt>
<p><tt>      PAGE      
PHYSICAL      MAPPING      
INDEX CNT FLAGS</tt>
<br><tt>ffff8100098c1000 28000000      -------      
-----   0 28080000080000</tt><tt></tt>
<p><tt>      PAGE      
PHYSICAL      MAPPING      
INDEX CNT FLAGS</tt>
<br><tt>ffff810009a81000 30000000      -------      
-----   1 30080000000060</tt><tt></tt>
<p><tt>      PAGE      
PHYSICAL      MAPPING      
INDEX CNT FLAGS</tt>
<br><tt>ffff810009c41000 38000000      -------      
-----   1 38080000000000</tt>
<br><tt>crash></tt><tt></tt>
<p><tt>But then if I take the last physical address on the machine,</tt>
<br><tt>for example:</tt><tt></tt>
<p><tt>crash> kmem -p | tail</tt>
<br><tt>ffff810009e00dd0 3fff6000      -------      
-----   0 0</tt>
<br><tt>ffff810009e00e08 3fff7000      -------      
-----   0 0</tt>
<br><tt>ffff810009e00e40 3fff8000      -------      
-----   0 0</tt>
<br><tt>ffff810009e00e78 3fff9000      -------      
-----   0 0</tt>
<br><tt>ffff810009e00eb0 3fffa000      -------      
-----   0 0</tt>
<br><tt>ffff810009e00ee8 3fffb000      -------      
-----   0 0</tt>
<br><tt>ffff810009e00f20 3fffc000      -------      
-----   0 0</tt>
<br><tt>ffff810009e00f58 3fffd000      -------      
-----   0 0</tt>
<br><tt>ffff810009e00f90 3fffe000      -------      
-----   0 0</tt>
<br><tt>ffff810009e00fc8 3ffff000      -------      
-----   0 0</tt>
<br><tt>crash> kmem -p ffff810009e00fc8</tt>
<br><tt>      PAGE      
PHYSICAL      MAPPING      
INDEX CNT FLAGS</tt>
<br><tt>ffff81000922a000  9e00000      -------      
-----   1 8080000000400</tt>
<br><tt>crash></tt><tt></tt>
<p><tt>...it's incorrect.  I don't see any infinite loops though.</tt><tt></tt>
<p><tt>But something's out of whack here.  I'll take a look and</tt>
<br><tt>see what I can find.</tt><tt></tt>
<p><tt>Thanks,</tt>
<br><tt>  Dave</tt>
<br><tt></tt> 
<br><tt></tt> </html>