This discussion is archived
0 Replies Latest reply: Jun 13, 2012 1:44 AM by 943360 RSS

Using MDB to map Virtual address to Physical address

943360 Newbie
Currently Being Moderated
Hi

I need some experts help here.

I am running on Solaris 64 bit version as below..

root@atrcxb946:/# uname -a
SunOS atrcxb946 5.10 Generic_147441-01 i86pc i386 i86pc

I am trying to do the below..


root@atrcxb946:/# mdb -k
Loading modules: [ unix krtld genunix specfs dtrace uppc pcplusmp cpu.generic ufs md sata sockfs ip hook neti sctp arp usba uhci fcp fctl qlc nca lofs random zfs ipc nfs sppp crypto ptm cpc fcip logindmux ]
::ps ! grep java
R 7277 3950 8 8 308 0x4a004000 fffffe919f4d58e8 java

fffffe919f4d58e8::pmap
SEG BASE SIZE RES PATH
fffffe91a04a7ea8 0000000008021000 156k 156k [ anon ]
fffffe913f02d120 0000000008050000 44k /ossrc/3pp/opt/sun/jdk/java1
fffffe919da8f7e8 000000000806a000 8k 8k /ossrc/3pp/opt/sun/jdk/java1
fffffe91a050cd88 000000000806c000 5048k 5024k [ anon ]
fffffe91a053bd88 00000000eb139000 320k 20k [ anon ]
fffffe91a0362360 00000000eb18a000 512k 4k [ anon ]
fffffe91a04b4308 00000000eb20b000 320k 16k [ anon ]
...
...
...

fffffe91a050cd88::vatopfn ======> VA of the anon block in the fourth row above.
level=0 htable=fffffe91a016d908 pte=24f440363
level=1 htable=fffffe917fcc4098 pte=a904bc027
level=2 htable=ffffffff8094b750 pte=f9644c027
level=3 htable=ffffffff8094faf8 pte=0
Virtual fffffe91a050cd88 maps Physical 24f440d88

fffffe91a016d908::print struct htable =======> Printing the Level 0 htable.
{
ht_next = 0
ht_hat = 0xffffffff80296e78
ht_vaddr = 0xfffffe91a0400000
ht_level = 0
ht_flags = 0
ht_busy = 0
ht_num_ptes = 0x200
ht_valid_cnt = 0x1fe
ht_lock_cnt = 0
ht_pfn = 0xa904bc
ht_prev = 0
ht_parent = 0xfffffe917fcc4098
ht_shares = 0
}

0xa904bc::ptable ! grep fffffe91a050c ===> Get pfn from htable and print the page table.Grep the particular VA I am looking for.
[268] va=fffffe91a050c000 PTE=24f440363: page=0x24f440 nosync global write


0x24f440::page_num2pp
24f440 has page at fffffe90c888dae0

fffffe90c888dae0::print struct page
{
p_offset = 0xfffffe91a050c000
p_vnode = kvps
p_selock = 0x1
p_vpmref = 0
p_hash = 0
p_vpnext = 0xfffffe90e18caf58
p_vpprev = 0xfffffe90d5bb5e68
p_next = 0xfffffe90c888dae0
p_prev = 0xfffffe90c888dae0
p_lckcnt = 0x1
p_cowcnt = 0
p_cv = {
_opaque = 0
}
p_io_cv = {
_opaque = 0
}
p_iolock_state = 0
p_szc = 0
p_fsdata = 0
p_state = 0
p_nrm = 0x2
p_embed = 0x1
p_index = 0
p_toxic = 0
p_mapping = 0xfffffe91a016d908
p_pagenum = 0x24f440
p_share = 0
p_sharepad = 0
p_slckcnt = 0
p_mlentry = 0x10c
p_ilock = {
_opaque = [ 0 ]
}
}


My questions are ...

1. How does MDB convert fffffe91a050cd88::vatopfn to physical page number ? There can be other processes in the kernel which has exactly the same VA as fffffe91a050cd88.
How do I set the context for the particular process and search for the VA in the context for the specific user process.? I tried the below ..it did not work.


fffffe919f4d58e8::print proc_t p_as
p_as = 0xfffffe918bad9920

fffffe91a050cd88::vatopfn -a 0xfffffe918bad9920
Virtual fffffe91a050cd88 maps Physical 0

Also tried ..

fffffe919f4d58e8::context
debugger context set to proc fffffe919f4d58e8
fffffe91a050cd88::vatopfn
^C ===> Waited here for long ..result was not printed.
fffffe91a050cd88::vatopfn -a 0xfffffe918bad9920
^C ===> Waited here for long ..result was not printed.




2. When I print fffffe90c888dae0::print struct page above why is the p_vnode = kvps ? The VA is from a anon mapping area..it should be in the swap right ?
I tried for many other VAs in different areas , all of them prints the same "kvps".
How will kernel know the vnode if the page has to be paged in/out ?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points