From: Viktor Rosendahl <viktor.rosendahl@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org
Cc: Joel Fernandes <joel@joelfernandes.org>,
Viktor Rosendahl <viktor.rosendahl@gmail.com>
Subject: [PATCH v2 4/4] ftrace: Add an option for tracing console latencies
Date: Wed, 1 May 2019 22:36:50 +0200 [thread overview]
Message-ID: <20190501203650.29548-5-viktor.rosendahl@gmail.com> (raw)
In-Reply-To: <20190501203650.29548-1-viktor.rosendahl@gmail.com>
This new option CONFIG_TRACE_CONSOLE_LATENCY will enable the latency
tracers to trace the console latencies. Previously this has always been
implicitely disabled. I guess this is because they are considered
to be well known and unavoidable.
However, for some organizations it may nevertheless be desirable to
trace them. Basically, we want to be able to tell that there are
latencies in the system under test because someone has incorrectly
enabled the serial console.
Signed-off-by: Viktor Rosendahl <viktor.rosendahl@gmail.com>
---
include/linux/irqflags.h | 13 +++++++++++++
kernel/printk/printk.c | 5 +++--
kernel/trace/Kconfig | 11 +++++++++++
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
index 21619c92c377..791bee718448 100644
--- a/include/linux/irqflags.h
+++ b/include/linux/irqflags.h
@@ -73,6 +73,19 @@ do { \
# define start_critical_timings() do { } while (0)
#endif
+#ifdef CONFIG_TRACE_CONSOLE_LATENCY
+
+#define console_stop_critical_timings() do {} while (0)
+#define console_start_critical_timings() do {} while (0)
+
+#else /* !CONFIG_TRACE_CONSOLE_LATENCY */
+
+/* don't trace print latency */
+#define console_stop_critical_timings() stop_critical_timings()
+#define console_start_critical_timings() start_critical_timings()
+
+#endif /* !CONFIG_TRACE_CONSOLE_LATENCY */
+
/*
* Wrap the arch provided IRQ routines to provide appropriate checks.
*/
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 02ca827b8fac..710e87f61158 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2448,9 +2448,10 @@ void console_unlock(void)
*/
console_lock_spinning_enable();
- stop_critical_timings(); /* don't trace print latency */
+ /* don't trace print latency if it's disabled */
+ console_stop_critical_timings();
call_console_drivers(ext_text, ext_len, text, len);
- start_critical_timings();
+ console_start_critical_timings();
if (console_lock_spinning_disable_and_check()) {
printk_safe_exit_irqrestore(flags);
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index e5e8f2a0199e..f168d100d4fb 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -244,6 +244,17 @@ config PREEMPT_TRACER
modification of /sys/kernel/debug/tracing/trace through the inotify
interface.
+ config TRACE_CONSOLE_LATENCY
+ bool "Do not turn off latency tracing for the console"
+ default n
+ depends on IRQSOFF_TRACER || PREEMPT_TRACER
+ help
+ Some of the console drivers will cause long unavoidable
+ latencies because they are slow and need to print immediately
+ in a serialized manner. Because of this their latencies are not
+ traced by default. This option will change behavior so that
+ they are traced.
+
config SCHED_TRACER
bool "Scheduling Latency Tracer"
select GENERIC_TRACER
--
2.17.1
next prev parent reply other threads:[~2019-05-01 20:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-01 20:36 [PATCH v2 0/4] Some new features for the preempt/irqsoff tracers Viktor Rosendahl
2019-05-01 20:36 ` [PATCH v2 1/4] ftrace: Implement fs notification for " Viktor Rosendahl
2019-05-04 16:47 ` Joel Fernandes
2019-05-05 19:43 ` Steven Rostedt
2019-05-05 22:39 ` Viktor Rosendahl
2019-05-05 23:01 ` Steven Rostedt
2019-05-05 23:54 ` Viktor Rosendahl
2019-05-06 14:00 ` Joel Fernandes
2019-05-01 20:36 ` [PATCH v2 2/4] preemptirq_delay_test: Add the burst feature and a sysfs trigger Viktor Rosendahl
2019-05-01 20:36 ` [PATCH v2 3/4] Add the latency-collector to tools Viktor Rosendahl
2019-05-01 20:36 ` Viktor Rosendahl [this message]
2019-05-02 1:38 ` [PATCH v2 4/4] ftrace: Add an option for tracing console latencies Steven Rostedt
2019-05-02 18:37 ` Viktor Rosendahl
2019-05-02 21:12 ` 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=20190501203650.29548-5-viktor.rosendahl@gmail.com \
--to=viktor.rosendahl@gmail.com \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
/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
Powered by JetHome