From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Juri Lelli <juri.lelli@redhat.com>,
Clark Williams <williams@redhat.com>,
Ingo Molnar <mingo@redhat.com>,
Daniel Bristot de Oliveira <bristot@kernel.org>
Subject: [for-next][PATCH 10/23] tracing/timerlat: Print stacktrace in the IRQ handler if needed
Date: Fri, 27 May 2022 22:50:38 -0400 [thread overview]
Message-ID: <20220528025250.483799146@goodmis.org> (raw)
In-Reply-To: 20220528025028.850906216@goodmis.org
From: Daniel Bristot de Oliveira <bristot@kernel.org>
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>
---
Documentation/trace/timerlat-tracer.rst | 5 +++--
kernel/trace/trace_osnoise.c | 13 +++++++++++++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/Documentation/trace/timerlat-tracer.rst b/Documentation/trace/timerlat-tracer.rst
index 64d1fe6e9b93..d643c95c01eb 100644
--- a/Documentation/trace/timerlat-tracer.rst
+++ b/Documentation/trace/timerlat-tracer.rst
@@ -74,8 +74,9 @@ directory. The timerlat configs are:
- stop_tracing_total_us: stop the system tracing if a
timer latency at the *thread* context is higher than the configured
value happens. Writing 0 disables this option.
- - print_stack: save the stack of the IRQ occurrence, and print
- it after the *thread context* event".
+ - print_stack: save the stack of the IRQ occurrence. The stack is printed
+ after the *thread context* event, or at the IRQ handler if *stop_tracing_us*
+ is hit.
timerlat and osnoise
----------------------------
diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 6494ca27ea6f..9b204ee3c6f5 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -1580,6 +1580,19 @@ static enum hrtimer_restart timerlat_irq(struct hrtimer *timer)
if (osnoise_data.stop_tracing) {
if (time_to_us(diff) >= osnoise_data.stop_tracing) {
+
+ /*
+ * At this point, if stop_tracing is set and <= print_stack,
+ * print_stack is set and would be printed in the thread handler.
+ *
+ * Thus, print the stack trace as it is helpful to define the
+ * root cause of an IRQ latency.
+ */
+ if (osnoise_data.stop_tracing <= osnoise_data.print_stack) {
+ timerlat_save_stack(0);
+ timerlat_dump_stack(time_to_us(diff));
+ }
+
osnoise_stop_tracing();
notify_new_max_latency(diff);
}
--
2.35.1
next prev parent reply other threads:[~2022-05-28 2:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-28 2:50 [for-next][PATCH 00/23] tracing: Last minute fixes and updates for 5.19 Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 01/23] tracing: Have event format check not flag %p* on __get_dynamic_array() Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 02/23] tracing: Reset the function filter after completing trampoline/graph selftest Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 03/23] tracing: Use trace_create_file() to simplify creation of tracefs entries Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 04/23] ftrace: Deal with error return code of the ftrace_process_locs() function Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 05/23] tracing: Use strim() to remove whitespace instead of doing it manually Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 06/23] tracing: Fix potential double free in create_var_ref() Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 07/23] tracing: Fix return value of trace_pid_write() Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 09/23] tracing/timerlat: Notify IRQ new max latency only if stop tracing is set Steven Rostedt
2022-05-28 2:50 ` Steven Rostedt [this message]
2022-05-28 2:50 ` [for-next][PATCH 11/23] tracing/timerlat: Do not wakeup the thread if the trace stops at the IRQ Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 12/23] tracing: Change "char *" string form to "char []" Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 13/23] tracing: Cleanup code by removing init "char *name" Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 14/23] ftrace: Remove return value of ftrace_arch_modify_*() Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 15/23] ftrace: Fix typo in comment Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 16/23] tracing: Initialize integer variable to prevent garbage return value Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 17/23] tracing: Disable kcov on trace_preemptirq.c Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 18/23] tracing: Fix comments of create_filter() Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 19/23] ftrace: Clean up hash direct_functions on register failures Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 20/23] x86,tracing: Remove unused headers Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 21/23] x86/traceponit: Fix comment about irq vector tracepoints Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 22/23] tracing: Fix comments for event_trigger_separate_filter() Steven Rostedt
2022-05-28 2:50 ` [for-next][PATCH 23/23] ftrace: Add FTRACE_MCOUNT_MAX_OFFSET to avoid adding weak function Steven Rostedt
2022-05-28 3:17 ` [for-next][PATCH 00/23] tracing: Last minute fixes and updates for 5.19 Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220528025250.483799146@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=bristot@kernel.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).