Skip to contentSkip to conversation

rtla: Add hwnoise tool

PATCH New Daniel Bristot de Oliveira 1 participant 3 messages Feb 7, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover rtla: Add hwnoise tool

This series present a new tool inside rtla. It is named hwnoise.

hwnoise dispatches the osnoise tracer and displays a summary of the noise. The difference is that it runs the tracer with the OSNOISE_IRQ_DISABLE option set, thus only allowing only hardware-related noise, resulting in a simplified output. hwnoise has the same features of osnoise.

An example of the tool's output:

 # rtla hwnoise -c 1-5 -T 1 -d 10m -q
                                           Hardware-related Noise
 duration:   0 00:10:00 | time is in us
 CPU Period       Runtime        Noise  % CPU Aval   Max Noise   Max Single          HW          NMI
   1 #599       599000000          138    99.99997           3            3           4           74
   2 #599       599000000           85    99.99998           3            3           4           75
   3 #599       599000000           86    99.99998           4            3           6           75
   4 #599       599000000           81    99.99998           4            4           2           75
   5 #599       599000000           85    99.99998           2            2           2           75

Changes from v2:
Consolidate patches 1/5 into a single one (Steven) Change the osnoise option macro to code (Steven)
Changes from v1:
Add rtla-hwnoise to the rtla documentation index
(kernel test robot/Bagas Sanjaya)

Daniel Bristot de Oliveira (2):
rtla: Add hwnoise tool
Documentation/rtla: Add hwnoise man page

 Documentation/tools/rtla/index.rst        |   1 +
 Documentation/tools/rtla/rtla-hwnoise.rst | 107 ++++++++++++++++++++
 tools/tracing/rtla/Makefile               |   2 +
 tools/tracing/rtla/src/osnoise.c          | 117 ++++++++++++++++++++++
 tools/tracing/rtla/src/osnoise.h          |   7 ++
 tools/tracing/rtla/src/osnoise_top.c      |  84 +++++++++++++---
 tools/tracing/rtla/src/rtla.c             |   4 +
 7 files changed, 306 insertions(+), 16 deletions(-)
 create mode 100644 Documentation/tools/rtla/rtla-hwnoise.rst
Signature · 1 line
2.38.1
#1 lore raw

PATCH v3 1/2 rtla: Add hwnoise tool

The hwnoise tool is a special mode for the osnoise top tool.

hwnoise dispatches the osnoise tracer and displays a summary of the noise. The difference is that it runs the tracer with the OSNOISE_IRQ_DISABLE option set, thus only allowing only hardware-related noise, resulting in a simplified output. hwnoise has the same features of osnoise.

An example of the tool's output:

 # rtla hwnoise -c 1-11 -T 1 -d 10m -q
                                           Hardware-related Noise
 duration:   0 00:10:00 | time is in us
 CPU Period       Runtime        Noise  % CPU Aval   Max Noise   Max Single          HW          NMI
   1 #599       599000000          138    99.99997           3            3           4           74
   2 #599       599000000           85    99.99998           3            3           4           75
   3 #599       599000000           86    99.99998           4            3           6           75
   4 #599       599000000           81    99.99998           4            4           2           75
   5 #599       599000000           85    99.99998           2            2           2           75
Cc Daniel Bristot de Oliveira <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Jonathan Corbet <[email protected]>
---
 tools/tracing/rtla/Makefile          |   2 +
 tools/tracing/rtla/src/osnoise.c     | 117 +++++++++++++++++++++++++++
 tools/tracing/rtla/src/osnoise.h     |   7 ++
 tools/tracing/rtla/src/osnoise_top.c |  84 +++++++++++++++----
 tools/tracing/rtla/src/rtla.c        |   4 +
 5 files changed, 198 insertions(+), 16 deletions(-)
tools/tracing/rtla/Makefile +2 -0
index 22e28b76f800..2456a399eb9a 100644
@@ -119,6 +119,8 @@ install: doc_install
 	$(STRIP) $(DESTDIR)$(BINDIR)/rtla
 	@test ! -f $(DESTDIR)$(BINDIR)/osnoise || rm $(DESTDIR)$(BINDIR)/osnoise
 	ln -s rtla $(DESTDIR)$(BINDIR)/osnoise
