Skip to content

Commit 40648d2

Browse files
committed
Merge tag 'trace-tools-v6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull rv and tools/rtla updates from Steven Rostedt: - Add a test suite to test the tool Add a small test suite that can be used to test rtla's basic features to at least have something to test when applying changes. - Automate manual steps in monitor creation While creating a new monitor in RV, besides generating code from dot2k, there are a few manual steps which can be tedious and error prone, like adding the tracepoints, makefile lines and kconfig, or selecting events that start the monitor in the initial state. Updates were made to try and automate as much as possible among those steps to make creating a new RV monitor much quicker. It is still requires to select proper tracepoints, this step is harder to automate in a general way and, in several cases, would still need user intervention. - Have rtla timerlat hist and top set OSNOISE_WORKLOAD flag Have both rtla-timerlat-hist and rtla-timerlat-top set OSNOISE_WORKLOAD to the proper value ("on" when running with -k, "off" when running with -u) every time the option is available instead of setting it only when running with -u. This prevents rtla timerlat -k from giving no results when NO_OSNOISE_WORKLOAD is set, either manually or by an abnormally exited earlier run of rtla timerlat -u. - Stop rtla timerlat on signal properly when overloaded There is an issue where if rtla is run on machines with a high number of CPUs (100+), timerlat can generate more samples than rtla is able to process via tracefs_iterate_raw_events. This is especially common when the interval is set to 100us (rteval and cyclictest default) as opposed to the rtla default of 1000us, but also happens with the rtla default. Currently, this leads to rtla hanging and having to be terminated with SIGTERM. SIGINT setting stop_tracing is not enough, since more and more events are coming and tracefs_iterate_raw_events never exits. To fix this: Stop the timerlat tracer on SIGINT/SIGALRM to ensure no more events are generated when rtla is supposed to exit. Also on receiving SIGINT/SIGALRM twice, abort iteration immediately with tracefs_iterate_stop, making rtla exit right away instead of waiting for all events to be processed. - Account for missed events Due to tracefs buffer overflow, it can happen that rtla misses events, making the tracing results inaccurate. Count both the number of missed events and the total number of processed events, and display missed events as well as their percentage. The numbers are displayed for both osnoise and timerlat, even though for the earlier, missed events are generally not expected. For hist, the number is displayed at the end of the run; for top, it is displayed on each printing of the top table. - Changes to make osnoise more robust There was a dependency in the code that the first field of the osnoise_tool structure was the trace field. If that that ever changed, then the code work break. Change the code to encapsulate this dependency where the code that uses the structure does not have this dependency. * tag 'trace-tools-v6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: (22 commits) rtla: Report missed event count rtla: Add function to report missed events rtla: Count all processed events rtla: Count missed trace events tools/rtla: Add osnoise_trace_is_off() rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads rtla/osnoise: Distinguish missing workload option rtla/timerlat_top: Abort event processing on second signal rtla/timerlat_hist: Abort event processing on second signal rtla/timerlat_top: Stop timerlat tracer on signal rtla/timerlat_hist: Stop timerlat tracer on signal rtla: Add trace_instance_stop tools/rtla: Add basic test suite verification/dot2k: Implement event type detection verification/dot2k: Auto patch current kernel source verification/dot2k: Simplify manual steps in monitor creation rv: Simplify manual steps in monitor creation verification/dot2k: Add support for name and description options verification/dot2k: More robust template variables ...
2 parents 90ab211 + cf18620 commit 40648d2

33 files changed

+691
-406
lines changed

kernel/trace/rv/Kconfig

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,9 @@ menuconfig RV
2525
For further information, see:
2626
Documentation/trace/rv/runtime-verification.rst
2727

28-
config RV_MON_WIP
29-
depends on RV
30-
depends on PREEMPT_TRACER
31-
select DA_MON_EVENTS_IMPLICIT
32-
bool "wip monitor"
33-
help
34-
Enable wip (wakeup in preemptive) sample monitor that illustrates
35-
the usage of per-cpu monitors, and one limitation of the
36-
preempt_disable/enable events.
37-
38-
For further information, see:
39-
Documentation/trace/rv/monitor_wip.rst
40-
41-
config RV_MON_WWNR
42-
depends on RV
43-
select DA_MON_EVENTS_ID
44-
bool "wwnr monitor"
45-
help
46-
Enable wwnr (wakeup while not running) sample monitor, this is a
47-
sample monitor that illustrates the usage of per-task monitor.
48-
The model is borken on purpose: it serves to test reactors.
49-
50-
For further information, see:
51-
Documentation/trace/rv/monitor_wwnr.rst
28+
source "kernel/trace/rv/monitors/wip/Kconfig"
29+
source "kernel/trace/rv/monitors/wwnr/Kconfig"
30+
# Add new monitors here
5231

5332
config RV_REACTORS
5433
bool "Runtime verification reactors"

kernel/trace/rv/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# SPDX-License-Identifier: GPL-2.0
22

3+
ccflags-y += -I $(src) # needed for trace events
4+
35
obj-$(CONFIG_RV) += rv.o
46
obj-$(CONFIG_RV_MON_WIP) += monitors/wip/wip.o
57
obj-$(CONFIG_RV_MON_WWNR) += monitors/wwnr/wwnr.o
8+
# Add new monitors here
69
obj-$(CONFIG_RV_REACTORS) += rv_reactors.o
710
obj-$(CONFIG_RV_REACT_PRINTK) += reactor_printk.o
811
obj-$(CONFIG_RV_REACT_PANIC) += reactor_panic.o

