[PATCH v3 0/4] Some new features for the latency tracers

From: Viktor Rosendahl
Date: Mon May 13 2019 - 17:51:50 EST

Hello all,

Changes in v3:
- [PATCH 1/4]:
* I have generalized this to send the fsnotify() notifications for all
tracers that use tracing_max_latency.

* There are large additions of code to prevent queue_work() from being
called while we are in __schedule() or do_idle(). This was a bug also
in the previous version but had gone unnoticed. It became very visible
when I tried to make it work with the wakeup tracers because they are
always invoked from the sched_switch tracepoint.

* The fsnotify notification is issued for tracing_max_latency, not trace.

* I got rid of the kernel config option. The facility is always compiled
when CONFIG_FSNOTIFY is enabled and any of the latency tracers are

- [PATCH 2/4]:
* No significant changes.

- [PATCH 3/4]:
* The latency-collector help messages have been tuned to the fact that it
can be used also with wakeup and hwlat tracers.

* I increased the size of the buffer for reading from

* Adapted it to monitor tracing_max_latency instead of trace

- [PATCH 4/4]:
* I converted this from a kernel config option to a trace config option
that can be changed at runtime.

This series is meant to address two issues with the latency tracing.

The first three patches provide a method to trace latencies that always
occurs very close to each other and to differentiate between them, in spite
of the fact that the latency tracers always work in overwrite mode.

[PATCH 1/4] This implement fs notification for preempt/irqsoff. It makes it
possible for userspace to detect when a new latency has been detected.

[PATCH 2/4] This extends the preemptirq_delay_test module so that it can be
used to generate a burst of closely occurring latencies.

[PATCH 3/4] This adds a user space program to the tools directory that
utilizes the fs notification feature and a randomized algorithm to print out
any of the latencies in a burst with approximately equal probability.

The last patch is not directly connected but doesn't apply cleanly on
its own:

[PATCH 4/4] This adds the option console-latency to the trace options.

best regards,


Viktor Rosendahl (4):
ftrace: Implement fs notification for tracing_max_latency
preemptirq_delay_test: Add the burst feature and a sysfs trigger
Add the latency-collector to tools
ftrace: Add an option for tracing console latencies

include/linux/irqflags.h | 21 +
include/trace/events/power.h | 40 +
include/trace/events/sched.h | 40 +
kernel/printk/printk.c | 6 +-
kernel/sched/core.c | 2 +
kernel/sched/idle.c | 2 +
kernel/trace/Kconfig | 6 +-
kernel/trace/preemptirq_delay_test.c | 145 ++-
kernel/trace/trace.c | 160 +++-
kernel/trace/trace.h | 11 +
kernel/trace/trace_hwlat.c | 4 +-
kernel/trace/trace_irqsoff.c | 12 +
tools/Makefile | 14 +-
tools/trace/Makefile | 20 +
tools/trace/latency-collector.c | 1211 ++++++++++++++++++++++++++
15 files changed, 1661 insertions(+), 33 deletions(-)
create mode 100644 tools/trace/Makefile
create mode 100644 tools/trace/latency-collector.c