Skip to content

Commit 4dd2aea

Browse files
Daniel Bristot de Oliveirarostedt
authored andcommitted
tracing/timerlat: Print stacktrace in the IRQ handler if needed
If print_stack and stop_tracing_us are set, and stop_tracing_us is hit with latency higher than or equal to print_stack, print the stack at the IRQ handler as it is useful to define the root cause for the IRQ latency. Link: https://lkml.kernel.org/r/fd04530ce98ae9270e41bb124ee5bf67b05ecfed.1652175637.git.bristot@kernel.org Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Clark Williams <williams@redhat.com> Cc: Ingo Molnar <mingo@redhat.com> Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent aa74894 commit 4dd2aea

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

Documentation/trace/timerlat-tracer.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ directory. The timerlat configs are:
7474
- stop_tracing_total_us: stop the system tracing if a
7575
timer latency at the *thread* context is higher than the configured
7676
value happens. Writing 0 disables this option.
77-
- print_stack: save the stack of the IRQ occurrence, and print
78-
it after the *thread context* event".
77+
- print_stack: save the stack of the IRQ occurrence. The stack is printed
78+
after the *thread context* event, or at the IRQ handler if *stop_tracing_us*
79+
is hit.
7980

8081
timerlat and osnoise
8182
----------------------------

kernel/trace/trace_osnoise.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,19 @@ static enum hrtimer_restart timerlat_irq(struct hrtimer *timer)
15801580

15811581
if (osnoise_data.stop_tracing) {
15821582
if (time_to_us(diff) >= osnoise_data.stop_tracing) {
1583+
1584+
/*
1585+
* At this point, if stop_tracing is set and <= print_stack,
1586+
* print_stack is set and would be printed in the thread handler.
1587+
*
1588+
* Thus, print the stack trace as it is helpful to define the
1589+
* root cause of an IRQ latency.
1590+
*/
1591+
if (osnoise_data.stop_tracing <= osnoise_data.print_stack) {
1592+
timerlat_save_stack(0);
1593+
timerlat_dump_stack(time_to_us(diff));
1594+
}
1595+
15831596
osnoise_stop_tracing();
15841597
notify_new_max_latency(diff);
15851598
}

0 commit comments

Comments
 (0)