mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
tracing latency updates for 7.2:
- Dump the stack to the buffer on timerlat uret threashold event Record the stack trace in the buffer for THREAD_URET as well as THREAD_CONTEXT when the threshold is hit. Otherwise, if the threshold was not hit at task wakeup, but was at task return, it will not produce a stack trace making it harder to debug. - Have osnoise trace prints print to all buffers The osnoise tracer is allowed to print to the main buffer. Add a osnoise_print() helper function and use trace_array_vprintk() to print osnoise output. -----BEGIN PGP SIGNATURE----- iIoEABYKADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCajDrBBQccm9zdGVkdEBn b29kbWlzLm9yZwAKCRAp5XQQmuv6qgpwAQDmFBFP3dU6LiGp6U3UTYauAApah401 zXfmNxbGFO5rmwEAxIHCzoG3OZgrjrYhrkW9qBZDho7+1Frt7vphK71fYAE= =0ayh -----END PGP SIGNATURE----- Merge tag 'trace-latency-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace Pull tracing latency updates from Steven Rostedt: - Dump the stack to the buffer on timerlat uret threashold event Record the stack trace in the buffer for THREAD_URET as well as THREAD_CONTEXT when the threshold is hit. Otherwise, if the threshold was not hit at task wakeup, but was at task return, it will not produce a stack trace making it harder to debug. - Have osnoise trace prints print to all buffers The osnoise tracer is allowed to print to the main buffer. Add a osnoise_print() helper function and use trace_array_vprintk() to print osnoise output. * tag 'trace-latency-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: tracing/osnoise: Array printk init and cleanup tracing/osnoise: Dump stack on timerlat uret threshold event
This commit is contained in:
commit
c071a4fbb0
|
|
@ -83,6 +83,22 @@ struct osnoise_instance {
|
|||
|
||||
static struct list_head osnoise_instances;
|
||||
|
||||
static void osnoise_print(const char *fmt, ...)
|
||||
{
|
||||
struct osnoise_instance *inst;
|
||||
struct trace_array *tr;
|
||||
va_list ap;
|
||||
|
||||
rcu_read_lock();
|
||||
list_for_each_entry_rcu(inst, &osnoise_instances, list) {
|
||||
tr = inst->tr;
|
||||
va_start(ap, fmt);
|
||||
trace_array_vprintk(tr, _RET_IP_, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
static bool osnoise_has_registered_instances(void)
|
||||
{
|
||||
return !!list_first_or_null_rcu(&osnoise_instances,
|
||||
|
|
@ -123,6 +139,7 @@ static int osnoise_register_instance(struct trace_array *tr)
|
|||
* trace_types_lock.
|
||||
*/
|
||||
lockdep_assert_held(&trace_types_lock);
|
||||
trace_array_init_printk(tr);
|
||||
|
||||
inst = kmalloc_obj(*inst);
|
||||
if (!inst)
|
||||
|
|
@ -471,15 +488,7 @@ static void print_osnoise_headers(struct seq_file *s)
|
|||
* osnoise_taint - report an osnoise error.
|
||||
*/
|
||||
#define osnoise_taint(msg) ({ \
|
||||
struct osnoise_instance *inst; \
|
||||
struct trace_buffer *buffer; \
|
||||
\
|
||||
rcu_read_lock(); \
|
||||
list_for_each_entry_rcu(inst, &osnoise_instances, list) { \
|
||||
buffer = inst->tr->array_buffer.buffer; \
|
||||
trace_array_printk_buf(buffer, _THIS_IP_, msg); \
|
||||
} \
|
||||
rcu_read_unlock(); \
|
||||
osnoise_print(msg); \
|
||||
osnoise_data.tainted = true; \
|
||||
})
|
||||
|
||||
|
|
@ -1189,10 +1198,10 @@ static __always_inline void osnoise_stop_exception(char *msg, int cpu)
|
|||
rcu_read_lock();
|
||||
list_for_each_entry_rcu(inst, &osnoise_instances, list) {
|
||||
tr = inst->tr;
|
||||
trace_array_printk_buf(tr->array_buffer.buffer, _THIS_IP_,
|
||||
"stop tracing hit on cpu %d due to exception: %s\n",
|
||||
smp_processor_id(),
|
||||
msg);
|
||||
trace_array_printk(tr, _THIS_IP_,
|
||||
"stop tracing hit on cpu %d due to exception: %s\n",
|
||||
smp_processor_id(),
|
||||
msg);
|
||||
|
||||
if (test_bit(OSN_PANIC_ON_STOP, &osnoise_options))
|
||||
panic("tracer hit on cpu %d due to exception: %s\n",
|
||||
|
|
@ -1362,8 +1371,8 @@ static __always_inline void osnoise_stop_tracing(void)
|
|||
rcu_read_lock();
|
||||
list_for_each_entry_rcu(inst, &osnoise_instances, list) {
|
||||
tr = inst->tr;
|
||||
trace_array_printk_buf(tr->array_buffer.buffer, _THIS_IP_,
|
||||
"stop tracing hit on cpu %d\n", smp_processor_id());
|
||||
trace_array_printk(tr, _THIS_IP_,
|
||||
"stop tracing hit on cpu %d\n", smp_processor_id());
|
||||
|
||||
if (test_bit(OSN_PANIC_ON_STOP, &osnoise_options))
|
||||
panic("tracer hit stop condition on CPU %d\n", smp_processor_id());
|
||||
|
|
@ -2544,9 +2553,12 @@ timerlat_fd_read(struct file *file, char __user *ubuf, size_t count,
|
|||
notify_new_max_latency(diff);
|
||||
|
||||
tlat->tracing_thread = false;
|
||||
if (osnoise_data.stop_tracing_total)
|
||||
if (time_to_us(diff) >= osnoise_data.stop_tracing_total)
|
||||
if (osnoise_data.stop_tracing_total) {
|
||||
if (time_to_us(diff) >= osnoise_data.stop_tracing_total) {
|
||||
timerlat_dump_stack(time_to_us(diff));
|
||||
osnoise_stop_tracing();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tlat->tracing_thread = false;
|
||||
tlat->kthread = current;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user