Skip to content

Commit

Permalink
Merge tag 'trace-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/rostedt/linux-trace

Pull tracing updates from Steven Rostedt:
 "New:

   - The Real Time Linux Analysis (RTLA) tool is added to the tools
     directory.

   - Can safely filter on user space pointers with: field.ustring ~
     "match-string"

   - eprobes can now be filtered like any other event.

   - trace_marker(_raw) now uses stream_open() to allow multiple threads
     to safely write to it. Note, this could possibly break existing
     user space, but we will not know until we hear about it, and then
     can revert the change if need be.

   - New field in events to display when bottom halfs are disabled.

   - Sorting of the ftrace functions are now done at compile time
     instead of at bootup.

  Infrastructure changes to support future efforts:

   - Added __rel_loc type for trace events. Similar to __data_loc but
     the offset to the dynamic data is based off of the location of the
     descriptor and not the beginning of the event. Needed for user
     defined events.

   - Some simplification of event trigger code.

   - Make synthetic events process its callback better to not hinder
     other event callbacks that are registered. Needed for user defined
     events.

  And other small fixes and cleanups"

* tag 'trace-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (50 commits)
  tracing: Add ustring operation to filtering string pointers
  rtla: Add rtla timerlat hist documentation
  rtla: Add rtla timerlat top documentation
  rtla: Add rtla timerlat documentation
  rtla: Add rtla osnoise hist documentation
  rtla: Add rtla osnoise top documentation
  rtla: Add rtla osnoise man page
  rtla: Add Documentation
  rtla/timerlat: Add timerlat hist mode
  rtla: Add timerlat tool and timelart top mode
  rtla/osnoise: Add the hist mode
  rtla/osnoise: Add osnoise top mode
  rtla: Add osnoise tool
  rtla: Helper functions for rtla
  rtla: Real-Time Linux Analysis tool
  tracing/osnoise: Properly unhook events if start_per_cpu_kthreads() fails
  tracing: Remove duplicate warnings when calling trace_create_file()
  tracing/kprobes: 'nmissed' not showed correctly for kretprobe
  tracing: Add test for user space strings when filtering on string pointers
  tracing: Have syscall trace events use trace_event_buffer_lock_reserve()
  ...
  • Loading branch information
torvalds committed Jan 16, 2022
2 parents 77dbd72 + f37c3bb commit 4d66020
Show file tree
Hide file tree
Showing 70 changed files with 6,706 additions and 292 deletions.
41 changes: 41 additions & 0 deletions Documentation/tools/rtla/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SPDX-License-Identifier: GPL-2.0-only
# Based on bpftool's Documentation Makefile

INSTALL ?= install
RM ?= rm -f
RMDIR ?= rmdir --ignore-fail-on-non-empty

PREFIX ?= /usr/share
MANDIR ?= $(PREFIX)/man
MAN1DIR = $(MANDIR)/man1

MAN1_RST = $(wildcard rtla*.rst)

_DOC_MAN1 = $(patsubst %.rst,%.1,$(MAN1_RST))
DOC_MAN1 = $(addprefix $(OUTPUT),$(_DOC_MAN1))

RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
RST2MAN_OPTS += --verbose

$(OUTPUT)%.1: %.rst
ifndef RST2MAN_DEP
$(error "rst2man not found, but required to generate man pages")
endif
rst2man $(RST2MAN_OPTS) $< > $@

man1: $(DOC_MAN1)
man: man1

clean:
$(RM) $(DOC_MAN1)

