[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Kernel Extensions and Device Support Programming Concepts

Process Subcommands for the KDB Kernel Debugger and kdb Command


ppda Subcommand

The ppda subcommand allows to display all ppda area with the '*' argument. Otherwise, the current or specified processor ppda is printed.

Example

KDB(1)> ppda *
            SLT CSA      CURTHREAD     SRR1     SRR0

ppda+000000   0 004ADEB0 thread+000178 4000D030 1002DC74
ppda+000300   1 004B8EB0 thread+000234 00009030 .ld_usecount+00045C
ppda+000600   2 004C3EB0 thread+0002F0 0000D030 D00012F0
ppda+000900   3 004CEEB0 thread+0003AC 0000D030 D00012F0
ppda+000C00   4 004D9EB0 thread+000468 0000F030 D00012F0
ppda+000F00   5 004E4EB0 thread+000524 0000D030 10019870
ppda+001200   6 004EFEB0 thread+0005E0 0000D030 D00012F0
ppda+001500   7 004FAEB0 thread+00069C 0000D030 D00012F0

KDB(1)> ppda current processor data area

Per Processor Data Area [000C0300]

csa......................004B8EB0  mstack...................004B7EB0
fpowner..................00000000  curthread................E6000234
syscall..................0001879B  intr.....................E0100080
i_softis.....................0000  i_softpri....................4000
prilvl...................05CB1000
ppda_pal[0]..............00000000  ppda_pal[1]..............00000000
ppda_pal[2]..............00000000  ppda_pal[3]..............00000000
phy_cpuid....................0001  ppda_fp_cr...............28222881
flih save[0].............00000000  flih save[1].............2FF3B338
flih save[2].............002E65E0  flih save[3].............00000003
flih save[4].............00000002  flih save[5].............00000006
flih save[6].............002E6750  flih save[7].............00000000
dsisr....................40000000  dsi_flag.................00000003
dar......................2FF9F884
dssave[0]................2FF3B2A0  dssave[1]................002E65E0
dssave[2]................00000000  dssave[3]................002A4B1C
dssave[4]................E6001ED8  dssave[5]................00002A33
dssave[6]................00002A33  dssave[7]................00000001
dssrr0...................0027D5AC  dssrr1...................00009030
dssprg1..................2FF9F880  dsctr....................00000000
dslr.....................0027D4CC  dsxer....................20000000
dsmq.....................00000000  pmapstk..................00212C80
pmapsave64...............00000000  pmapcsa..................00000000
schedtail[0].............00000000  schedtail[1].............00000000
schedtail[2].............00000000  schedtail[3].............00000000
cpuid....................00000001  stackfix.................00000000
lru......................00000000  vmflags..................00010000
sio............................00  reservation....................01
hint...........................00  lock...........................00
no_vwait.................00000000
scoreboard[0]............00000000
scoreboard[1]............00000000
scoreboard[2]............00000000
scoreboard[3]............00000000
scoreboard[4]............00000000
scoreboard[5]............00000000
scoreboard[6]............00000000
scoreboard[7]............00000000
intr_res1................00000000  intr_res2................00000000
mpc_pend.................00000000  iodonelist...............00000000
affinity.................00000000  TB_ref_u.................003DC159
TB_ref_l.................28000000  sec_ref..................33CDD7B0
nsec_ref.................13EF2000  _ficd....................00000000
decompress...............00000000  ppda_qio.................00000000
cs_sync..................00000000
ppda_perfmon_sv[0].......00000000  ppda_perfmon_sv[1].......00000000
thread_private...........00000000  cpu_priv_seg.............60017017
fp flih save[0]..........00000000  fp flih save[1]..........00000000
fp flih save[2]..........00000000  fp flih save[3]..........00000000
fp flih save[4]..........00000000  fp flih save[5]..........00000000
fp flih save[6]..........00000000  fp flih save[7]..........00000000
TIMER....................
t_free...................00000000  t_active.................05CB9080
t_freecnt................00000000  trb_called...............00000000
systimer.................05CB9080  ticks_its................00000051
ref_time.tv_sec..........33CDD7B1  ref_time.tv_nsec.........01DCDA38
time_delta...............00000000  time_adjusted............05CB9080
wtimer.next..............05767068  wtimer.prev..............0B30B81C
wtimer.func..............000F2F0C  wtimer.count.............00000000
wtimer.restart...........00000000  w_called.................00000000
trb_lock.................000C04F0 slock/slockp 00000000
KDB......................
flih_llsave[0]...........00000000  flih_llsave[1]...........2FF22FB8
flih_llsave[2]...........00000000  flih_llsave[3]...........00000000
flih_llsave[4]...........00000000  flih_llsave[5]...........00000000
flih_save[0].............00000000  flih_save[1].............00000000
flih_save[2].............00000000  csa......................001D4800
KDB(3)> 

intr Subcommand

The intr subcommand prints the interrupt handler table, or the specified one.

Example

KDB(0)> intr interrupt handler table
              SLT INTRADDR HANDLER  TYPE LEVEL    PRIO BID     FLAGS
								       
i_data+000068   1 055DF0A0 00000000 0000 00000003 0000 00000000 0000
i_data+000068   1 00364F88 00090584 0000 00000001 0000 00000000 0000
i_data+000068   1 003685B0 00090584 0001 00000008 0000 82000000 0000
i_data+000068   1 019E7D48 019E7BF0 0000 00000001 0000 820C0020 0010
i_data+0000E0  16 055DF060 00000000 0001 00000001 0000 82000080 0000
i_data+0000E0  16 00368718 000A24D8 0001 00000000 0000 82000080 0000
i_data+0000F0  18 055DF100 00000000 0001 00000000 0001 82080060 0010
i_data+0000F0  18 05B3BC00 01A55018 0001 00000002 0001 82080060 0010
i_data+000120  24 055DF0C0 00000000 0001 00000004 0000 82000000 0000
i_data+000120  24 003685B0 00090584 0001 00000008 0000 82000000 0000
i_data+000120  24 019E7D48 019E7BF0 0000 00000001 0000 820C0020 0010
i_data+000140  28 055DF160 00000000 0001 00000001 0003 820C0060 0010
i_data+000140  28 0A145000 01A741AC 0001 0000000C 0003 820C0060 0010
i_data+000150  30 055DF0E0 00000000 0001 00000000 0003 820C0020 0010
i_data+000150  30 055FC000 019E7AA8 0001 0000000E 0003 820C0020 0010
i_data+000160  32 055DF080 00000000 0001 00000002 0000 82100080 0000
i_data+000160  32 00368734 000A24D8 0001 00000000 0000 82100080 0000
i_data+0004E0 144 055DF020 00000000 0002 00000000 0000 00000000 0011
i_data+0004E0 144 00368560 000903B0 0002 00000002 0000 00000000 0011
i_data+000530 154 055DF040 00000000 0002 FFFFFFFF 000A 00000000 0011
i_data+000530 154 00368580 000903B0 0002 00000002 000A 00000000 0011
KDB(0)> intr 1 interrupt handler slot 1					       
              SLT INTRADDR HANDLER  TYPE LEVEL    PRIO BID     FLAGS
								       
i_data+000068   1 055DF0A0 00000000 0000 00000003 0000 00000000 0000
i_data+000068   1 00364F88 00090584 0000 00000001 0000 00000000 0000
i_data+000068   1 003685B0 00090584 0001 00000008 0000 82000000 0000
i_data+000068   1 019E7D48 019E7BF0 0000 00000001 0000 820C0020 0010
KDB(0)> intr 00368560 interrupt handler address ..
addr.......... 00368560 handler....... 000903B0 i_hwassist_int+000000
bid........... 00000000 bus_type...... 00000002 PLANAR
next.......... 00000000 flags......... 00000011 NOT_SHARED MPSAFE
level......... 00000002 priority...... 00000000 INTMAX
i_count....... 00000014
KDB(0)>

mst Subcommand

The mst subcommand prints the current context (Machine State Save Area), or the specified one. Argument is given to identify a process/thread mst context. If -a option is specified, argument is an effective address, not a slot entry.

Example

KDB(0)> mst current mst
   
Machine State Save Area
iar   : 0002599C  msr   : 00009030  cr    : 20000000  lr    : 000259B8
ctr   : 000258EC  xer   : 00000000  mq    : 00000000
r0  : 00000000  r1  : 2FF3B338  r2  : 002E65E0  r3  : 00000003  r4  : 00000002
r5  : 00000006  r6  : 002E6750  r7  : 00000000  r8  : DEADBEEF  r9  : DEADBEEF
r10 : DEADBEEF  r11 : 00000000  r12 : 00009030  r13 : DEADBEEF  r14 : DEADBEEF
r15 : DEADBEEF  r16 : DEADBEEF  r17 : DEADBEEF  r18 : DEADBEEF  r19 : DEADBEEF
r20 : DEADBEEF  r21 : DEADBEEF  r22 : DEADBEEF  r23 : DEADBEEF  r24 : DEADBEEF
r25 : DEADBEEF  r26 : DEADBEEF  r27 : DEADBEEF  r28 : 000034E0  r29 : 000C6158
r30 : 000C0578  r31 : 00005004
s0  : 00000000  s1  : 007FFFFF  s2  : 0000F00F  s3  : 007FFFFF  s4  : 007FFFFF
s5  : 007FFFFF  s6  : 007FFFFF  s7  : 007FFFFF  s8  : 007FFFFF  s9  : 007FFFFF
s10 : 007FFFFF  s11 : 007FFFFF  s12 : 007FFFFF  s13 : 0000C00C  s14 : 00004004
s15 : 007FFFFF
prev      00000000 kjmpbuf   00000000 stackfix  00000000 intpri    0B
curid     00000306 sralloc   E01E0000 ioalloc   00000000 backt     00
flags     00 tid       00000000 excp_type 00000000
fpscr     00000000 fpeu            00 fpinfo          00 fpscrx    00000000
o_iar     00000000 o_toc     00000000 o_arg1    00000000
excbranch 00000000 o_vaddr   00000000 mstext    00000000
Except :
 csr 2FEC6B78 dsisr 40000000  bit set: DSISR_PFT
 srval 000019DD dar 2FEC6B78 dsirr 00000106
KDB(0)> mst 1 slot 1 is thread+0000A0

Machine State Save Area
iar   : 00038ED0  msr   : 00001030  cr    : 2A442424  lr    : 00038ED0
ctr   : 002BCC00  xer   : 00000000  mq    : 00000000
r0  : 60017017  r1  : 2FF3B300  r2  : 002E65E0  r3  : 00000000  r4  : 00000002
r5  : E60000BC  r6  : 00000109  r7  : 00000000  r8  : 000C0300  r9  : 00000001
r10 : 2FF3B380  r11 : 00000000  r12 : 00001030  r13 : 00000001  r14 : 2FF22F54
r15 : 2FF22F5C  r16 : DEADBEEF  r17 : DEADBEEF  r18 : 0000040F  r19 : 00000000
r20 : 00000000  r21 : 00000003  r22 : 01000001  r23 : 00000001  r24 : 00000000
r25 : E600014C  r26 : 000D1A08  r27 : 00000000  r28 : E3000160  r29 : E60000BC
r30 : 00000004  r31 : 00000004
s0  : 00000000  s1  : 007FFFFF  s2  : 0000A00A  s3  : 007FFFFF  s4  : 007FFFFF
s5  : 007FFFFF  s6  : 007FFFFF  s7  : 007FFFFF  s8  : 007FFFFF  s9  : 007FFFFF
s10 : 007FFFFF  s11 : 007FFFFF  s12 : 007FFFFF  s13 : 6001F01F  s14 : 00004004
s15 : 60004024
prev      00000000 kjmpbuf   00000000 stackfix  2FF3B300 intpri    00
curid     00000001 sralloc   E01E0000 ioalloc   00000000 backt     00
flags     00 tid       00000000 excp_type 00000000
fpscr     00000000 fpeu            00 fpinfo          00 fpscrx    00000000
o_iar     00000000 o_toc     00000000 o_arg1    00000000
excbranch 00000000 o_vaddr   00000000 mstext    00000000
Except :
 csr   30002F00 dsisr 40000000  bit set: DSISR_PFT
 srval 6000A00A dar   20022000 dsirr 00000106

KDB(0)> set 11 64-bit printing mode
64_bit is true
KDB(0)> sw u   select user context
KDB(0)> mst    print user context

Machine State Save Area
iar   : 08000001000581D4  msr   : 800000004000D0B0  cr    : 84002222
lr    : 000000010000047C  ctr   : 08000001000581D4  xer   : 00000000
mq    : 00000000  asr   : 0000000013619001
r0  : 08000001000581D4  r1  : 0FFFFFFFFFFFFF00  r2  : 080000018007BC80
r3  : 0000000000000064  r4  : 0000000000989680  r5  : 0000000000000000
r6  : 800000000000D0B0  r7  : 0000000000000000  r8  : 000000002FF9E008
r9  : 0000000013619001  r10 : 000000002FF3B010  r11 : 0000000000000000
r12 : 0800000180076A98  r13 : 0000000110003730  r14 : 0000000000000001
r15 : 00000000200FEB78  r16 : 00000000200FEB88  r17 : BADC0FFEE0DDF00D
r18 : BADC0FFEE0DDF00D  r19 : BADC0FFEE0DDF00D  r20 : BADC0FFEE0DDF00D
r21 : BADC0FFEE0DDF00D  r22 : BADC0FFEE0DDF00D  r23 : BADC0FFEE0DDF00D
r24 : BADC0FFEE0DDF00D  r25 : BADC0FFEE0DDF00D  r26 : BADC0FFEE0DDF00D
r27 : BADC0FFEE0DDF00D  r28 : BADC0FFEE0DDF00D  r29 : BADC0FFEE0DDF00D
r30 : BADC0FFEE0DDF00D  r31 : 0000000110000688
s0  : 60000000  s1  : 007FFFFF  s2  : 60010B68  s3  : 007FFFFF  s4  : 007FFFFF
s5  : 007FFFFF  s6  : 007FFFFF  s7  : 007FFFFF  s8  : 007FFFFF  s9  : 007FFFFF
s10 : 007FFFFF  s11 : 007FFFFF  s12 : 007FFFFF  s13 : 007FFFFF  s14 : 007FFFFF
s15 : 007FFFFF
prev      00000000 kjmpbuf   00000000 stackfix  2FF3B2A0 intpri    00
curid     00006FBC sralloc   A0000000 ioalloc   00000000 backt     00
flags     00 tid       00000000 excp_type 00000000
fpscr     00000000 fpeu            00 fpinfo          00 fpscrx    00000000
o_iar     00000000 o_toc     00000000 o_arg1    00000000
excbranch 00000000 o_vaddr   00000000 mstext    00062C08
Except : dar   08000001000581D4

KDB(0)>

proc Subcommand

The p subcommand prints the proc table. The '*' argument specifies all the table, no argument specifies the current process. Output is decimal or hexadecimal, according to the hexadecimal_wanted toggle value. The current process is shown with a "*".

Example

KDB(0)> p * print proc table
            SLOT NAME     STATE    PID  PPID  PGRP   UID  EUID  ADSPACE

proc+000000    0 swapper  ACTIVE 00000 00000 00000 00000 00000 00001C07 
proc+000100    1 init     ACTIVE 00001 00000 00000 00000 00000 00001405 
proc+000200    2*wait     ACTIVE 00204 00000 00000 00000 00000 00002008 
proc+000300    3 wait     ACTIVE 00306 00000 00000 00000 00000 00002409 
proc+000400    4 wait     ACTIVE 00408 00000 00000 00000 00000 0000280A 
proc+000500    5 wait     ACTIVE 0050A 00000 00000 00000 00000 00002C0B 
proc+000600    6 wait     ACTIVE 0060C 00000 00000 00000 00000 0000300C 
proc+000700    7 wait     ACTIVE 0070E 00000 00000 00000 00000 0000340D 
proc+000800    8 wait     ACTIVE 00810 00000 00000 00000 00000 0000380E 
proc+000900    9 wait     ACTIVE 00912 00000 00000 00000 00000 00003C0F 
proc+000A00   10 lrud     ACTIVE 00A14 00000 00000 00000 00000 00004010 
proc+000B00   11 netm     ACTIVE 00B16 00000 00000 00000 00000 00001806 
proc+000C00   12 gil      ACTIVE 00C18 00000 00000 00000 00000 00004C13 
proc+000F00   15 lvmb     ACTIVE 00F70 00000 00D68 00000 00000 00004832 
proc+001000   16 biod     ACTIVE 01070 02066 02066 00000 00000 000021A8 
proc+001100   17 biod     ACTIVE 0116E 02066 02066 00000 00000 000011A4 
proc+001200   18 errdemon ACTIVE 01220 00001 01220 00000 00000 00001104 
proc+001300   19 dump     ACTIVE 01306 00001 00ECC 00000 00000 00005C77 
proc+001400   20 syncd    ACTIVE 01418 00001 00ECC 00000 00000 00000D03 
proc+001500   21 biod     ACTIVE 0156C 02066 02066 00000 00000 000001A0 
KDB(0)> p 21 print process slot 21
            SLOT NAME     STATE    PID  PPID  PGRP   UID  EUID  ADSPACE

proc+001500   21 biod     ACTIVE 0156C 02066 02066 00000 00000 000001A0 

NAME....... biod
STATE...... stat  :07...... xstat :0000
FLAGS...... flag  :00040001 LOAD ORPHANPGRP
........... int   :00000000
........... atomic:00000000
LINKS...... child      :00000000 
........... siblings   :E3001800 proc+001800
........... uidl       :E3001500 proc+001500
........... ganchor    :00000000 
THREAD..... threadlist :E6001200 thread+001200
........... threadcount:0001................. active     :0001
........... suspended  :0000................. terminating:0000
........... local      :0000
SCHEDULE... nice       : 20   sched_pri :127
DISPATCH... pevent     :00000000
........... synch      :FFFFFFFF 
IDENTIFIER. uid        :00000000............. suid       :00000000
........... pid        :0000156C............. ppid       :00002066
(0)> more (^C to quit) ? continue
........... sid        :00002066............. pgrp       :00002066
MISC....... lock       :00000000............. kstackseg  :007FFFFF
........... adspace    :000001A0............. ipc        :00000000
........... pgrpl      :E3001800 proc+001800
........... ttyl       :00000000 
........... dblist     :00000000 
........... dbnext     :00000000 
SIGNAL..... pending  :
........... sigignore: URG IO WINCH PWR
........... sigcatch : TERM USR1 USR2
STATISTICS. page size  :00000000............. pctcpu     :00000000
........... auditmask  :00000000
........... minflt     :00000004............. majflt     :00000000
SCHEDULER.. repage     :00000000............. sched_count:00000000
........... sched_next :00000000 
........... sched_back :00000000 
........... cpticks    :0000................. msgcnt     :0000
........... majfltsec  :00000000

THE FOLLOWING EXAMPLE SHOWS HOW TO FIND A THREAD THRU THE PROCESS TABLE.
The initial problem was that many threads are waiting for ever.
This example shows how to point the failing process:

KDB(6)> th -w WPGIN threads waiting for VMM resources
              SLOT NAME     STATE    TID PRI CPUID CPU FLAGS    WCHAN

thread+000780   10 lrud     SLEEP  00A15 010       000 00001004 vmmdseg+69C84D0
thread+0012C0   25 dtlogin  SLEEP  01961 03C       000 00000000 vmmdseg+69C8670
thread+001500   28 cnsview  SLEEP  01C71 03C       000 00000004 vmmdseg+69C8670
thread+00B1C0  237 jfsz     SLEEP  0EDCD 032       000 00001000 vm_zqevent+000000
thread+00C240  259 jfsc     SLEEP  10303 01E       000 00001000 _$STATIC+000110
thread+00E940  311 rm       SLEEP  137C3 03C       000 00000000 vmmdseg+69C8670
thread+012300  388 touch    SLEEP  1843B 03C       000 00000000 vmmdseg+69C8670
...
thread+0D0F80 4458 link_fil SLEEP 116A39 03C       000 00000000 vmmdseg+69C9C74
thread+0DC140 4695 sync     SLEEP 1257BB 03C       000 00000000 vmmdseg+69C8670
thread+0DD280 4718 touch    SLEEP 126E57 03C       000 00000000 vmmdseg+69C8670
thread+0E5A40 4899 renamer  SLEEP 132315 03C       000 00000000 vmmdseg+69C8670
thread+0EE140 5079 renamer  SLEEP 13D7C3 03C       000 00000000 vmmdseg+69C8670
thread+0F03C0 5125 renamer  SLEEP 1405B7 03C       000 00000000 vmmdseg+69C8670
thread+0FC540 5383 renamer  SLEEP 15072F 03C       000 00000000 vmmdseg+69C8670
thread+101AC0 5497 renamer  SLEEP 157909 03C       000 00000000 vmmdseg+69C8670
thread+10D280 5742 rm       SLEEP 166E37 03C       000 00000000 vmmdseg+69C8670
KDB(6)> vmwait vmmdseg+69C8670 VMM resource
VMM Wait Info
Waiting on transactions to end to forward the log
KDB(6)> vmwait vmmdseg+69C9C74 VMM resource
VMM Wait Info
Waiting on transaction block number 00000057
KDB(6)> tblk 87 print transaction block number
  @tblk[87] vmmdseg +69C9C3C
logtid.... 002C77CF next...... 00000064 tid....... 00000057 flag...... 00000000
cpn....... 00000000 ceor...... 00000000 cxor...... 00000000 csn....... 00000000
waitsid... 00000000 waitline.. 00000000 locker.... 00000000 lsidx..... 00000AB3
logage.... 00B71704 gcwait.... FFFFFFFF waitors... E60D0F80 cqnext.... 00000000

TID is registered in __ublock, at page offset 0x6a0.
Search in physical memory TID 0x00000057.
The search is limited at this page offset.

KDB(6)> findp 6A0 00000057 ffffffff 1000 physical search
0AFC86A0: 00000057 00000000 00000000 00000000 
KDB(6)> pft 1 print page frame information
Enter the page frame number (in hex): 0AFC8

VMM PFT Entry For Page Frame 0AFC8 of 7FF67

pte = B066F458, pvt = B202BF20, pft = B3A0F580
h/w hashed sid : 000164EA  pno : 0000FF3B  key : 0
source     sid : 000164EA  pno : 0000FF3B  key : 0

> in use
> on scb list
> valid (h/w)
> referenced (pft/pvt/pte): 0/1/1
> modified (pft/pvt/pte): 0/1/1
page number in scb    (pagex)  : 0000FF3B
disk block number     (dblock) : 00000000
next page on scb list (sidfwd) : FFFFFFFF
prev page on scb list (sidbwd) : 00051257
freefwd/waitlist      (freefwd): 00000000
freebwd/logage/pincnt (freebwd): 00010000
out of order I/O      (nonfifo): 0000
next frame i/o list   (nextio) : 00000000
storage attributes    (wimg)   : 2
xmem hide count       (xmemcnt): 0
next page on s/w hash (next)   : FFFFFFFF
List of alias entries (alist)  : 0000FFFF
index in PDT          (devid)  : 0000

The Segment ID of __ublock is the ADSPACE of the process

KDB(6)> find proc 000164EA search this SID in the proc table
proc+10EB58: 000164EA E3173F00 00000000 00000000 
KDB(6)> proc proc+10EB00 print the process entry
            SLOT NAME     STATE     PID  PPID  PGRP   UID  EUID  ADSPACE

proc+10EB00 4331 renamer  ACTIVE 10EB98 D6282 065DE 00000 00000 000164EA 
NAME....... renamer
STATE...... stat  :07...... xstat :0000
FLAGS...... flag  :00000001 LOAD
........... int   :00000000
........... atomic:00000000
LINKS...... child      :00000000 
........... siblings   :E3173F00 proc+173F00
........... uidl       :E310EB00 proc+10EB00
........... ganchor    :00000000 
THREAD..... threadlist :E60F2640 thread+0F2640
...
KDB(6)> sw thread+0F2640 switch to this thread
Switch to thread: <thread+0F2640>
KDB(6)> f look at the stack
thread+0F2640 STACK:
[000D4950]slock_instr_ppc+00045C (C0042BDF, 00000002 [??])
[000095AC].simple_lock+0000AC ()
[00202370]logmvc+00004C (??, ??, ??, ??)
[001C23F4]logafter+000108 (??, ??, ??)
[001C1CEC]commit2+0001FC (??)
[001C386C]finicom+0000C0 (??, ??)
[001C3BC0]comlist+0001CC (??, ??)
[0020D938]jfs_rename+0006EC (??, ??, ??, ??, ??, ??, ??)
[001CE794]vnop_rename+000038 (??, ??, ??, ??, ??, ??, ??)
[001DEFA4]rename+000398 (??, ??)
[000037D8].sys_call+000000 ()
[100004B4]main+0002DC (00000006, 2FF22A20)
[10000174].__start+00004C ()

thread Subcommand

The th subcommand prints the thread table. The '*' argument specifies all the table, no argument specifies the current thread. Output is decimal or hexadecimal, according to the hexadecimal_wanted toggle value. The current thread is shown with a "*".

The '-w' argument can be used to select threads waiting with the specified thread wtype, (WLOCK, WPGIN, ...).

Example

KDB(0)> th * print thread table
              SLOT NAME     STATE   TID PRI CPUID CPU FLAGS    WCHAN
   
thread+000000    0 swapper  SLEEP 00003 010       078 00001400 
thread+0000A0    1 init     SLEEP 001F3 03C       000 00000400 
thread+000140    2 wait     RUN   00205 07F 00000 078 00001004 
thread+0001E0    3 wait     RUN   00307 07F 00001 078 00001004 
thread+000280    4 netm     SLEEP 00409 024       000 00001004 
thread+000320    5 gil      SLEEP 0050B 025       000 00001004 
thread+0003C0    6 gil      SLEEP 0060D 025       000 00001004 netisr_servers+000000
thread+000460    7 gil      SLEEP 0070F 025       000 00001004 netisr_servers+000000
thread+000500    8 gil      SLEEP 00811 025       001 00001004 netisr_servers+000000
thread+0005A0    9 gil      SLEEP 00913 025       000 00001004 netisr_servers+000000
thread+0006E0   11 errdemon SLEEP 00B01 03C       000 00000000 errc+000008
thread+000780   12 syncd    SLEEP 00CF9 03C       005 00000000 
thread+000820   13 lvmb     SLEEP 00D97 03C       000 00001004 
thread+0008C0   14 cpio     SLEEP 00EC3 040       007 00000000 054FB000
thread+000960   15 sh       SLEEP 00FAF 03C       000 00000400 
thread+000A00   16 getty    SLEEP 01065 03C       000 00000420 0563525C
thread+000AA0   17 ksh      SLEEP 01163 03C       000 00000420 05BA0E44
thread+000B40   18 sh       SLEEP 01279 03C       000 00000400 
thread+000BE0   19 find     SLEEP 013B1 041       001 00000000 
thread+000C80   20 ksh      SLEEP 014FB 040       000 00000400 
KDB(0)> th print current thread
              SLOT NAME     STATE   TID PRI CPUID CPU FLAGS    WCHAN

thread+0159C0  461*ksh      RUN   1CDC9 03D       003 00000000 

NAME................ ksh
FLAGS...............
WTYPE............... NOWAIT   
............stackp64 :00000000  ..............stackp :2FF1E5A0
...............state :00000002  ...............wtype :00000000
.............suspend :00000001  ...............flags :00000000
..............atomic :00000000
DATA................
...............procp :E3014400 <proc+014400>
...............userp :2FF3B6C0 <__ublock+0002C0>
............uthreadp :2FF3B400 <__ublock+000000>
THREAD LINK.........
..........prevthread :E60159C0 <thread+0159C0>
..........nextthread :E60159C0 <thread+0159C0>
SLEEP LOCK.........
............ulock64  :00000000  ..............ulock  :00000000
...............wchan :00000000  ..............wchan1 :00000000
...........wchan1sid :00000000  ........wchan1offset :00000000
(3)> more (^C to quit) ?  continue
..............wchan2 :00000000  ..............swchan :00000000
...........eventlist :00000000  ..............result :00000000
.............polevel :00000000  .............pevent  :00000000
.............wevent  :00000000  ..............slist  :00000000
...........lockcount :00000002
DISPATCH............
...............ticks :00000000  ...............prior :E60159C0
................next :E60159C0  ...............synch :FFFFFFFF
..............dispct :00000003  ...............fpuct :00000000
SCHEDULER...........
...............cpuid :FFFFFFFF  ..............scpuid :FFFFFFFF
............affinity :00000001  .................pri :0000003C
..............policy :00000000  .................cpu :00000000
.............lockpri :0000003D  .............wakepri :0000007F
................time :000000FF  .............sav_pri :0000003C
SIGNAL..............
..............cursig :00000000
......(pending) sig  :
............sigmask  :
...............scp64 :00000000  .................scp :00000000
MISC................
............graphics :00000000  ..............cancel :00000000
(3)> more (^C to quit) ?  continue
...........lockowner :00000000  .............boosted :00000000
..............tsleep :FFFFFFFF
..........userdata64 :00000000  ............userdata :00000000
KDB(0)> th -w print -w usage
Missing wtype:
NOWAIT   
WEVENT   
WLOCK    
WTIMER   
WCPU     
WPGIN    
WPGOUT   
WPLOCK   
WFREEF   
WMEM     
WLOCKREAD
WUEXCEPT 
KDB(0)> th -w WPGIN print threads waiting for page-in
              SLOT NAME     STATE   TID PRI CPUID CPU FLAGS    WCHAN

thread+000600    8 lrud     SLEEP 00811 010       000 00001004 vmmdseg+69C84D0
thread+000E40   19 syncd    SLEEP 01329 03D       003 00000000 vmmdseg+69D1630
thread+013440  411 oracle   SLEEP 19B75 03D       002 00000000 vmmdseg+69F171C
thread+013500  412 oracle   SLEEP 19C77 03F       006 00000000 vmmdseg+69F13A8 
thread+022740  735 rts32    SLEEP 2DF7F 03F       007 00000000 vmmdseg+3A9A5B8
KDB(0)> vmwait vmmdseg+69C84D0 print VMM resource the thread is waiting for
VMM Wait Info
Waiting on lru daemon anchor
KDB(0)> vmwait vmmdseg+69D1630 print VMM resource the thread is waiting for
VMM Wait Info
Waiting on segment I/O level (v_iowait), sidx = 00000124
KDB(0)> vmwait vmmdseg+69F171C print VMM resource the thread is waiting for
VMM Wait Info
Waiting on segment I/O level (v_iowait), sidx = 000008AF
KDB(0)> vmwait vmmdseg+69F13A8 print VMM resource the thread is waiting for
VMM Wait Info
Waiting on segment I/O level (v_iowait), sidx = 000008A2
KDB(0)> vmwait vmmdseg+3A9A5B8 print VMM resource the thread is waiting for
VMM Wait Info
Waiting on page frame number 0000DE1E

KDB(1)> th -w WLOCK print threads waiting for locks
              SLOT NAME     STATE   TID PRI CPUID CPU FLAGS    WCHAN

thread+0000C0    1 init     SLEEP 001BD 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+000900   12 cron     SLEEP 00C57 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+000B40   15 inetd    SLEEP 00FB7 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+000CC0   17 mirrord  SLEEP 01107 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+000F00   20 sendmail SLEEP 014A5 03C       000 00000004 cred_lock+000000 lockhsque+000020 
thread+013F80  426 getty    SLEEP 1AA6F 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+014340  431 diagd    SLEEP 1AF8F 03C       000 00000000 proc_tbl_lock+000000 lockhsque+0000F8 
thread+014400  432 pd_watch SLEEP 1B091 03C       000 00000000 proc_tbl_lock+000000 lockhsque+0000F8 
thread+015000  448 stress_m SLEEP 1C08B 028       000 00000000 cred_lock+000000 lockhsque+000020 
thread+018780  522 stresser SLEEP 20AF1 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+018CC0  529 pcomp    SLEEP 21165 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+01B6C0  585 EXP_TEST SLEEP 24943 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+01C2C0  601 cres     SLEEP 25957 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+022500  732 rsh      SLEEP 2DC25 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+02A240  899 rcp      SLEEP 383FB 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+02C580  946 ps       SLEEP 3B223 03C       000 00000000 proc_tbl_lock+000000 lockhsque+0000F8 
thread+02D900  972 rsh      SLEEP 3CC29 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+02DD80  978 xlCcode  SLEEP 3D227 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+02ED40  999 tty_benc SLEEP 3E7A7 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+02F100 1004 tty_benc SLEEP 3ECF3 03C       000 00000000 cred_lock+000000 lockhsque+000020 
(1)> more (^C to quit) ?  continue
              SLOT NAME     STATE   TID PRI CPUID CPU FLAGS    WCHAN

thread+02F400 1008 tty_benc SLEEP 3F097 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+02F700 1012 ksh      SLEEP 3F403 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+02F940 1015 tty_benc SLEEP 3F745 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+02FA00 1016 tty_benc SLEEP 3F869 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+02FE80 1022 tty_benc SLEEP 3FECB 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+02FF40 1023 tty_benc SLEEP 3FFF5 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+030240 1027 rshd     SLEEP 403F3 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+030300 1028 bsh      SLEEP 404FF 03C       000 00000000 cred_lock+000000 lockhsque+000020 
thread+0303C0 1029 sh       SLEEP 40505 03C       000 00000000 cred_lock+000000 lockhsque+000020 
KDB(1)> slk cred_lock+000000 print lock information
Simple lock name: cred_lock
          _slock: 400401FD WAITING  thread_owner: 00401FD
KDB(1)> slk proc_tbl_lock+000000 print lock information
Simple lock name: proc_tbl_lock
          _slock: 400401FD WAITING  thread_owner: 00401FD
KDB(1)> 

ttid and tpid Subcommands

The ttid subcommand prints the thread entry selected by thread id. Default is the current thread. The tpid subcommand prints all thread entries selected by process id. Default is the current process.Id input is decima hexadecimal, according to the hexadecimal_wanted toggle value.

Example

KDB(4)> p * print process table
            SLOT NAME     STATE    PID  PPID  PGRP   UID  EUID  ADSPACE
...
proc+000100    1 init     ACTIVE 00001 00000 00000 00000 00000 0000A005 
...
proc+000C00   12 gil      ACTIVE 00C18 00000 00000 00000 00000 00026013 
...
KDB(4)> tpid 1 print thread(s) of process pid 1
              SLOT NAME     STATE   TID PRI CPUID CPU FLAGS    WCHAN

thread+0000C0    1 init     SLEEP 001D9 03C       000 00000400 
KDB(4)> tpid 00C18 print thread(s) of process pid 0xc18
              SLOT NAME     STATE   TID PRI CPUID CPU FLAGS    WCHAN

thread+000900   12 gil      SLEEP 00C19 025       000 00001004 
thread+000C00   16 gil      SLEEP 01021 025 00000 000 00003004 netisr_servers+000000 
thread+000B40   15 gil      SLEEP 00F1F 025 00000 000 00003004 netisr_servers+000000 
thread+000A80   14 gil      SLEEP 00E1D 025 00000 000 00003004 netisr_servers+000000 
thread+0009C0   13 gil      SLEEP 00D1B 025 00000 000 00003004 netisr_servers+000000 
KDB(4)> ttid 001D9 print thread with tid 0x1d9
              SLOT NAME     STATE   TID PRI CPUID CPU FLAGS    WCHAN

thread+0000C0    1 init     SLEEP 001D9 03C       000 00000400 

NAME................ init
FLAGS............... WAKEONSIG
WTYPE............... WEVENT   
............stackp64 :00000000  ..............stackp :2FF22DC0
...............state :00000003  ...............wtype :00000001
.............suspend :00000001  ...............flags :00000400
..............atomic :00000000
DATA................
...............procp :E3000100 <proc+000100>
...............userp :2FF3B6C0 <__ublock+0002C0>
............uthreadp :2FF3B400 <__ublock+000000>
THREAD LINK.........
..........prevthread :E60000C0 <thread+0000C0>
..........nextthread :E60000C0 <thread+0000C0>
SLEEP LOCK.........
............ulock64  :00000000  ..............ulock  :00000000
...............wchan :00000000  ..............wchan1 :00000000
...........wchan1sid :00000000  ........wchan1offset :01AB5A58
(4)> more (^C to quit) ?  continue
..............wchan2 :00000000  ..............swchan :00000000
...........eventlist :00000000  ..............result :00000000
.............polevel :000000AF  .............pevent  :00000000
.............wevent  :00000004  ..............slist  :00000000
...........lockcount :00000000
DISPATCH............
...............ticks :00000000  ...............prior :E60000C0
................next :E60000C0  ...............synch :FFFFFFFF
..............dispct :000008F6  ...............fpuct :00000000
SCHEDULER...........
...............cpuid :FFFFFFFF  ..............scpuid :FFFFFFFF
............affinity :00000001  .................pri :0000003C
..............policy :00000000  .................cpu :00000000
.............lockpri :0000003D  .............wakepri :0000007F
................time :000000FF  .............sav_pri :0000003C
SIGNAL..............
..............cursig :00000000
......(pending) sig  :
............sigmask  :
...............scp64 :00000000  .................scp :00000000
MISC................
............graphics :00000000  ..............cancel :00000000
(4)> more (^C to quit) ? continue
...........lockowner :E60042C0  .............boosted :00000000
..............tsleep :FFFFFFFF
..........userdata64 :00000000  ............userdata :00000000

runq, lockq, and sleepq Subcommands

The rq subcommand prints run queues, lq subcommand prints lock queues, and sq subcommand prints sleep queues. A specific queue may be displayed.

Example

KDB(0)> rq print run queues

                  BUCKET HEAD            COUNT

thread_run+000100   65   thread+009060     1
thread_run+000104   66   thread+008660     4
thread_run+000108   67   thread+001D60     5
thread_run+0001FC  128   thread+000140     2
KDB(0)> rq 67 print run queue slot 67
RUNQ ENTRY( 67): thread_run+000108
              SLOT NAME     STATE   TID PRI CPUID CPU FLAGS    WCHAN

thread+001D60   47 ps       RUN   02FF7 042       001 00000000 
thread+0071C0  182 diff     RUN   0B6ED 042       005 00000000 
thread+005460  135 cpio     RUN   08773 042       001 00000000 
thread+004060  103 ed       RUN   06761 042       001 00000000 
thread+004100  104 nroff    RUN   068D7 042       002 00000000 
KDB(0)> lq print lock queues

                 BUCKET HEAD           COUNT

lockhsque+0000D0   53   thread+0B04C0    31
lockhsque+0001FC  128   thread+000000     1
KDB(0)> lq 53 print lock queue slot 53
LOCKHSQUE ENTRY( 53): lockhsque+0000D0
              SLOT NAME     STATE   TID PRI CPUID CPU FLAGS    WCHAN

thread+0B04C0 3761 ksh      SLEEP EB14F 04A       01D 00000000 09AB9410 lockhsque+0000D0
thread+093CC0 3153 renamer  SLEEP C5175 03D       003 00000000 09AB9410 lockhsque+0000D0
thread+074280 2478 renamer  SLEEP 9AEF9 03D       003 00000000 09AB9410 lockhsque+0000D0
...
thread+088740 2911 ksh      SLEEP B5FB5 03F       006 00000000 09AB9410 lockhsque+0000D0
thread+029DC0  893 inetd    SLEEP 37DB7 03C       000 00000000 09AB9410 lockhsque+0000D0
thread+0B4E40 3859 ksh      SLEEP F139F 04A       01D 00000000 09AB9410 lockhsque+0000D0
KDB(0)>

user Subcommand

The u subcommand prints the u-block of the current process, or the specified one. Argument is given to identify a process/thread u block.

Usage: u [-ad] [-cr] [-f] [-s] [-ru] [-t] [-ut] [-64] <slot/eaddr>

Example

KDB(0)> u -ut print current user thread block
User thread context [2FF3B400]:
   save.... @ 2FF3B400   fpr..... @ 2FF3B550
Uthread System call state:
   msr64......00000000   msr........0000D0B0
   errnopp64..00000000   errnopp....200FEFE8   error......00
   scsave[0]..2004A474   scsave[1]..00000020   scsave[2]..20007B48
   scsave[3]..2FF22AA0   scsave[4]..00000014   scsave[5]..20006B68
   scsave[6]..2004A7B4   scsave[7]..2004A474
   kstack.....2FF3B400   audsvc.....00000000
   flags:
Uthread Miscellaneous stuff:
   fstid.....00000000   ioctlrv...00000000   selchn....00000000
   link......00000000   loginfo...00000000
   fselchn...00000000   selbuc........0000
   context64.00000000   context...00000000
   sigssz64..00000000   sigssz....00000000
   stkb64....00000000   stkb......00000000
   jfscr.....00000000
Uthread Signal management:
   sigsp64...00000000   sigsp.....00000000
   code......00000000   oldmask...0000000000000000 
Thread timers:
   timer[0].................00000000

KDB(0)> u -64 print current 64-bit user part of ublock

64-bit process context [2FF7D000]:
   stab.......... @ 2FF7D000
STAB:    esid                 vsid             esid                 vsid
  0 09000000000000B0 000000000714E000   1 0000000000000000 0000000000000000
 16 00000000200000B0 000000000AA75000  17 0000000000000000 0000000000000000
 80 09001000A00000B0 000000000CA99000  81 0000000000000000 0000000000000000
104 00000000D00000B0 000000000D95B000 105 0000000000000000 0000000000000000
128 00000001000000B0 0000000004288000 129 0000000000000000 0000000000000000
136 00000001100000B0 000000000C298000 137 0000000000000000 0000000000000000
160 09002001400000B0 000000000E15C000 161 08002001400000B0 0000000008290000
248 09FFFFFFF00000B0 0000000002945000 249 08FFFFFFF00000B0 0000000001A83000
250 0FFFFFFFF00000B0 000000000BA97000 251 0000000000000000 0000000000000000
254 0000000000000000 0000000000000000 255 0000000000000000 0000000000000000
   stablock...... @ 2FF7E000   stablock.........00000000
   mstext.mst64.. @ 2FF7E008   mstext.remaps. @ 2FF7E140
SNODE... @ 2FF7E3C8
     origin...28020000     freeind..FFFFFFFF     nextind..00000002
     maxind...0006DD82     size.....00000094
UNODE... @ 2FF7E3E0
     origin...2BFA1000     freeind..FFFFFFFF     nextind..0000000E
     maxind...000D4393     size.....0000004C
   maxbreak...00000001100005B8   minbreak...00000001100005B8
   maxdata....0000000000000000   exitexec...00000000
   brkseg.....00000011   stkseg.....FFFFFFFF

KDB(0)> u -f 18 print file decriptor table of thread slot 18
   fdfree[0].00000000   fdfree[1].00000000   fdfree[2].00000000
   maxofile..00000008   freefile..00000000
   fd_lock...2FF3C188 slock/slockp 00000000
File descriptor table at..2FF3C1A0:
   fd      3 fp..100000C0 count..00000000 flags. ALLOCATED
   fd      4 fp..10000180 count..00000001 flags. ALLOCATED
   fd      5 fp..100003C0 count..00000000 flags. ALLOCATED
   fd      6 fp..100005A0 count..00000000 flags. ALLOCATED
   fd      7 fp..10000600 count..00000000 flags. FDLOCK ALLOCATED
   Rest of File Descriptor Table empty or paged out.

[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]