Skip to contentSkip to conversation

Kernel-Shark and libtraceevent plugins

PATCH In review Jan Kiszka 2 participants 7 messages Mar 14, 2022 – Mar 15, 2022 Kbuild

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

v8 cover Kernel-Shark and libtraceevent plugins

Changes in v8:
- drop explicit deps again - no longer unneeded after refreshing local libtracecmd installation

Changes in v7:
- reworked installation
- fixed build of kernelshark plugin (missing dep)
- dropped applied first patch

Jan

CC Hongzhan Chen <[email protected]>

Hongzhan Chen (3):
build: add options to build plugins of kernelshark and libtraceevent
KernelShark: Add xenomai_cobalt_switch_events plugin for KernelShark
libtraceevent: Add xenomai_schedparams plugin for libtraceevent

Jan Kiszka (1):
libs: Silence installation output of libtool

 Makefile.am                                   |   4 +
 configure.ac                                  |  35 ++++
 lib/alchemy/Makefile.am                       |   2 +
 lib/analogy/Makefile.am                       |   2 +
 lib/cobalt/Makefile.am                        |   2 +
 lib/copperplate/Makefile.am                   |   2 +
 lib/mercury/Makefile.am                       |   3 +-
 lib/psos/Makefile.am                          |   2 +
 lib/smokey/Makefile.am                        |   2 +
 lib/trank/Makefile.am                         |   3 +-
 lib/vxworks/Makefile.am                       |   2 +
 tracing/Makefile.am                           |  13 ++
 tracing/README                                |  84 +++++++++
 tracing/kernelshark/CobaltSwitchEvents.cpp    | 156 ++++++++++++++++
 tracing/kernelshark/Makefile.am               |  20 ++
 .../xenomai_cobalt_switch_events.c            | 174 ++++++++++++++++++
 .../xenomai_cobalt_switch_events.h            |  58 ++++++
 tracing/libtraceevent/Makefile.am             |  19 ++
 .../plugin_xenomai_schedparams.c              | 158 ++++++++++++++++
 19 files changed, 739 insertions(+), 2 deletions(-)
 create mode 100644 tracing/Makefile.am
 create mode 100644 tracing/README
 create mode 100644 tracing/kernelshark/CobaltSwitchEvents.cpp
 create mode 100644 tracing/kernelshark/Makefile.am
 create mode 100644 tracing/kernelshark/xenomai_cobalt_switch_events.c
 create mode 100644 tracing/kernelshark/xenomai_cobalt_switch_events.h
 create mode 100644 tracing/libtraceevent/Makefile.am
 create mode 100644 tracing/libtraceevent/plugin_xenomai_schedparams.c
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v8 1/4 build: add options to build plugins of kernelshark and libtraceevent

From: Hongzhan Chen <[email protected]>

To build plugins of kernelshark and libtraceevent, add options and do necessary configuration.

[Jan: cleaned up AC_ARG_ENABLE matches, drop INSTALLDIRs]
---
 configure.ac | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
configure.ac +32 -0
index 16cffd8f81..7387bb3560 100644
@@ -91,6 +91,8 @@ AC_ARG_WITH(cxx,
     ])
 AC_PROG_CXX
 
+PKG_PROG_PKG_CONFIG
+
 # Do not let autoconf set the default value of CFLAGS
 if $XENO_EMPTY_CFLAGS; then
 	CFLAGS=""
@@ -826,6 +828,36 @@ AC_ARG_WITH(demodir,
     ], [XENO_DEMO_DIR=$demodir])
 AC_MSG_RESULT($XENO_DEMO_DIR)
 
