Search code examples
debuggingsolaris

How to get physical page in Solaris 11


I am using mdb on Solaris 11. I have opened a file by using " tail -f file_name" command in another ssh session. I got the pid of tail command and Vnode of the file opened by tail command. After getting the Vnode, I fired "walk page" on this file. Unfortunately, I am not getting any pages in walk. How to get Virtual Pages and Physical pages?


Solution

  • I have done following.

    1) Opened the file with 'tail -f'.

    2) Get the pid in mdb. Get the Vnode of the opened file.

    3) Get the page_t from Vnode_t of the opened file.

    4) Left shift to the page number with 0xD, it will give pp2pa effect.

    Here are the dcmds in mdb.

    > ::pgrep tail

    S PID PPID PGID SID UID FLAGS ADDR NAME

    R 2889 2882 2889 2850 0 0x4a004000 0000060013f29890 tail

    > 0000060013f29890::pfiles

    FD TYPE VNODE INFO

    0 REG 00000600162f6740 /export/home/chaitanya/OpenSolaris/README.opensolaris

    1 CHR 000006001a290400 /devices/pseudo/pts@0:2

    2 CHR 000006001a290400 /devices/pseudo/pts@0:2

    > 00000600162f6740::walk page

    70004781480

    700040b0400

    > 70004781480::print -at page_t

    {

    70004781480 u_offset_t p_offset = 0x2000
    
    70004781488 struct vnode *p_vnode = 0x600162f6740
    
    70004781490 selock_t p_selock = 0
    
    70004781494 uint_t p_vpmref = 0x11d9d
    
    70004781498 struct page *p_hash = 0x70002f79b00
    
    700047814a0 struct page *p_vpnext = 0x700040b0400
    
    700047814a8 struct page *p_vpprev = 0x700040b0400
    
    700047814b0 struct page *p_next = 0x70004781480
    
    700047814b8 struct page *p_prev = 0x70004781480
    
    700047814c0 ushort_t p_lckcnt = 0
    
    700047814c2 ushort_t p_cowcnt = 0
    
    700047814c4 kcondvar_t p_cv = {
    
        700047814c4 ushort_t _opaque = 0
    
    }
    
    700047814c6 kcondvar_t p_io_cv = {
    
        700047814c6 ushort_t _opaque = 0
    
    }
    
    700047814c8 uchar_t p_iolock_state = 0
    
    700047814c9 volatile uchar_t p_szc = 0
    
    700047814ca uchar_t p_fsdata = 0
    
    700047814cb uchar_t p_state = 0x40
    
    700047814cc uchar_t p_nrm = 0x2
    
    700047814cd uchar_t p_vcolor = 0x2
    
    700047814ce uchar_t p_index = 0
    
    700047814cf uchar_t p_toxic = 0
    
    700047814d0 void *p_mapping = 0
    
    700047814d8 pfn_t p_pagenum = 0x80f029
    
    700047814e0 uint_t p_share = 0
    
    700047814e4 uint_t p_sharepad = 0
    
    700047814e8 uint_t p_slckcnt = 0
    
    700047814ec uint_t p_kpmref = 0
    
    700047814f0 struct kpme *p_kpmelist = 0
    
    700047814f8 kmutex_t p_ilock = {
    
        700047814f8 void *[1] _opaque = [ 0 ]
    
    }
    

    }

    Left shift to the page number 0x80f029 with 0xD, it will give pp2pa

    > 101E052000,100::dump -p

               \/ 1 2 3  4 5 6 7  8 9 a b  c d e f  v123456789abcdef
    

    101e052000: 75742069 742e2020 4e6f7220 646f2079 ut it. Nor do y

    101e052010: 6f752068 61766520 746f206b 65657020 ou have to keep

    101e052020: 7468650a 20202020 206e616d 65206f70 the. name op

    101e052030: 656e736f 6c617269 732e7368 2c206275 ensolaris.sh, bu

    101e052040: 74207468 61742773 20746865 206e616d t that's the nam

    101e052050: 65207765 276c6c20 75736520 696e2074 e we'll use in t

    101e052060: 68657365 206e6f74 65732e0a 0a202020 hese notes...

    101e052070: 20205468 656e206d 616b6520 74686520 Then make the

    101e052080: 666f6c6c 6f77696e 67206368 616e6765 following change

    101e052090: 7320696e 20796f75 72206f70 656e736f s in your openso

    101e0520a0: 6c617269 732e7368 3a0a0a20 20202d20 laris.sh:.. -

    101e0520b0: 6368616e 67652047 41544520 746f2074 change GATE to t

    101e0520c0: 6865206e 616d6520 6f662074 68652074 he name of the t

    101e0520d0: 6f702d6c 6576656c 20646972 6563746f op-level directo

    101e0520e0: 72792028 652e672e 2c0a2020 20202022 ry (e.g.,. "

    101e0520f0: 74657374 77732229 2e0a0a20 20202d20 testws")... -