install: man
$(INSTALL) -d -m 755 $(DESTDIR)$(MAN1DIR)
$(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(MAN1DIR)

uninstall:
$(RM) $(addprefix $(DESTDIR)$(MAN1DIR)/,$(_DOC_MAN1))
$(RMDIR) $(DESTDIR)$(MAN1DIR)

.PHONY: man man1 clean install uninstall
.DEFAULT_GOAL := man
12 changes: 12 additions & 0 deletions Documentation/tools/rtla/common_appendix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
REPORTING BUGS
==============
Report bugs to <[email protected]>

LICENSE
=======
**rtla** is Free Software licensed under the GNU GPLv2

COPYING
=======
Copyright \(C) 2021 Red Hat, Inc. Free use of this software is granted under
the terms of the GNU Public License (GPL).
23 changes: 23 additions & 0 deletions Documentation/tools/rtla/common_hist_options.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**-b**, **--bucket-size** *N*

Set the histogram bucket size (default *1*).

**-e**, **--entries** *N*

Set the number of entries of the histogram (default 256).

**--no-header**

Do not print header.

**--no-summary**

Do not print summary.

**--no-index**

Do not print index.

**--with-zeros**

Print zero only entries.
28 changes: 28 additions & 0 deletions Documentation/tools/rtla/common_options.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
**-c**, **--cpus** *cpu-list*

Set the osnoise tracer to run the sample threads in the cpu-list.

**-d**, **--duration** *time[s|m|h|d]*

Set the duration of the session.

**-D**, **--debug**

Print debug info.

**-t**, **--trace**\[*=file*]

Save the stopped trace to [*file|osnoise_trace.txt*].

**-P**, **--priority** *o:prio|r:prio|f:prio|d:runtime:period*

Set scheduling parameters to the osnoise tracer threads, the format to set the priority are:

- *o:prio* - use SCHED_OTHER with *prio*;
- *r:prio* - use SCHED_RR with *prio*;
- *f:prio* - use SCHED_FIFO with *prio*;
- *d:runtime[us|ms|s]:period[us|ms|s]* - use SCHED_DEADLINE with *runtime* and *period* in nanoseconds.

**-h**, **--help**

Print help menu.
8 changes: 8 additions & 0 deletions Documentation/tools/rtla/common_osnoise_description.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The **rtla osnoise** tool is an interface for the *osnoise* tracer. The
*osnoise* tracer dispatches a kernel thread per-cpu. These threads read the
time in a loop while with preemption, softirq and IRQs enabled, thus
allowing all the sources of operating systme noise during its execution.
The *osnoise*'s tracer threads take note of the delta between each time
read, along with an interference counter of all sources of interference.
At the end of each period, the *osnoise* tracer displays a summary of
the results.
17 changes: 17 additions & 0 deletions Documentation/tools/rtla/common_osnoise_options.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
**-p**, **--period** *us*

Set the *osnoise* tracer period in microseconds.

**-r**, **--runtime** *us*

Set the *osnoise* tracer runtime in microseconds.

**-s**, **--stop** *us*

Stop the trace if a single sample is higher than the argument in microseconds.
If **-T** is set, it will also save the trace to the output.

**-S**, **--stop-total** *us*

Stop the trace if the total sample is higher than the argument in microseconds.
If **-T** is set, it will also save the trace to the output.
10 changes: 10 additions & 0 deletions Documentation/tools/rtla/common_timerlat_description.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
The **rtla timerlat** tool is an interface for the *timerlat* tracer. The
*timerlat* tracer dispatches a kernel thread per-cpu. These threads
set a periodic timer to wake themselves up and go back to sleep. After
the wakeup, they collect and generate useful information for the
debugging of operating system timer latency.

The *timerlat* tracer outputs information in two ways. It periodically
prints the timer latency at the timer *IRQ* handler and the *Thread*
handler. It also enable the trace of the most relevant information via
**osnoise:** tracepoints.
16 changes: 16 additions & 0 deletions Documentation/tools/rtla/common_timerlat_options.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
**-p**, **--period** *us*

Set the *timerlat* tracer period in microseconds.

**-i**, **--irq** *us*

Stop trace if the *IRQ* latency is higher than the argument in us.

**-T**, **--thread** *us*

Stop trace if the *Thread* latency is higher than the argument in us.

**-s**, **--stack** *us*

Save the stack trace at the *IRQ* if a *Thread* latency is higher than the
argument in us.
3 changes: 3 additions & 0 deletions Documentation/tools/rtla/common_top_options.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**-q**, **--quiet**

Print only a summary at the end of the session.
66 changes: 66 additions & 0 deletions Documentation/tools/rtla/rtla-osnoise-hist.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
===================
rtla-osnoise-hist
===================
------------------------------------------------------
Display a histogram of the osnoise tracer samples
------------------------------------------------------

:Manual section: 1

SYNOPSIS
========
**rtla osnoise hist** [*OPTIONS*]

DESCRIPTION
===========
.. include:: common_osnoise_description.rst

The **rtla osnoise hist** tool collects all **osnoise:sample_threshold**
occurrence in a histogram, displaying the results in a user-friendly way.
The tool also allows many configurations of the *osnoise* tracer and the
collection of the tracer output.

OPTIONS
=======
.. include:: common_osnoise_options.rst

.. include:: common_hist_options.rst

.. include:: common_options.rst

EXAMPLE
=======
In the example below, *osnoise* tracer threads are set to run with real-time
priority *FIFO:1*, on CPUs *0-11*, for *900ms* at each period (*1s* by
default). The reason for reducing the runtime is to avoid starving the
**rtla** tool. The tool is also set to run for *one minute*. The output
histogram is set to group outputs in buckets of *10us* and *25* entries::

[root@f34 ~/]# rtla osnoise hist -P F:1 -c 0-11 -r 900000 -d 1M -b 10 -e 25
# RTLA osnoise histogram
# Time unit is microseconds (us)
# Duration: 0 00:01:00
Index CPU-000 CPU-001 CPU-002 CPU-003 CPU-004 CPU-005 CPU-006 CPU-007 CPU-008 CPU-009 CPU-010 CPU-011
0 42982 46287 51779 53740 52024 44817 49898 36500 50408 50128 49523 52377
10 12224 8356 2912 878 2667 10155 4573 18894 4214 4836 5708 2413
20 8 5 12 2 13 24 20 41 29 53 39 39
30 1 1 0 0 10 3 6 19 15 31 30 38
40 0 0 0 0 0 4 2 7 2 3 8 11
50 0 0 0 0 0 0 0 0 0 1 1 2
over: 0 0 0 0 0 0 0 0 0 0 0 0
count: 55215 54649 54703 54620 54714 55003 54499 55461 54668 55052 55309 54880
min: 0 0 0 0 0 0 0 0 0 0 0 0
avg: 0 0 0 0 0 0 0 0 0 0 0 0
max: 30 30 20 20 30 40 40 40 40 50 50 50

SEE ALSO
========
**rtla-osnoise**\(1), **rtla-osnoise-top**\(1)

*osnoise* tracer documentation: <https://www.kernel.org/doc/html/latest/trace/osnoise-tracer.html>

AUTHOR
======
Written by Daniel Bristot de Oliveira <[email protected]>

.. include:: common_appendix.rst
61 changes: 61 additions & 0 deletions Documentation/tools/rtla/rtla-osnoise-top.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
===================
rtla-osnoise-top
===================
-----------------------------------------------
Display a summary of the operating system noise
-----------------------------------------------

:Manual section: 1

SYNOPSIS
========
**rtla osnoise top** [*OPTIONS*]

DESCRIPTION
===========
.. include:: common_osnoise_description.rst

**rtla osnoise top** collects the periodic summary from the *osnoise* tracer,
including the counters of the occurrence of the interference source,
displaying the results in a user-friendly format.

The tool also allows many configurations of the *osnoise* tracer and the
collection of the tracer output.

OPTIONS
=======
.. include:: common_osnoise_options.rst

.. include:: common_top_options.rst

.. include:: common_options.rst

EXAMPLE
=======
In the example below, the **rtla osnoise top** tool is set to run with a
real-time priority *FIFO:1*, on CPUs *0-3*, for *900ms* at each period
(*1s* by default). The reason for reducing the runtime is to avoid starving
the rtla tool. The tool is also set to run for *one minute* and to display
a summary of the report at the end of the session::

[root@f34 ~]# rtla osnoise top -P F:1 -c 0-3 -r 900000 -d 1M -q
Operating System Noise
duration: 0 00:01:00 | time is in us
CPU Period Runtime Noise % CPU Aval Max Noise Max Single HW NMI IRQ Softirq Thread
0 #59 53100000 304896 99.42580 6978 56 549 0 53111 1590 13
1 #59 53100000 338339 99.36282 8092 24 399 0 53130 1448 31
2 #59 53100000 290842 99.45227 6582 39 855 0 53110 1406 12
3 #59 53100000 204935 99.61405 6251 33 290 0 53156 1460 12

SEE ALSO
========

**rtla-osnoise**\(1), **rtla-osnoise-hist**\(1)

Osnoise tracer documentation: <https://www.kernel.org/doc/html/latest/trace/osnoise-tracer.html>

AUTHOR
======
Written by Daniel Bristot de Oliveira <[email protected]>

.. include:: common_appendix.rst
59 changes: 59 additions & 0 deletions Documentation/tools/rtla/rtla-osnoise.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
===============
rtla-osnoise
===============
------------------------------------------------------------------
Measure the operating system noise
------------------------------------------------------------------

:Manual section: 1

SYNOPSIS
========
**rtla osnoise** [*MODE*] ...

DESCRIPTION
===========

.. include:: common_osnoise_description.rst

The *osnoise* tracer outputs information in two ways. It periodically prints
a summary of the noise of the operating system, including the counters of
the occurrence of the source of interference. It also provides information
for each noise via the **osnoise:** tracepoints. The **rtla osnoise top**
mode displays information about the periodic summary from the *osnoise* tracer.
The **rtla osnoise hist** mode displays information about the noise using
the **osnoise:** tracepoints. For further details, please refer to the
respective man page.

MODES
=====
**top**

Prints the summary from osnoise tracer.

**hist**

Prints a histogram of osnoise samples.

If no MODE is given, the top mode is called, passing the arguments.

OPTIONS
=======

**-h**, **--help**

Display the help text.

For other options, see the man page for the corresponding mode.

SEE ALSO
========
**rtla-osnoise-top**\(1), **rtla-osnoise-hist**\(1)

Osnoise tracer documentation: <https://www.kernel.org/doc/html/latest/trace/osnoise-tracer.html>

AUTHOR
======
Written by Daniel Bristot de Oliveira <[email protected]>

.. include:: common_appendix.rst
Loading

0 comments on commit 4d66020

Please sign in to comment.