mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 07:10:27 +00:00
trace/hwlat: Remove printk from sampling loop
hwlat has some time operation checks on the sample loop, and it is currently using pr_err (printk) to report them. The problem is that this can lead the system to an unresponsible state due to an overflow of printk messages. This problem can be mitigated by writing the error message to the trace buffer. Remove the printk messages from the sampling loop, switching the to messages in the trace buffer. No functional change. Link: https://lkml.kernel.org/r/9d77c34869748aa105e965c769d24642914eea3a.1624372313.git.bristot@redhat.com Cc: Phil Auld <pauld@redhat.com> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Kate Carcia <kcarcia@redhat.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Ingo Molnar <mingo@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Alexandre Chartre <alexandre.chartre@oracle.com> Cc: Clark Willaims <williams@redhat.com> Cc: John Kacur <jkacur@redhat.com> Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: x86@kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
parent
f27a1c9e1b
commit
aa892f8c88
@ -182,6 +182,15 @@ void trace_hwlat_callback(bool enter)
|
|||||||
kdata->nmi_count++;
|
kdata->nmi_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* hwlat_err - report a hwlat error.
|
||||||
|
*/
|
||||||
|
#define hwlat_err(msg) ({ \
|
||||||
|
struct trace_array *tr = hwlat_trace; \
|
||||||
|
\
|
||||||
|
trace_array_printk_buf(tr->array_buffer.buffer, _THIS_IP_, msg); \
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_sample - sample the CPU TSC and look for likely hardware latencies
|
* get_sample - sample the CPU TSC and look for likely hardware latencies
|
||||||
*
|
*
|
||||||
@ -225,7 +234,7 @@ static int get_sample(void)
|
|||||||
outer_diff = time_to_us(time_sub(t1, last_t2));
|
outer_diff = time_to_us(time_sub(t1, last_t2));
|
||||||
/* This shouldn't happen */
|
/* This shouldn't happen */
|
||||||
if (outer_diff < 0) {
|
if (outer_diff < 0) {
|
||||||
pr_err(BANNER "time running backwards\n");
|
hwlat_err(BANNER "time running backwards\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (outer_diff > outer_sample)
|
if (outer_diff > outer_sample)
|
||||||
@ -237,7 +246,7 @@ static int get_sample(void)
|
|||||||
|
|
||||||
/* Check for possible overflows */
|
/* Check for possible overflows */
|
||||||
if (total < last_total) {
|
if (total < last_total) {
|
||||||
pr_err("Time total overflowed\n");
|
hwlat_err("Time total overflowed\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
last_total = total;
|
last_total = total;
|
||||||
@ -253,7 +262,7 @@ static int get_sample(void)
|
|||||||
|
|
||||||
/* This shouldn't happen */
|
/* This shouldn't happen */
|
||||||
if (diff < 0) {
|
if (diff < 0) {
|
||||||
pr_err(BANNER "time running backwards\n");
|
hwlat_err(BANNER "time running backwards\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user