+	@test ! -f $(DESTDIR)$(BINDIR)/hwnoise || rm $(DESTDIR)$(BINDIR)/hwnoise
+	ln -s rtla $(DESTDIR)$(BINDIR)/hwnoise
 	@test ! -f $(DESTDIR)$(BINDIR)/timerlat || rm $(DESTDIR)$(BINDIR)/timerlat
 	ln -s rtla $(DESTDIR)$(BINDIR)/timerlat
 
tools/tracing/rtla/src/osnoise.c +117 -0

138 lines not on this page · raw message

tools/tracing/rtla/src/osnoise.h +7 -0
index 04a4384cc544..4dcf22ccd704 100644
@@ -38,6 +38,10 @@ struct osnoise_context {
 	/* -1 as init value because 0 is disabled */
 	long long		orig_print_stack;
 	long long		print_stack;
+
+	/* -1 as init value because 0 is off */
+	int			orig_opt_irq_disable;
+	int			opt_irq_disable;
 };
 
 /*
@@ -79,6 +83,8 @@ void osnoise_restore_print_stack(struct osnoise_context *context);
 int osnoise_set_print_stack(struct osnoise_context *context,
 			    long long print_stack);
 
+int osnoise_set_irq_disable(struct osnoise_context *context, bool onoff);
+
 /*
  * osnoise_tool -  osnoise based tool definition.
  */
@@ -97,3 +103,4 @@ struct osnoise_tool *osnoise_init_trace_tool(char *tracer);
 int osnoise_hist_main(int argc, char *argv[]);
 int osnoise_top_main(int argc, char **argv);
 int osnoise_main(int argc, char **argv);
+int hwnoise_main(int argc, char **argv);
tools/tracing/rtla/src/osnoise_top.c +68 -16

203 lines not on this page · raw message

tools/tracing/rtla/src/rtla.c +4 -0
index 52e8f1825281..7635c70123ab 100644
@@ -26,6 +26,7 @@ static void rtla_usage(int err)
 		"",
 		"  commands:",
 		"     osnoise  - gives information about the operating system noise (osnoise)",
+		"     hwnoise  - gives information about hardware-related noise",
 		"     timerlat - measures the timer irq and thread latency",
 		"",
 		NULL,
@@ -47,6 +48,9 @@ int run_command(int argc, char **argv, int start_position)
 	if (strcmp(argv[start_position], "osnoise") == 0) {
 		osnoise_main(argc-start_position, &argv[start_position]);
 		goto ran;
+	} else if (strcmp(argv[start_position], "hwnoise") == 0) {
+		hwnoise_main(argc-start_position, &argv[start_position]);
+		goto ran;
 	} else if (strcmp(argv[start_position], "timerlat") == 0) {
 		timerlat_main(argc-start_position, &argv[start_position]);
 		goto ran;
Signature · 1 line
2.38.1
#2 lore raw

PATCH v3 2/2 Documentation/rtla: Add hwnoise man page

In reply to Daniel Bristot de Oliveira

Add a man page for the new rtla hwnoise tool, mostly based in the rtla osnoise top.

Cc Daniel Bristot de Oliveira <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Jonathan Corbet <[email protected]>
---
 Documentation/tools/rtla/index.rst        |   1 +
 Documentation/tools/rtla/rtla-hwnoise.rst | 107 ++++++++++++++++++++++
 2 files changed, 108 insertions(+)
 create mode 100644 Documentation/tools/rtla/rtla-hwnoise.rst
Documentation/tools/rtla/index.rst +1 -0
index 840f0bf3e803..05d2652e4072 100644
@@ -17,6 +17,7 @@ behavior on specific hardware.
    rtla-timerlat
    rtla-timerlat-hist
    rtla-timerlat-top
+   rtla-hwnoise
 
 .. only::  subproject and html
 
Documentation/tools/rtla/rtla-hwnoise.rst new file +107 -0

107 lines not on this page · raw message

Signature · 1 line
2.38.1