+kernelshark_plugin=
+AC_MSG_CHECKING(whether KernelShark plugin should be built)
+AC_ARG_ENABLE(kernelshark_plugin,
+	AS_HELP_STRING([--enable-kernelshark-plugin], [build KernelShark plugin]),
+	[case "$enableval" in
+	y | yes) kernelshark_plugin=y ;;
+	*) unset kernelshark_plugin ;;
+	esac])
+AC_MSG_RESULT(${kernelshark_plugin:-no})
+AM_CONDITIONAL(XENO_KSHARK_PLUGIN, [test x$kernelshark_plugin = xy])
+
+libtraceevent_plugin=
+AC_MSG_CHECKING(whether libtraceevent plugin should be built)
+AC_ARG_ENABLE(libtraceevent_plugin,
+	AS_HELP_STRING([--enable-libtraceevent-plugin], [build libtraceevent plugin]),
+	[case "$enableval" in
+	y | yes) libtraceevent_plugin=y ;;
+	*) unset libtraceevent_plugin ;;
+	esac])
+AC_MSG_RESULT(${libtraceevent_plugin:-no})
+AM_CONDITIONAL(XENO_LIBTRACEEVENT_PLUGIN, [test x$libtraceevent_plugin = xy])
+
+if test x$kernelshark_plugin = xy -o x$libtraceevent_plugin = xy; then
+	PKG_CHECK_MODULES(LIBTRACEEVENT, libtraceevent)
+fi
+
+if test x$kernelshark_plugin = xy; then
+	PKG_CHECK_MODULES(LIBKSHARK, libkshark)
+fi
+
 AC_MSG_CHECKING([for test source generation])
 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
     [AC_MSG_RESULT(ok)], [AC_MSG_RESULT(failed)], [AC_MSG_RESULT(untestable)])
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v8 2/4 KernelShark: Add xenomai_cobalt_switch_events plugin for KernelShark

In reply to Jan Kiszka

From: Hongzhan Chen <[email protected]>

For Xenomai-cobalt enabled system, cobalt_switch_context means that there is schedule and context switch in companion core(realtime core), which we may need to do special treatment and take correct action as main kernel sched_switch to visualize out-of-band state of realtime tasks running in cobalt core. To achive our target, we implement following:

1. store corresponding cobalt_switch_context events into container data.
2. modify pid stored in entry to be equal to next_pid to show correct color in cpu bar when cobalt_switch_context event happen.
3. show blue hollow box to mark out-of-band state according to cobalt_switch_context events.
4. clickable cobalt_switch_context plugin shapes.

[Jan: rework installation]
---
 Makefile.am                                   |   4 +
 configure.ac                                  |   2 +
 tracing/Makefile.am                           |   8 +
 tracing/kernelshark/CobaltSwitchEvents.cpp    | 156 ++++++++++++++++
 tracing/kernelshark/Makefile.am               |  20 ++
 .../xenomai_cobalt_switch_events.c            | 174 ++++++++++++++++++
 .../xenomai_cobalt_switch_events.h            |  58 ++++++
 7 files changed, 422 insertions(+)
 create mode 100644 tracing/Makefile.am
 create mode 100644 tracing/kernelshark/CobaltSwitchEvents.cpp
 create mode 100644 tracing/kernelshark/Makefile.am
 create mode 100644 tracing/kernelshark/xenomai_cobalt_switch_events.c
 create mode 100644 tracing/kernelshark/xenomai_cobalt_switch_events.h
Makefile.am +4 -0
index 604644277e..bd3e4bfb18 100644
@@ -18,6 +18,9 @@ SUBDIRS += 		\
 	testsuite
 endif
 
+SUBDIRS +=		\
+	tracing
+
 EXTRA_DIST = kernel debian
 
 DIST_SUBDIRS =		\
@@ -26,6 +29,7 @@ DIST_SUBDIRS =		\
 	doc		\
 	include		\
 	lib 		\
+	tracing		\
 	scripts		\
 	testsuite	\
 	utils
