rtla-timerlat-top.rst 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. ====================
  2. rtla-timerlat-top
  3. ====================
  4. -------------------------------------------
  5. Measures the operating system timer latency
  6. -------------------------------------------
  7. :Manual section: 1
  8. SYNOPSIS
  9. ========
  10. **rtla timerlat top** [*OPTIONS*] ...
  11. DESCRIPTION
  12. ===========
  13. .. include:: common_timerlat_description.rst
  14. The **rtla timerlat top** displays a summary of the periodic output
  15. from the *timerlat* tracer. It also provides information for each
  16. operating system noise via the **osnoise:** tracepoints that can be
  17. seem with the option **-T**.
  18. OPTIONS
  19. =======
  20. .. include:: common_timerlat_options.rst
  21. .. include:: common_top_options.rst
  22. .. include:: common_options.rst
  23. EXAMPLE
  24. =======
  25. In the example below, the *timerlat* tracer is set to capture the stack trace at
  26. the IRQ handler, printing it to the buffer if the *Thread* timer latency is
  27. higher than *30 us*. It is also set to stop the session if a *Thread* timer
  28. latency higher than *30 us* is hit. Finally, it is set to save the trace
  29. buffer if the stop condition is hit::
  30. [root@alien ~]# rtla timerlat top -s 30 -T 30 -t
  31. Timer Latency
  32. 0 00:00:59 | IRQ Timer Latency (us) | Thread Timer Latency (us)
  33. CPU COUNT | cur min avg max | cur min avg max
  34. 0 #58634 | 1 0 1 10 | 11 2 10 23
  35. 1 #58634 | 1 0 1 9 | 12 2 9 23
  36. 2 #58634 | 0 0 1 11 | 10 2 9 23
  37. 3 #58634 | 1 0 1 11 | 11 2 9 24
  38. 4 #58634 | 1 0 1 10 | 11 2 9 26
  39. 5 #58634 | 1 0 1 8 | 10 2 9 25
  40. 6 #58634 | 12 0 1 12 | 30 2 10 30 <--- CPU with spike
  41. 7 #58634 | 1 0 1 9 | 11 2 9 23
  42. 8 #58633 | 1 0 1 9 | 11 2 9 26
  43. 9 #58633 | 1 0 1 9 | 10 2 9 26
  44. 10 #58633 | 1 0 1 13 | 11 2 9 28
  45. 11 #58633 | 1 0 1 13 | 12 2 9 24
  46. 12 #58633 | 1 0 1 8 | 10 2 9 23
  47. 13 #58633 | 1 0 1 10 | 10 2 9 22
  48. 14 #58633 | 1 0 1 18 | 12 2 9 27
  49. 15 #58633 | 1 0 1 10 | 11 2 9 28
  50. 16 #58633 | 0 0 1 11 | 7 2 9 26
  51. 17 #58633 | 1 0 1 13 | 10 2 9 24
  52. 18 #58633 | 1 0 1 9 | 13 2 9 22
  53. 19 #58633 | 1 0 1 10 | 11 2 9 23
  54. 20 #58633 | 1 0 1 12 | 11 2 9 28
  55. 21 #58633 | 1 0 1 14 | 11 2 9 24
  56. 22 #58633 | 1 0 1 8 | 11 2 9 22
  57. 23 #58633 | 1 0 1 10 | 11 2 9 27
  58. timerlat hit stop tracing
  59. saving trace to timerlat_trace.txt
  60. [root@alien bristot]# tail -60 timerlat_trace.txt
  61. [...]
  62. timerlat/5-79755 [005] ....... 426.271226: #58634 context thread timer_latency 10823 ns
  63. sh-109404 [006] dnLh213 426.271247: #58634 context irq timer_latency 12505 ns
  64. sh-109404 [006] dNLh313 426.271258: irq_noise: local_timer:236 start 426.271245463 duration 12553 ns
  65. sh-109404 [006] d...313 426.271263: thread_noise: sh:109404 start 426.271245853 duration 4769 ns
  66. timerlat/6-79756 [006] ....... 426.271264: #58634 context thread timer_latency 30328 ns
  67. timerlat/6-79756 [006] ....1.. 426.271265: <stack trace>
  68. => timerlat_irq
  69. => __hrtimer_run_queues
  70. => hrtimer_interrupt
  71. => __sysvec_apic_timer_interrupt
  72. => sysvec_apic_timer_interrupt
  73. => asm_sysvec_apic_timer_interrupt
  74. => _raw_spin_unlock_irqrestore <---- spinlock that disabled interrupt.
  75. => try_to_wake_up
  76. => autoremove_wake_function
  77. => __wake_up_common
  78. => __wake_up_common_lock
  79. => ep_poll_callback
  80. => __wake_up_common
  81. => __wake_up_common_lock
  82. => fsnotify_add_event
  83. => inotify_handle_inode_event
  84. => fsnotify
  85. => __fsnotify_parent
  86. => __fput
  87. => task_work_run
  88. => exit_to_user_mode_prepare
  89. => syscall_exit_to_user_mode
  90. => do_syscall_64
  91. => entry_SYSCALL_64_after_hwframe
  92. => 0x7265000001378c
  93. => 0x10000cea7
  94. => 0x25a00000204a
  95. => 0x12e302d00000000
  96. => 0x19b51010901b6
  97. => 0x283ce00726500
  98. => 0x61ea308872
  99. => 0x00000fe3
  100. bash-109109 [007] d..h... 426.271265: #58634 context irq timer_latency 1211 ns
  101. timerlat/6-79756 [006] ....... 426.271267: timerlat_main: stop tracing hit on cpu 6
  102. In the trace, it is possible the notice that the *IRQ* timer latency was
  103. already high, accounting *12505 ns*. The IRQ delay was caused by the
  104. *bash-109109* process that disabled IRQs in the wake-up path
  105. (*_try_to_wake_up()* function). The duration of the IRQ handler that woke
  106. up the timerlat thread, informed with the **osnoise:irq_noise** event, was
  107. also high and added more *12553 ns* to the Thread latency. Finally, the
  108. **osnoise:thread_noise** added by the currently running thread (including
  109. the scheduling overhead) added more *4769 ns*. Summing up these values,
  110. the *Thread* timer latency accounted for *30328 ns*.
  111. The primary reason for this high value is the wake-up path that was hit
  112. twice during this case: when the *bash-109109* was waking up a thread
  113. and then when the *timerlat* thread was awakened. This information can
  114. then be used as the starting point of a more fine-grained analysis.
  115. Note that **rtla timerlat** was dispatched without changing *timerlat* tracer
  116. threads' priority. That is generally not needed because these threads hava
  117. priority *FIFO:95* by default, which is a common priority used by real-time
  118. kernel developers to analyze scheduling delays.
  119. SEE ALSO
  120. --------
  121. **rtla-timerlat**\(1), **rtla-timerlat-hist**\(1)
  122. *timerlat* tracer documentation: <https://www.kernel.org/doc/html/latest/trace/timerlat-tracer.html>
  123. AUTHOR
  124. ------
  125. Written by Daniel Bristot de Oliveira <[email protected]>
  126. .. include:: common_appendix.rst