1criticalstat(8) System Manager's Manual criticalstat(8)
2
3
4
6 criticalstat - A tracer to find and report long atomic critical sec‐
7 tions in kernel
8
10 criticalstat [-h] [-p] [-i] [-d DURATION]
11
13 criticalstat traces and reports occurrences of atomic critical sections
14 in the kernel with useful stacktraces showing the origin of them. Such
15 critical sections frequently occur due to use of spinlocks, or if in‐
16 terrupts or preemption were explicitly disabled by a driver. IRQ rou‐
17 tines in Linux are also executed with interrupts disabled. There are
18 many reasons. Such critical sections are a source of long latency/re‐
19 sponsive issues for real-time systems.
20
21 This works by probing the preempt/irq and cpuidle tracepoints in the
22 kernel. Since this uses BPF, only the root user can use this tool.
23 Further, the kernel has to be built with certain CONFIG options en‐
24 abled. See below.
25
26
28 Enable CONFIG_PREEMPT_TRACER, CONFIG_PREEMPTIRQ_EVENTS (CONFIG_PREEMP‐
29 TIRQ_TRACEPOINTS in kernel 4.19 and later) and CONFIG_DEBUG_PREEMPT.
30 Additionally, the following options should be DISABLED on older ker‐
31 nels: CONFIG_PROVE_LOCKING, CONFIG_LOCKDEP.
32
34 -h Print usage message.
35
36 -p Find long sections where preemption was disabled on local CPU.
37
38 -i Find long sections where interrupt was disabled on local CPU.
39
40 -d DURATION
41 Only identify sections that are longer than DURATION in mi‐
42 croseconds.
43
45 Run with default options: irq disabled for more than 100 uS
46 # criticalstat
47
48 Find sections with preemption disabled for more than 100 uS.
49 # criticalstat -p
50
51 Find sections with IRQ disabled for more than 500 uS.
52 # criticalstat -d 500
53
54 Find sections with preemption disabled for more than 500 uS.
55 # criticalstat -p -d 500
56
58 This tool can cause overhead if the application is spending a lot of
59 time in kernel mode. The overhead is variable but can be 2-4% of per‐
60 formance degradation. If overhead is seen to be too much, please pass a
61 higher DURATION to the -d option to filter more aggressively.
62
63
65 This is from bcc.
66
67 https://github.com/iovisor/bcc
68
69 Also look in the bcc distribution for a companion _examples.txt file
70 containing example usage, output, and commentary for this tool.
71
73 Linux
74
76 Unstable - in development.
77
79 Joel Fernandes
80
82 Linux kernel's preemptoff and irqoff tracers.
83
84
85
86
87USER COMMANDS 2018-06-07 criticalstat(8)