rtla-timerlat-top.rst 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. .. include:: common_timerlat_aa.rst
  24. **--aa-only** *us*
  25. Set stop tracing conditions and run without collecting and displaying statistics.
  26. Print the auto-analysis if the system hits the stop tracing condition. This option
  27. is useful to reduce rtla timerlat CPU, enabling the debug without the overhead of
  28. collecting the statistics.
  29. EXAMPLE
  30. =======
  31. In the example below, the timerlat tracer is dispatched in cpus *1-23* in the
  32. automatic trace mode, instructing the tracer to stop if a *40 us* latency or
  33. higher is found::
  34. # timerlat -a 40 -c 1-23 -q
  35. Timer Latency
  36. 0 00:00:12 | IRQ Timer Latency (us) | Thread Timer Latency (us)
  37. CPU COUNT | cur min avg max | cur min avg max
  38. 1 #12322 | 0 0 1 15 | 10 3 9 31
  39. 2 #12322 | 3 0 1 12 | 10 3 9 23
  40. 3 #12322 | 1 0 1 21 | 8 2 8 34
  41. 4 #12322 | 1 0 1 17 | 10 2 11 33
  42. 5 #12322 | 0 0 1 12 | 8 3 8 25
  43. 6 #12322 | 1 0 1 14 | 16 3 11 35
  44. 7 #12322 | 0 0 1 14 | 9 2 8 29
  45. 8 #12322 | 1 0 1 22 | 9 3 9 34
  46. 9 #12322 | 0 0 1 14 | 8 2 8 24
  47. 10 #12322 | 1 0 0 12 | 9 3 8 24
  48. 11 #12322 | 0 0 0 15 | 6 2 7 29
  49. 12 #12321 | 1 0 0 13 | 5 3 8 23
  50. 13 #12319 | 0 0 1 14 | 9 3 9 26
  51. 14 #12321 | 1 0 0 13 | 6 2 8 24
  52. 15 #12321 | 1 0 1 15 | 12 3 11 27
  53. 16 #12318 | 0 0 1 13 | 7 3 10 24
  54. 17 #12319 | 0 0 1 13 | 11 3 9 25
  55. 18 #12318 | 0 0 0 12 | 8 2 8 20
  56. 19 #12319 | 0 0 1 18 | 10 2 9 28
  57. 20 #12317 | 0 0 0 20 | 9 3 8 34
  58. 21 #12318 | 0 0 0 13 | 8 3 8 28
  59. 22 #12319 | 0 0 1 11 | 8 3 10 22
  60. 23 #12320 | 28 0 1 28 | 41 3 11 41
  61. rtla timerlat hit stop tracing
  62. ## CPU 23 hit stop tracing, analyzing it ##
  63. IRQ handler delay: 27.49 us (65.52 %)
  64. IRQ latency: 28.13 us
  65. Timerlat IRQ duration: 9.59 us (22.85 %)
  66. Blocking thread: 3.79 us (9.03 %)
  67. objtool:49256 3.79 us
  68. Blocking thread stacktrace
  69. -> timerlat_irq
  70. -> __hrtimer_run_queues
  71. -> hrtimer_interrupt
  72. -> __sysvec_apic_timer_interrupt
  73. -> sysvec_apic_timer_interrupt
  74. -> asm_sysvec_apic_timer_interrupt
  75. -> _raw_spin_unlock_irqrestore
  76. -> cgroup_rstat_flush_locked
  77. -> cgroup_rstat_flush_irqsafe
  78. -> mem_cgroup_flush_stats
  79. -> mem_cgroup_wb_stats
  80. -> balance_dirty_pages
  81. -> balance_dirty_pages_ratelimited_flags
  82. -> btrfs_buffered_write
  83. -> btrfs_do_write_iter
  84. -> vfs_write
  85. -> __x64_sys_pwrite64
  86. -> do_syscall_64
  87. -> entry_SYSCALL_64_after_hwframe
  88. ------------------------------------------------------------------------
  89. Thread latency: 41.96 us (100%)
  90. The system has exit from idle latency!
  91. Max timerlat IRQ latency from idle: 17.48 us in cpu 4
  92. Saving trace to timerlat_trace.txt
  93. In this case, the major factor was the delay suffered by the *IRQ handler*
  94. that handles **timerlat** wakeup: *65.52%*. This can be caused by the
  95. current thread masking interrupts, which can be seen in the blocking
  96. thread stacktrace: the current thread (*objtool:49256*) disabled interrupts
  97. via *raw spin lock* operations inside mem cgroup, while doing write
  98. syscall in a btrfs file system.
  99. The raw trace is saved in the **timerlat_trace.txt** file for further analysis.
  100. Note that **rtla timerlat** was dispatched without changing *timerlat* tracer
  101. threads' priority. That is generally not needed because these threads have
  102. priority *FIFO:95* by default, which is a common priority used by real-time
  103. kernel developers to analyze scheduling delays.
  104. SEE ALSO
  105. --------
  106. **rtla-timerlat**\(1), **rtla-timerlat-hist**\(1)
  107. *timerlat* tracer documentation: <https://www.kernel.org/doc/html/latest/trace/timerlat-tracer.html>
  108. AUTHOR
  109. ------
  110. Written by Daniel Bristot de Oliveira <bristot@kernel.org>
  111. .. include:: common_appendix.rst