While doing some performance work on FreeBSD stable/12, I needed to use lockstat and noticed that it was broken.
1
2
3
|
root@Test:~ # lockstat -H sleep 1
lockstat: failed to compile program: in action list: operator -> cannot be applied to a
forward declaration: no struct mtx definition is available
|
And another, while working on an issue with a netgraph module:
1
2
|
dtrace: failed to compile script ./ng_test.d.tmtidpid: line 1: failed to resolve type gid_t for
identifier gid: Unknown type name
|
And another,
1
2
|
dtrace: failed to compile script ./ng_test.d.tmtid: line 1: failed to resolve type
kernel`struct thread * for identifier curthread: Module does not contain any CTF data
|
The kernel configuration had the appropriate hooks for Dtrace and I had loaded the kernel module dtraceall.ko. The fix turned out to be quite easy.
Add the following item to the kernel and rebuild:
1
|
makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support
|
And now, you’ve got lockstat working:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
root@Test:~ # lockstat -H sleep 1 | head -30
lockstat: warning: 3 dynamic variable drops with non-empty rinsing list
lockstat: warning: 20182 dynamic variable drops with non-empty dirty list
lockstat: warning: 1126 dynamic variable drops with non-empty dirty list
lockstat: warning: ran out of data records (use -n for more)
Adaptive mutex hold: 4155 events in 1.047 seconds (3967 events/sec)
Count indv cuml rcnt nsec Lock Caller
-------------------------------------------------------------------------------
1531 37% 37% 0.00 11038 dn_uh dummynet_task+0x33d
368 9% 46% 0.00 2406 vm page vm_page_rename+0x21f
293 7% 53% 0.00 2128 IP reassembly ipreass_slowtimo+0x2e
243 6% 59% 0.00 2217 IPFW dynamic bucket dyn_expire_states+0x57
141 3% 62% 0.00 2499 reseed mutex random_kthread+0x79
118 3% 65% 0.00 5372 pmap pmap_is_prefaultable+0x17e
102 2% 67% 0.00 4420 select mtxpool selfdfree+0x128
77 2% 69% 0.00 25941 socket sopoll_generic+0x3b8
70 2% 71% 0.00 13838 pmap pmap_enter+0x9e8
63 2% 72% 0.00 4584 vm page vm_fault_hold+0x2018
63 2% 74% 0.00 22014 so_snd sopoll_generic+0x39f
63 2% 75% 0.00 12786 so_rcv sopoll_generic+0x37a
52 1% 77% 0.00 6578 select mtxpool sopoll_generic+0x195
42 1% 78% 0.00 4749 select mtxpool pipe_poll+0x153
42 1% 79% 0.00 12139 pipe mutex pipe_poll+0x201
26 1% 79% 0.00 5404 so_rcv soreceive_generic+0x1209
23 1% 80% 0.00 53395 pmap pmap_copy+0x709
23 1% 80% 0.00 57370 pmap pmap_copy+0x6f2
22 1% 81% 0.00 13657 vm page release_page+0xcb
22 1% 81% 0.00 5126 vm active pagequeue vm_page_deactivate+0x29
22 1% 82% 0.00 4760 so_rcv soreceive_generic+0x10ec
21 1% 82% 0.00 32487 so_rcv sowakeup+0x133
20 0% 83% 0.00 6316 vm reserv vm_reserv_extend+0x151
20 0% 83% 0.00 4081 pf states uma_zone_get_cur+0xdd
20 0% 84% 0.00 5079 ng_worklist ngthread+0xed
|