configure.ac +2 -0
index 7387bb3560..4d11a6e421 100644
@@ -975,6 +975,8 @@ AC_CONFIG_FILES([ \
 	scripts/Makefile \
 	scripts/xeno-config:scripts/xeno-config-$rtcore_type.in \
 	scripts/xeno \
+	tracing/Makefile \
+	tracing/kernelshark/Makefile \
 	lib/Makefile \
 	lib/boilerplate/Makefile \
 	lib/boilerplate/init/Makefile \
tracing/Makefile.am new file +8 -0
new file mode 100644
index 0000000000..885a9497f7
@@ -0,0 +1,8 @@
+SUBDIRS =
+
+if XENO_KSHARK_PLUGIN
+SUBDIRS += kernelshark
+endif
+
+DIST_SUBDIRS = 		\
+	kernelshark
tracing/kernelshark/CobaltSwitchEvents.cpp new file +156 -0

156 lines not on this page · raw message

tracing/kernelshark/Makefile.am new file +20 -0
new file mode 100644
index 0000000000..954805e53d
@@ -0,0 +1,20 @@
+libsub_LTLIBRARIES = plugin_xenomai_cobalt_switch_events.la
+
+plugin_xenomai_cobalt_switch_events_la_SOURCES =	\
+	CobaltSwitchEvents.cpp				\
+	xenomai_cobalt_switch_events.c			\
+	xenomai_cobalt_switch_events.h
+
+plugin_xenomai_cobalt_switch_events_la_CPPFLAGS  =	\
+	$(LIBKSHARK_CFLAGS)
+
+plugin_xenomai_cobalt_switch_events_la_LDFLAGS =	\
+	$(LIBKSHARK_LIBS)				\
+	-module -avoid-version
+
+AM_LIBTOOLFLAGS = --silent --tag=disable-static
+
+libsubdir := $(libdir)/kernelshark/plugins
+
+install-data-hook:
+	$(RM) $(DESTDIR)$(libsubdir)/$(libsub_LTLIBRARIES)
tracing/kernelshark/xenomai_cobalt_switch_events.c new file +174 -0

174 lines not on this page · raw message

tracing/kernelshark/xenomai_cobalt_switch_events.h new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#3 lore raw

PATCH v8 3/4 libtraceevent: Add xenomai_schedparams plugin for libtraceevent

In reply to Jan Kiszka

From: Hongzhan Chen <[email protected]>

For cobalt thread, there is special struct param_ex data stored in data record, we need to parse and print its content out correctly to hint user.

[Jan: rework installation]
---
 configure.ac                                  |   1 +
 tracing/Makefile.am                           |   7 +-
 tracing/README                                |  84 ++++++++++
 tracing/libtraceevent/Makefile.am             |  19 +++
 .../plugin_xenomai_schedparams.c              | 158 ++++++++++++++++++
 5 files changed, 268 insertions(+), 1 deletion(-)
 create mode 100644 tracing/README
 create mode 100644 tracing/libtraceevent/Makefile.am
 create mode 100644 tracing/libtraceevent/plugin_xenomai_schedparams.c
configure.ac +1 -0
index 4d11a6e421..0194537935 100644
@@ -977,6 +977,7 @@ AC_CONFIG_FILES([ \
 	scripts/xeno \
 	tracing/Makefile \
 	tracing/kernelshark/Makefile \
+	tracing/libtraceevent/Makefile \
 	lib/Makefile \
 	lib/boilerplate/Makefile \
 	lib/boilerplate/init/Makefile \
tracing/Makefile.am +6 -1
index 885a9497f7..da7d979f9a 100644
@@ -4,5 +4,10 @@ if XENO_KSHARK_PLUGIN
 SUBDIRS += kernelshark
 endif
 
+if XENO_LIBTRACEEVENT_PLUGIN
+SUBDIRS += libtraceevent
+endif
+
 DIST_SUBDIRS = 		\
-	kernelshark
+	kernelshark	\
+	libtraceevent
tracing/README new file +84 -0

84 lines not on this page · raw message

tracing/libtraceevent/Makefile.am new file +19 -0
new file mode 100644
index 0000000000..542d71cb6f
@@ -0,0 +1,19 @@
+libsub_LTLIBRARIES = plugin_xenomai_schedparams.la
+
+plugin_xenomai_schedparams_la_SOURCES =	\
+	plugin_xenomai_schedparams.c
+
+plugin_xenomai_schedparams_la_CPPFLAGS =	\
+	$(LIBTRACEEVENT_CFLAGS)			\
+	-I$(top_srcdir)/include
+
+plugin_xenomai_schedparams_la_LDFLAGS =		\
+	$(LIBTRACEEVENT_LIBS)			\
+	-module -avoid-version -nostartfiles
+
+AM_LIBTOOLFLAGS = --silent --tag=disable-static
+
+libsubdir := $(libdir)/traceevent/plugins
+
+install-data-hook:
+	$(RM) $(DESTDIR)$(libsubdir)/$(libsub_LTLIBRARIES)
tracing/libtraceevent/plugin_xenomai_schedparams.c new file +158 -0

158 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#4 lore raw

PATCH v8 4/4 libs: Silence installation output of libtool

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

---
 lib/alchemy/Makefile.am     | 2 ++
 lib/analogy/Makefile.am     | 2 ++
 lib/cobalt/Makefile.am      | 2 ++
 lib/copperplate/Makefile.am | 2 ++
 lib/mercury/Makefile.am     | 3 ++-
 lib/psos/Makefile.am        | 2 ++
 lib/smokey/Makefile.am      | 2 ++
 lib/trank/Makefile.am       | 3 ++-
 lib/vxworks/Makefile.am     | 2 ++
 9 files changed, 18 insertions(+), 2 deletions(-)
lib/alchemy/Makefile.am +2 -0
index d350912ffe..12f8fab536 100644
@@ -43,6 +43,8 @@ libalchemy@CORE@_la_CPPFLAGS =				\
 	-I$(top_srcdir)/include				\
 	-I$(top_srcdir)/lib
 
+AM_LIBTOOLFLAGS = --silent
+
 EXTRA_DIST = testsuite
 
 SPARSE = sparse
lib/analogy/Makefile.am +2 -0
index 4c6f0de013..98dbfbf325 100644
@@ -21,3 +21,5 @@ libanalogy_la_CPPFLAGS =		\
 	@XENO_USER_CFLAGS@		\
 	-I$(top_srcdir)/include 	\
 	-I$(top_srcdir)/lib/boilerplate	
+
+AM_LIBTOOLFLAGS = --silent
lib/cobalt/Makefile.am +2 -0
index b3003cd957..3159695b37 100644
@@ -54,6 +54,8 @@ libmodechk_la_CPPFLAGS =		\
 	-I$(top_srcdir)/include/cobalt	\
 	-I$(top_srcdir)/include
 
+AM_LIBTOOLFLAGS = --silent
+
 install-data-local:
 	$(mkinstalldirs) $(DESTDIR)$(libdir)
 	$(INSTALL_DATA) $(srcdir)/cobalt.wrappers $(DESTDIR)$(libdir)
lib/copperplate/Makefile.am +2 -0
index 671e87d79c..c6edea9853 100644
@@ -51,6 +51,8 @@ libcopperplate@CORE@_la_SOURCES += heapobj-malloc.c
 endif
 endif
 
+AM_LIBTOOLFLAGS = --silent
+
 SUBDIRS = .
 
 if XENO_REGISTRY
lib/mercury/Makefile.am +2 -1
index d2b06211fd..4866038f6d 100644
@@ -1,4 +1,3 @@
-
 lib_LTLIBRARIES = libmercury.la
 
 libmercury_la_SOURCES =
@@ -7,3 +6,5 @@ libmercury_la_LDFLAGS = @XENO_LIB_LDFLAGS@ -version-info 0:0:0 -lpthread -lrt
 
 libmercury_la_LIBADD = \
 	../boilerplate/libboilerplate.la
+
+AM_LIBTOOLFLAGS = --silent
lib/psos/Makefile.am +2 -0
index f54b26001d..cbfe457adf 100644
@@ -28,6 +28,8 @@ libpsos@CORE@_la_CPPFLAGS =					\
 	-I$(top_srcdir)/include				\
 	-I$(top_srcdir)/lib
 
+AM_LIBTOOLFLAGS = --silent
+
 EXTRA_DIST = testsuite
 
 SPARSE = sparse
lib/smokey/Makefile.am +2 -0
index 2674e32876..45fd95e5f2 100644
@@ -11,3 +11,5 @@ libsmokey@CORE@_la_CPPFLAGS =			\
 	@XENO_USER_CFLAGS@		\
 	-I$(top_srcdir)/include		\
 	-I$(top_srcdir)/lib
+
+AM_LIBTOOLFLAGS = --silent
lib/trank/Makefile.am +2 -1
index ec15367d36..c19dd8960c 100644
@@ -1,4 +1,3 @@
-
 lib_LTLIBRARIES = libtrank@[email protected]
 
 libtrank@CORE@_la_LDFLAGS = @XENO_LIB_LDFLAGS@ -version-info 0:0:0
@@ -19,3 +18,5 @@ libtrank@CORE@_la_CPPFLAGS =		\
 	-D__XENO_COMPAT__	\
 	-I$(top_srcdir)/include	\
 	-I$(top_srcdir)/lib
+
+AM_LIBTOOLFLAGS = --silent
lib/vxworks/Makefile.am +2 -0
index 37b8caf7b5..a1d0d62112 100644
@@ -37,6 +37,8 @@ libvxworks@CORE@_la_CPPFLAGS =				\
 	-I$(top_srcdir)/include				\
 	-I$(top_srcdir)/lib
 
+AM_LIBTOOLFLAGS = --silent
+
 EXTRA_DIST = testsuite
 
 SPARSE = sparse
Signature · 1 line
2.34.1
#5 lore raw
In reply to Jan Kiszka

Looks good to me. Thanks for your help.

Regards

Hongzhan Chen

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, March 14, 2022 6:01 PM
To: [email protected]
Cc: Chen, Hongzhan <[email protected]>
Subject: [PATCH v8 0/4] Kernel-Shark and libtraceevent plugins

Changes in v8:
- drop explicit deps again - no longer unneeded after refreshing local libtracecmd installation

Changes in v7:
- reworked installation
- fixed build of kernelshark plugin (missing dep)
- dropped applied first patch

Jan

CC Hongzhan Chen <[email protected]>

Hongzhan Chen (3):
build: add options to build plugins of kernelshark and libtraceevent
KernelShark: Add xenomai_cobalt_switch_events plugin for KernelShark
libtraceevent: Add xenomai_schedparams plugin for libtraceevent

Jan Kiszka (1):
libs: Silence installation output of libtool

 Makefile.am                                   |   4 +
 configure.ac                                  |  35 ++++
 lib/alchemy/Makefile.am                       |   2 +
 lib/analogy/Makefile.am                       |   2 +
 lib/cobalt/Makefile.am                        |   2 +
 lib/copperplate/Makefile.am                   |   2 +
 lib/mercury/Makefile.am                       |   3 +-
 lib/psos/Makefile.am                          |   2 +
 lib/smokey/Makefile.am                        |   2 +
 lib/trank/Makefile.am                         |   3 +-
 lib/vxworks/Makefile.am                       |   2 +
 tracing/Makefile.am                           |  13 ++
 tracing/README                                |  84 +++++++++
 tracing/kernelshark/CobaltSwitchEvents.cpp    | 156 ++++++++++++++++
 tracing/kernelshark/Makefile.am               |  20 ++
 .../xenomai_cobalt_switch_events.c            | 174 ++++++++++++++++++
 .../xenomai_cobalt_switch_events.h            |  58 ++++++
 tracing/libtraceevent/Makefile.am             |  19 ++
 .../plugin_xenomai_schedparams.c              | 158 ++++++++++++++++
 19 files changed, 739 insertions(+), 2 deletions(-)
 create mode 100644 tracing/Makefile.am
 create mode 100644 tracing/README
 create mode 100644 tracing/kernelshark/CobaltSwitchEvents.cpp
 create mode 100644 tracing/kernelshark/Makefile.am
 create mode 100644 tracing/kernelshark/xenomai_cobalt_switch_events.c
 create mode 100644 tracing/kernelshark/xenomai_cobalt_switch_events.h
 create mode 100644 tracing/libtraceevent/Makefile.am
 create mode 100644 tracing/libtraceevent/plugin_xenomai_schedparams.c
Signature · 1 line
2.34.1
author
#6 lore raw
Quoted 2 lines · Hongzhan

Looks good to me. Thanks for your help.

Thanks for your effort! The last "few percentages" to get autoconf/automake integration were indeed tougher than I thought.

Jan

Quoted 62 lines

Regards

Hongzhan Chen

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, March 14, 2022 6:01 PM
To: [email protected]
Cc: Chen, Hongzhan <[email protected]>
Subject: [PATCH v8 0/4] Kernel-Shark and libtraceevent plugins

Changes in v8:
- drop explicit deps again - no longer unneeded after refreshing local libtracecmd installation

Changes in v7:
- reworked installation
- fixed build of kernelshark plugin (missing dep)
- dropped applied first patch

Jan

CC Hongzhan Chen <[email protected]>

Hongzhan Chen (3):
build: add options to build plugins of kernelshark and libtraceevent
KernelShark: Add xenomai_cobalt_switch_events plugin for KernelShark
libtraceevent: Add xenomai_schedparams plugin for libtraceevent

Jan Kiszka (1):
libs: Silence installation output of libtool

 Makefile.am                                   |   4 +
 configure.ac                                  |  35 ++++
 lib/alchemy/Makefile.am                       |   2 +
 lib/analogy/Makefile.am                       |   2 +
 lib/cobalt/Makefile.am                        |   2 +
 lib/copperplate/Makefile.am                   |   2 +
 lib/mercury/Makefile.am                       |   3 +-
 lib/psos/Makefile.am                          |   2 +
 lib/smokey/Makefile.am                        |   2 +
 lib/trank/Makefile.am                         |   3 +-
 lib/vxworks/Makefile.am                       |   2 +
 tracing/Makefile.am                           |  13 ++
 tracing/README                                |  84 +++++++++
 tracing/kernelshark/CobaltSwitchEvents.cpp    | 156 ++++++++++++++++
 tracing/kernelshark/Makefile.am               |  20 ++
 .../xenomai_cobalt_switch_events.c            | 174 ++++++++++++++++++
 .../xenomai_cobalt_switch_events.h            |  58 ++++++
 tracing/libtraceevent/Makefile.am             |  19 ++
 .../plugin_xenomai_schedparams.c              | 158 ++++++++++++++++
 19 files changed, 739 insertions(+), 2 deletions(-)
 create mode 100644 tracing/Makefile.am
 create mode 100644 tracing/README
 create mode 100644 tracing/kernelshark/CobaltSwitchEvents.cpp
 create mode 100644 tracing/kernelshark/Makefile.am
 create mode 100644 tracing/kernelshark/xenomai_cobalt_switch_events.c
 create mode 100644 tracing/kernelshark/xenomai_cobalt_switch_events.h
 create mode 100644 tracing/libtraceevent/Makefile.am
 create mode 100644 tracing/libtraceevent/plugin_xenomai_schedparams.c
Signature · 2 lines
Siemens AG, Technology
Competence Center Embedded Linux