kernel/trace/rv/monitors/wip/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
config RV_MON_WIP
2+
depends on RV
3+
depends on PREEMPT_TRACER
4+
select DA_MON_EVENTS_IMPLICIT
5+
bool "wip monitor"
6+
help
7+
Enable wip (wakeup in preemptive) sample monitor that illustrates
8+
the usage of per-cpu monitors, and one limitation of the
9+
preempt_disable/enable events.
10+
11+
For further information, see:
12+
Documentation/trace/rv/monitor_wip.rst

kernel/trace/rv/monitors/wip/wip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#define MODULE_NAME "wip"
1212

13-
#include <trace/events/rv.h>
13+
#include <rv_trace.h>
1414
#include <trace/events/sched.h>
1515
#include <trace/events/preemptirq.h>
1616

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
3+
/*
4+
* Snippet to be included in rv_trace.h
5+
*/
6+
7+
#ifdef CONFIG_RV_MON_WIP
8+
DEFINE_EVENT(event_da_monitor, event_wip,
9+
TP_PROTO(char *state, char *event, char *next_state, bool final_state),
10+
TP_ARGS(state, event, next_state, final_state));
11+
12+
DEFINE_EVENT(error_da_monitor, error_wip,
13+
TP_PROTO(char *state, char *event),
14+
TP_ARGS(state, event));
15+
#endif /* CONFIG_RV_MON_WIP */

kernel/trace/rv/monitors/wwnr/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
config RV_MON_WWNR
2+
depends on RV
3+
select DA_MON_EVENTS_ID
4+
bool "wwnr monitor"
5+
help
6+
Enable wwnr (wakeup while not running) sample monitor, this is a
7+
sample monitor that illustrates the usage of per-task monitor.
8+
The model is borken on purpose: it serves to test reactors.
9+
10+
For further information, see:
11+
Documentation/trace/rv/monitor_wwnr.rst

kernel/trace/rv/monitors/wwnr/wwnr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#define MODULE_NAME "wwnr"
1212

13-
#include <trace/events/rv.h>
13+
#include <rv_trace.h>
1414
#include <trace/events/sched.h>
1515

1616
#include "wwnr.h"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
3+
/*
4+
* Snippet to be included in rv_trace.h
5+
*/
6+
7+
#ifdef CONFIG_RV_MON_WWNR
8+
/* id is the pid of the task */
9+
DEFINE_EVENT(event_da_monitor_id, event_wwnr,
10+
TP_PROTO(int id, char *state, char *event, char *next_state, bool final_state),
11+
TP_ARGS(id, state, event, next_state, final_state));
12+
13+
DEFINE_EVENT(error_da_monitor_id, error_wwnr,
14+
TP_PROTO(int id, char *state, char *event),
15+
TP_ARGS(id, state, event));
16+
#endif /* CONFIG_RV_MON_WWNR */

kernel/trace/rv/rv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145

146146
#ifdef CONFIG_DA_MON_EVENTS
147147
#define CREATE_TRACE_POINTS
148-
#include <trace/events/rv.h>
148+
#include <rv_trace.h>
149149
#endif
150150

151151
#include "rv.h"

include/trace/events/rv.h renamed to kernel/trace/rv/rv_trace.h

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,9 @@ DECLARE_EVENT_CLASS(error_da_monitor,
5757
__entry->state)
5858
);
5959

60-
#ifdef CONFIG_RV_MON_WIP
61-
DEFINE_EVENT(event_da_monitor, event_wip,
62-
TP_PROTO(char *state, char *event, char *next_state, bool final_state),
63-
TP_ARGS(state, event, next_state, final_state));
64-
65-
DEFINE_EVENT(error_da_monitor, error_wip,
66-
TP_PROTO(char *state, char *event),
67-
TP_ARGS(state, event));
68-
#endif /* CONFIG_RV_MON_WIP */
60+
#include <monitors/wip/wip_trace.h>
61+
// Add new monitors based on CONFIG_DA_MON_EVENTS_IMPLICIT here
62+
6963
#endif /* CONFIG_DA_MON_EVENTS_IMPLICIT */
7064

7165
#ifdef CONFIG_DA_MON_EVENTS_ID
@@ -123,20 +117,14 @@ DECLARE_EVENT_CLASS(error_da_monitor_id,
123117
__entry->state)
124118
);
125119

126-
#ifdef CONFIG_RV_MON_WWNR
127-
/* id is the pid of the task */
128-
DEFINE_EVENT(event_da_monitor_id, event_wwnr,
129-
TP_PROTO(int id, char *state, char *event, char *next_state, bool final_state),
130-
TP_ARGS(id, state, event, next_state, final_state));
131-
132-
DEFINE_EVENT(error_da_monitor_id, error_wwnr,
133-
TP_PROTO(int id, char *state, char *event),
134-
TP_ARGS(id, state, event));
135-
#endif /* CONFIG_RV_MON_WWNR */
120+
#include <monitors/wwnr/wwnr_trace.h>
121+
// Add new monitors based on CONFIG_DA_MON_EVENTS_ID here
136122

137123
#endif /* CONFIG_DA_MON_EVENTS_ID */
138124
#endif /* _TRACE_RV_H */
139125

140126
/* This part ust be outside protection */
141127
#undef TRACE_INCLUDE_PATH
128+
#define TRACE_INCLUDE_PATH .
129+
#define TRACE_INCLUDE_FILE rv_trace
142130
#include <trace/define_trace.h>

0 commit comments

Comments
 (0)