diff options
Diffstat (limited to 'meta/recipes-kernel/lttng')
35 files changed, 2086 insertions, 2078 deletions
diff --git a/meta/recipes-kernel/lttng/babeltrace2/run-ptest b/meta/recipes-kernel/lttng/babeltrace2/run-ptest index 72fe223436..71a9c81bfb 100755 --- a/meta/recipes-kernel/lttng/babeltrace2/run-ptest +++ b/meta/recipes-kernel/lttng/babeltrace2/run-ptest @@ -6,4 +6,14 @@ # test plan to raise ERRORs; this is just noise. makeargs="LOG_DRIVER_FLAGS=--ignore-exit abs_top_srcdir=$PWD abs_top_builddir=$PWD GREP=grep SED=sed PYTHON=python3" -exec make -C tests -k -s $makeargs $target 2>/dev/null +exec 2> error.log +make -C tests -k -s $makeargs $target +exitcode=$? +if [ -e error.log ]; then + cat error.log +fi +if [ -e tests/test-suite.log ]; then + cat tests/test-suite.log +fi + +exit $exitcode
\ No newline at end of file diff --git a/meta/recipes-kernel/lttng/babeltrace2_2.0.3.bb b/meta/recipes-kernel/lttng/babeltrace2_2.0.6.bb index c65882581d..d6c75d7580 100644 --- a/meta/recipes-kernel/lttng/babeltrace2_2.0.3.bb +++ b/meta/recipes-kernel/lttng/babeltrace2_2.0.6.bb @@ -2,34 +2,36 @@ SUMMARY = "Babeltrace2 - Trace Format Babel Tower" DESCRIPTION = "Babeltrace provides trace read and write libraries in host side, as well as a trace converter, which used to convert LTTng 2.0 traces into human-readable log." HOMEPAGE = "http://babeltrace.org/" BUGTRACKER = "https://bugs.lttng.org/projects/babeltrace" -LICENSE = "MIT & GPLv2 & LGPLv2.1 & BSD-2-Clause" +LICENSE = "MIT & GPL-2.0-only & LGPL-2.1-only & BSD-2-Clause" LIC_FILES_CHKSUM = "file://LICENSE;md5=a6a458c13f18385b7bc5069a6d7b176e" DEPENDS = "glib-2.0 util-linux popt bison-native flex-native" -SRC_URI = "git://git.efficios.com/babeltrace.git;branch=stable-2.0 \ +SRC_URI = "git://git.efficios.com/babeltrace.git;branch=stable-2.0;protocol=https \ file://run-ptest \ file://0001-tests-do-not-run-test-applications-from-.libs.patch \ file://0001-Make-manpages-multilib-identical.patch \ " -SRCREV = "91d154476e66735d705adda9ca5cbf5b5eea5940" +SRCREV = "0a6632f77801f3218a288604c646f8a39cb0d2c4" UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>2(\.\d+)+)$" S = "${WORKDIR}/git" -inherit autotools pkgconfig ptest +inherit autotools pkgconfig ptest python3targetconfig -EXTRA_OECONF = "--disable-debug-info" +EXTRA_OECONF = "--disable-debug-info --disable-Werror" PACKAGECONFIG ??= "manpages" PACKAGECONFIG[manpages] = ", --disable-man-pages, asciidoc-native xmlto-native" -FILES_${PN}-staticdev += "${libdir}/babeltrace2/plugins/*.a" -FILES_${PN} += "${libdir}/babeltrace2/plugins/*.so" +FILES:${PN}-staticdev += "${libdir}/babeltrace2/plugins/*.a" +FILES:${PN} += "${libdir}/babeltrace2/plugins/*.so" ASNEEDED = "" +LDFLAGS:append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld ptest', ' -fuse-ld=bfd ', '', d)}" -RDEPENDS_${PN}-ptest += "bash gawk python3" +# coreutils since we need full mktemp +RDEPENDS:${PN}-ptest += "bash gawk python3 make grep coreutils findutils" do_compile_ptest () { make -C tests all diff --git a/meta/recipes-kernel/lttng/babeltrace_1.5.8.bb b/meta/recipes-kernel/lttng/babeltrace_1.5.11.bb index 9e5d3a7a97..f4d9b5e42a 100644 --- a/meta/recipes-kernel/lttng/babeltrace_1.5.8.bb +++ b/meta/recipes-kernel/lttng/babeltrace_1.5.11.bb @@ -2,15 +2,15 @@ SUMMARY = "Babeltrace - Trace Format Babel Tower" DESCRIPTION = "Babeltrace provides trace read and write libraries in host side, as well as a trace converter, which used to convert LTTng 2.0 traces into human-readable log." HOMEPAGE = "http://babeltrace.org/" BUGTRACKER = "https://bugs.lttng.org/projects/babeltrace" -LICENSE = "MIT & GPLv2 & LGPLv2.1" +LICENSE = "MIT & GPL-2.0-only & LGPL-2.1-only" LIC_FILES_CHKSUM = "file://LICENSE;md5=76ba15dd76a248e1dd526bca0e2125fa" DEPENDS = "glib-2.0 util-linux popt bison-native flex-native" -SRC_URI = "git://git.efficios.com/babeltrace.git;branch=stable-1.5 \ +SRC_URI = "git://git.efficios.com/babeltrace.git;branch=stable-1.5;protocol=https \ file://run-ptest \ " -SRCREV = "054a54ae10b01a271afc4f19496c041b10fb414c" +SRCREV = "91c00f70884887ff5c4849a8e3d47e311a22ba9d" UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>1(\.\d+)+)$" S = "${WORKDIR}/git" @@ -21,7 +21,7 @@ EXTRA_OECONF = "--disable-debug-info" ASNEEDED = "" -RDEPENDS_${PN}-ptest += "bash gawk" +RDEPENDS:${PN}-ptest += "bash gawk make" addtask do_patch_ptest_path after do_patch before do_configure do_patch_ptest_path () { diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-ASoC-snd_doc_dapm-on-linux-6.9-rc1.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-ASoC-snd_doc_dapm-on-linux-6.9-rc1.patch new file mode 100644 index 0000000000..9d5fd0de60 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-ASoC-snd_doc_dapm-on-linux-6.9-rc1.patch @@ -0,0 +1,93 @@ +From fec007d9630e010062cf5699a08460f71f46b527 Mon Sep 17 00:00:00 2001 +From: Kienan Stewart <kstewart@efficios.com> +Date: Mon, 25 Mar 2024 08:54:42 -0400 +Subject: [PATCH 1/4] Fix: ASoC snd_doc_dapm on linux 6.9-rc1 + +See upstream commit: + + commit 7df3eb4cdb6bbfa482f51548b9fd47c2723c68ba + Author: Luca Ceresoli <luca.ceresoli@bootlin.com> + Date: Wed Mar 6 10:30:01 2024 +0100 + + ASoC: trace: add event to snd_soc_dapm trace events + + Add the event value to the snd_soc_dapm_start and snd_soc_dapm_done trace + events to make them more informative. + + Trace before: + + aplay-229 [000] 250.140309: snd_soc_dapm_start: card=vscn-2046 + aplay-229 [000] 250.167531: snd_soc_dapm_done: card=vscn-2046 + aplay-229 [000] 251.169588: snd_soc_dapm_start: card=vscn-2046 + aplay-229 [000] 251.195245: snd_soc_dapm_done: card=vscn-2046 + + Trace after: + + aplay-214 [000] 693.290612: snd_soc_dapm_start: card=vscn-2046 event=1 + aplay-214 [000] 693.315508: snd_soc_dapm_done: card=vscn-2046 event=1 + aplay-214 [000] 694.537349: snd_soc_dapm_start: card=vscn-2046 event=2 + aplay-214 [000] 694.563241: snd_soc_dapm_done: card=vscn-2046 event=2 + +Upstream-Status: Backport [88c4e0fe Fix: ASoC snd_doc_dapm on linux 6.9-rc1] + +Change-Id: If0d33544b8dd1dfb3d12ca9390892190fc0444b0 +Signed-off-by: Kienan Stewart <kstewart@efficios.com> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> +--- + include/instrumentation/events/asoc.h | 33 +++++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +diff --git a/include/instrumentation/events/asoc.h b/include/instrumentation/events/asoc.h +index 21d13a0f..5126d4c1 100644 +--- a/include/instrumentation/events/asoc.h ++++ b/include/instrumentation/events/asoc.h +@@ -51,6 +51,38 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(asoc_snd_soc_card, snd_soc_bias_level_done, + + ) + ++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,9,0)) ++LTTNG_TRACEPOINT_EVENT_CLASS(asoc_snd_soc_dapm_basic, ++ ++ TP_PROTO(struct snd_soc_card *card, int event), ++ ++ TP_ARGS(card, event), ++ ++ TP_FIELDS( ++ ctf_string(name, card->name) ++ ctf_integer(int, event, event) ++ ) ++) ++LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(asoc_snd_soc_dapm_basic, snd_soc_dapm_start, ++ ++ asoc_snd_soc_dapm_start, ++ ++ TP_PROTO(struct snd_soc_card *card, int event), ++ ++ TP_ARGS(card, event) ++ ++) ++ ++LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(asoc_snd_soc_dapm_basic, snd_soc_dapm_done, ++ ++ asoc_snd_soc_dapm_done, ++ ++ TP_PROTO(struct snd_soc_card *card, int event), ++ ++ TP_ARGS(card, event) ++ ++) ++#else + LTTNG_TRACEPOINT_EVENT_CLASS(asoc_snd_soc_dapm_basic, + + TP_PROTO(struct snd_soc_card *card), +@@ -81,6 +113,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(asoc_snd_soc_dapm_basic, snd_soc_dapm_done, + TP_ARGS(card) + + ) ++#endif + + LTTNG_TRACEPOINT_EVENT_CLASS(asoc_snd_soc_dapm_widget, + +-- +2.39.2 + diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch deleted file mode 100644 index ae8bec45de..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch +++ /dev/null @@ -1,54 +0,0 @@ -From ff4d1d7e85be94ef43709cd698f0ec9a12f247d1 Mon Sep 17 00:00:00 2001 -From: Beniamin Sandu <beniaminsandu@gmail.com> -Date: Thu, 13 Aug 2020 16:24:39 +0300 -Subject: [PATCH 01/10] Kconfig: fix dependency issue when building in-tree - without CONFIG_FTRACE - -When building in-tree, one could disable CONFIG_FTRACE from kernel -config which will leave CONFIG_TRACEPOINTS selected by LTTNG modules, -but generate a lot of linker errors like below because it leaves out -other stuff, e.g.: - -trace.c:(.text+0xd86b): undefined reference to `trace_event_buffer_reserve' -ld: trace.c:(.text+0xd8de): undefined reference to `trace_event_buffer_commit' -ld: trace.c:(.text+0xd926): undefined reference to `event_triggers_call' -ld: trace.c:(.text+0xd942): undefined reference to `trace_event_ignore_this_pid' -ld: net/mac80211/trace.o: in function `trace_event_raw_event_drv_tdls_cancel_channel_switch': - -It appears to be caused by the fact that TRACE_EVENT macros in the Linux -kernel depend on the Ftrace ring buffer as soon as CONFIG_TRACEPOINTS is -enabled. - -Steps to reproduce: - -- Get a clone of an upstream stable kernel and use scripts/built-in.sh on it - -- Configure a standard x86-64 build, enable built-in LTTNG but disable - CONFIG_FTRACE from Kernel Hacking-->Tracers using menuconfig - -- Build will fail at linking stage - -Upstream-Status: Backport - -Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com> -Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> ---- - Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Kconfig b/Kconfig -index acdab73..10eccff 100644 ---- a/Kconfig -+++ b/Kconfig -@@ -2,7 +2,7 @@ - - config LTTNG - tristate "LTTng support" -- select TRACEPOINTS -+ select TRACING - help - LTTng is an open source tracing framework for Linux. - --- -2.19.1 - diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch new file mode 100644 index 0000000000..120528bf9c --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch @@ -0,0 +1,46 @@ +From 878f89b6136ff7b870a19e04901cc6f316bbe10a Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield <bruce.ashfield@gmail.com> +Date: Sat, 15 May 2021 10:26:38 -0400 +Subject: [PATCH] src/Kbuild: change missing CONFIG_TRACEPOINTS to warning + +Taken from a previous patch to the main lttng-modules Makefile, by +Otavio Salvador: + + The lttng-modules are being pulled by the tools-profile image feature, + however, not every kernel has the CONFIG_TRACEPOINTS feature enabled. + + This change makes the build do not fail when CONFIG_TRACEPOINTS is not + available, allowing it to be kept being pulled by default. + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +--- + src/Kbuild | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +Index: lttng-modules-2.13.10/src/Kbuild +=================================================================== +--- lttng-modules-2.13.10.orig/src/Kbuild ++++ lttng-modules-2.13.10/src/Kbuild +@@ -2,10 +2,13 @@ + + ifdef CONFIG_LOCALVERSION # Check if dot-config is included. + ifeq ($(CONFIG_TRACEPOINTS),) +- $(error The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration) ++ $(warning The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration) ++ DISABLE_MODULE = y + endif # CONFIG_TRACEPOINTS + endif # ifdef CONFIG_LOCALVERSION + ++ifneq ($(DISABLE_MODULE),y) ++ + TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/.. + + lttng_check_linux_version = $(shell pwd)/include/linux/version.h +@@ -150,3 +153,5 @@ lttng-statedump-objs := lttng-statedump- + obj-$(CONFIG_LTTNG) += probes/ + obj-$(CONFIG_LTTNG) += lib/ + obj-$(CONFIG_LTTNG) += tests/ ++ ++endif # DISABLE_MODULE diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-Fix-ASoC-add-component-to-set_bias_level-events-in-l.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-Fix-ASoC-add-component-to-set_bias_level-events-in-l.patch new file mode 100644 index 0000000000..6ea10ffc91 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0002-Fix-ASoC-add-component-to-set_bias_level-events-in-l.patch @@ -0,0 +1,132 @@ +From d8379ec6365a925db33cae94fb6783cdbdb6a922 Mon Sep 17 00:00:00 2001 +From: Kienan Stewart <kstewart@efficios.com> +Date: Mon, 25 Mar 2024 09:40:29 -0400 +Subject: [PATCH 2/4] Fix: ASoC add component to set_bias_level events in linux + 6.9-rc1 + +See upstream commit: + + commit 6ef46a69ec32fe1cf56de67742fcd01af4bf48af + Author: Luca Ceresoli <luca.ceresoli@bootlin.com> + Date: Wed Mar 6 10:30:00 2024 +0100 + + ASoC: trace: add component to set_bias_level trace events + + The snd_soc_bias_level_start and snd_soc_bias_level_done trace events + currently look like: + + aplay-229 [000] 1250.140778: snd_soc_bias_level_start: card=vscn-2046 val=1 + aplay-229 [000] 1250.140784: snd_soc_bias_level_done: card=vscn-2046 val=1 + aplay-229 [000] 1250.140786: snd_soc_bias_level_start: card=vscn-2046 val=2 + aplay-229 [000] 1250.140788: snd_soc_bias_level_done: card=vscn-2046 val=2 + kworker/u8:1-21 [000] 1250.140871: snd_soc_bias_level_start: card=vscn-2046 val=1 + kworker/u8:0-11 [000] 1250.140951: snd_soc_bias_level_start: card=vscn-2046 val=1 + kworker/u8:0-11 [000] 1250.140956: snd_soc_bias_level_done: card=vscn-2046 val=1 + kworker/u8:0-11 [000] 1250.140959: snd_soc_bias_level_start: card=vscn-2046 val=2 + kworker/u8:0-11 [000] 1250.140961: snd_soc_bias_level_done: card=vscn-2046 val=2 + kworker/u8:1-21 [000] 1250.167219: snd_soc_bias_level_done: card=vscn-2046 val=1 + kworker/u8:1-21 [000] 1250.167222: snd_soc_bias_level_start: card=vscn-2046 val=2 + kworker/u8:1-21 [000] 1250.167232: snd_soc_bias_level_done: card=vscn-2046 val=2 + kworker/u8:0-11 [000] 1250.167440: snd_soc_bias_level_start: card=vscn-2046 val=3 + kworker/u8:0-11 [000] 1250.167444: snd_soc_bias_level_done: card=vscn-2046 val=3 + kworker/u8:1-21 [000] 1250.167497: snd_soc_bias_level_start: card=vscn-2046 val=3 + kworker/u8:1-21 [000] 1250.167506: snd_soc_bias_level_done: card=vscn-2046 val=3 + + There are clearly multiple calls, one per component, but they cannot be + discriminated from each other. + + Change the ftrace events to also print the component name, to make it clear + which part of the code is involved. This requires changing the passed value + from a struct snd_soc_card, where the DAPM context is not kwown, to a + struct snd_soc_dapm_context where it is obviously known but the a card + pointer is also available. + + With this change, the resulting trace becomes: + + aplay-247 [000] 1436.357332: snd_soc_bias_level_start: card=vscn-2046 component=(none) val=1 + aplay-247 [000] 1436.357338: snd_soc_bias_level_done: card=vscn-2046 component=(none) val=1 + aplay-247 [000] 1436.357340: snd_soc_bias_level_start: card=vscn-2046 component=(none) val=2 + aplay-247 [000] 1436.357343: snd_soc_bias_level_done: card=vscn-2046 component=(none) val=2 + kworker/u8:4-215 [000] 1436.357437: snd_soc_bias_level_start: card=vscn-2046 component=ff560000.codec val=1 + kworker/u8:5-231 [000] 1436.357518: snd_soc_bias_level_start: card=vscn-2046 component=ff320000.i2s val=1 + kworker/u8:5-231 [000] 1436.357523: snd_soc_bias_level_done: card=vscn-2046 component=ff320000.i2s val=1 + kworker/u8:5-231 [000] 1436.357526: snd_soc_bias_level_start: card=vscn-2046 component=ff320000.i2s val=2 + kworker/u8:5-231 [000] 1436.357528: snd_soc_bias_level_done: card=vscn-2046 component=ff320000.i2s val=2 + kworker/u8:4-215 [000] 1436.383217: snd_soc_bias_level_done: card=vscn-2046 component=ff560000.codec val=1 + kworker/u8:4-215 [000] 1436.383221: snd_soc_bias_level_start: card=vscn-2046 component=ff560000.codec val=2 + kworker/u8:4-215 [000] 1436.383231: snd_soc_bias_level_done: card=vscn-2046 component=ff560000.codec val=2 + kworker/u8:5-231 [000] 1436.383468: snd_soc_bias_level_start: card=vscn-2046 component=ff320000.i2s val=3 + kworker/u8:5-231 [000] 1436.383472: snd_soc_bias_level_done: card=vscn-2046 component=ff320000.i2s val=3 + kworker/u8:4-215 [000] 1436.383503: snd_soc_bias_level_start: card=vscn-2046 component=ff560000.codec val=3 + kworker/u8:4-215 [000] 1436.383513: snd_soc_bias_level_done: card=vscn-2046 component=ff560000.codec val=3 + +Upstream-Status: Backport [303434ab Fix: ASoC add component to set_bias_level events in linux 6.9-rc1] + +Change-Id: I959f1680c002acdf29828b968d3975247f5433d8 +Signed-off-by: Kienan Stewart <kstewart@efficios.com> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> +--- + include/instrumentation/events/asoc.h | 36 +++++++++++++++++++++++++++ + 1 file changed, 36 insertions(+) + +Index: lttng-modules-2.13.12/include/instrumentation/events/asoc.h +=================================================================== +--- lttng-modules-2.13.12.orig/include/instrumentation/events/asoc.h ++++ lttng-modules-2.13.12/include/instrumentation/events/asoc.h +@@ -10,6 +10,7 @@ + #include <lttng/kernel-version.h> + + #define DAPM_DIRECT "(direct)" ++#define DAPM_COMPONENT_NONE "(none)" + + #ifndef _TRACE_ASOC_DEF + #define _TRACE_ASOC_DEF +@@ -119,6 +120,40 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(asoc + ) + #endif + ++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,9,0)) ++LTTNG_TRACEPOINT_EVENT_CLASS(asoc_snd_soc_dapm_context, ++ ++ TP_PROTO(struct snd_soc_dapm_context *dapm, int val), ++ ++ TP_ARGS(dapm, val), ++ ++ TP_FIELDS( ++ ctf_string(name, dapm->card->name) ++ ctf_string(component, dapm->component ? dapm->component->name : DAPM_COMPONENT_NONE) ++ ctf_integer(int, val, val) ++ ) ++) ++ ++LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(asoc_snd_soc_dapm_context, snd_soc_bias_level_start, ++ ++ asoc_snd_soc_bias_level_start, ++ ++ TP_PROTO(struct snd_soc_dapm_context *dapm, int val), ++ ++ TP_ARGS(dapm, val) ++ ++) ++ ++LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(asoc_snd_soc_dapm_context, snd_soc_bias_level_done, ++ ++ asoc_snd_soc_bias_level_done, ++ ++ TP_PROTO(struct snd_soc_dapm_context *dapm, int val), ++ ++ TP_ARGS(dapm, val) ++ ++) ++#else + LTTNG_TRACEPOINT_EVENT_CLASS(asoc_snd_soc_card, + + TP_PROTO(struct snd_soc_card *card, int val), +@@ -150,6 +185,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(asoc + TP_ARGS(card, val) + + ) ++#endif + + #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,9,0)) + LTTNG_TRACEPOINT_EVENT_CLASS(asoc_snd_soc_dapm_basic, diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch deleted file mode 100644 index fab673b854..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch +++ /dev/null @@ -1,41 +0,0 @@ -From e10ab43dd0e425df5bc0ac763447664ed075ba05 Mon Sep 17 00:00:00 2001 -From: Michael Jeanson <mjeanson@efficios.com> -Date: Mon, 10 Aug 2020 11:22:05 -0400 -Subject: [PATCH 02/10] fix: Move mmutrace.h into the mmu/ sub-directory (v5.9) - - commit 33e3042dac6bcc33b80835f7d7b502b1d74c457c - Author: Sean Christopherson <sean.j.christopherson@intel.com> - Date: Mon Jun 22 13:20:29 2020 -0700 - - KVM: x86/mmu: Move mmu_audit.c and mmutrace.h into the mmu/ sub-directory - - Move mmu_audit.c and mmutrace.h under mmu/ where they belong. - -Upstream-Status: Backport - -Change-Id: I582525ccca34e1e3bd62870364108a7d3e9df2e4 -Signed-off-by: Michael Jeanson <mjeanson@efficios.com> -Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> ---- - probes/lttng-probe-kvm-x86-mmu.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c -index 37384a2..5a7ef1e 100644 ---- a/probes/lttng-probe-kvm-x86-mmu.c -+++ b/probes/lttng-probe-kvm-x86-mmu.c -@@ -24,7 +24,11 @@ - */ - #include <wrapper/tracepoint.h> - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)) -+#include <../../arch/x86/kvm/mmu/mmutrace.h> -+#else - #include <../../arch/x86/kvm/mmutrace.h> -+#endif - - #undef TRACE_INCLUDE_PATH - #undef TRACE_INCLUDE_FILE --- -2.19.1 - diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-Fix-mm_compaction_migratepages-changed-in-linux-6.9-.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-Fix-mm_compaction_migratepages-changed-in-linux-6.9-.patch new file mode 100644 index 0000000000..66c48ebe8f --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0003-Fix-mm_compaction_migratepages-changed-in-linux-6.9-.patch @@ -0,0 +1,81 @@ +From f4a6415f8d5fa447868d1fdc7119e0a328966379 Mon Sep 17 00:00:00 2001 +From: Kienan Stewart <kstewart@efficios.com> +Date: Mon, 25 Mar 2024 10:30:32 -0400 +Subject: [PATCH 3/4] Fix: mm_compaction_migratepages changed in linux 6.9-rc1 + +See upstream commit: + + commit ab755bf4249b992fc2140d615ab0a686d50765b4 + Author: Baolin Wang <baolin.wang@linux.alibaba.com> + Date: Tue Feb 20 14:16:31 2024 +0800 + + mm: compaction: update the cc->nr_migratepages when allocating or freeing the freepages + + Currently we will use 'cc->nr_freepages >= cc->nr_migratepages' comparison + to ensure that enough freepages are isolated in isolate_freepages(), + however it just decreases the cc->nr_freepages without updating + cc->nr_migratepages in compaction_alloc(), which will waste more CPU + cycles and cause too many freepages to be isolated. + + So we should also update the cc->nr_migratepages when allocating or + freeing the freepages to avoid isolating excess freepages. And I can see + fewer free pages are scanned and isolated when running thpcompact on my + Arm64 server: + + k6.7 k6.7_patched + Ops Compaction pages isolated 120692036.00 118160797.00 + Ops Compaction migrate scanned 131210329.00 154093268.00 + Ops Compaction free scanned 1090587971.00 1080632536.00 + Ops Compact scan efficiency 12.03 14.26 + + Moreover, I did not see an obvious latency improvements, this is likely + because isolating freepages is not the bottleneck in the thpcompact test + case. + + k6.7 k6.7_patched + Amean fault-both-1 1089.76 ( 0.00%) 1080.16 * 0.88%* + Amean fault-both-3 1616.48 ( 0.00%) 1636.65 * -1.25%* + Amean fault-both-5 2266.66 ( 0.00%) 2219.20 * 2.09%* + Amean fault-both-7 2909.84 ( 0.00%) 2801.90 * 3.71%* + Amean fault-both-12 4861.26 ( 0.00%) 4733.25 * 2.63%* + Amean fault-both-18 7351.11 ( 0.00%) 6950.51 * 5.45%* + Amean fault-both-24 9059.30 ( 0.00%) 9159.99 * -1.11%* + Amean fault-both-30 10685.68 ( 0.00%) 11399.02 * -6.68%* + +Upstream-Status: Backport [175fe77c Fix: mm_compaction_migratepages changed in linux 6.9-rc1] + +Change-Id: I103a43fd1b549360b3fc978fd409b7c17ef3e192 +Signed-off-by: Kienan Stewart <kstewart@efficios.com> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> +--- + include/instrumentation/events/compaction.h | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +Index: lttng-modules-2.13.12/include/instrumentation/events/compaction.h +=================================================================== +--- lttng-modules-2.13.12.orig/include/instrumentation/events/compaction.h ++++ lttng-modules-2.13.12/include/instrumentation/events/compaction.h +@@ -97,7 +97,22 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(comp + + #endif /* #else #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0) */ + +-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0) || \ ++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,9,0)) ++LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages, ++ ++ compaction_migratepages, ++ ++ TP_PROTO(unsigned int nr_migratepages, ++ unsigned int nr_succeeded), ++ ++ TP_ARGS(nr_migratepages, nr_succeeded), ++ ++ TP_FIELDS( ++ ctf_integer(unsigned long, nr_migrated, nr_succeeded) ++ ctf_integer(unsigned long, nr_failed, nr_migratepages - nr_succeeded) ++ ) ++) ++#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0) || \ + LTTNG_RHEL_KERNEL_RANGE(5,14,0,163,0,0, 5,15,0,0,0,0)) + LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages, + diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch deleted file mode 100644 index 524631cc72..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch +++ /dev/null @@ -1,39 +0,0 @@ -From f16315cc45c4c6b880de541bb092ca18a13952b7 Mon Sep 17 00:00:00 2001 -From: Michael Jeanson <mjeanson@efficios.com> -Date: Mon, 10 Aug 2020 11:36:03 -0400 -Subject: [PATCH 03/10] fix: KVM: x86/mmu: Make kvm_mmu_page definition and - accessor internal-only (v5.9) - - commit 985ab2780164698ec6e7d73fad523d50449261dd - Author: Sean Christopherson <sean.j.christopherson@intel.com> - Date: Mon Jun 22 13:20:32 2020 -0700 - - KVM: x86/mmu: Make kvm_mmu_page definition and accessor internal-only - - Make 'struct kvm_mmu_page' MMU-only, nothing outside of the MMU should - be poking into the gory details of shadow pages. - -Upstream-Status: Backport - -Change-Id: Ia5c1b9c49c2b00dad1d5b17c50c3dc730dafda20 -Signed-off-by: Michael Jeanson <mjeanson@efficios.com> -Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> ---- - probes/lttng-probe-kvm-x86-mmu.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c -index 5a7ef1e..8f98186 100644 ---- a/probes/lttng-probe-kvm-x86-mmu.c -+++ b/probes/lttng-probe-kvm-x86-mmu.c -@@ -25,6 +25,7 @@ - #include <wrapper/tracepoint.h> - - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)) -+#include <../../arch/x86/kvm/mmu/mmu_internal.h> - #include <../../arch/x86/kvm/mmu/mmutrace.h> - #else - #include <../../arch/x86/kvm/mmutrace.h> --- -2.19.1 - diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-Fix-dev_base_lock-removed-in-linux-6.9-rc1.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-Fix-dev_base_lock-removed-in-linux-6.9-rc1.patch new file mode 100644 index 0000000000..59ef4f9313 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0004-Fix-dev_base_lock-removed-in-linux-6.9-rc1.patch @@ -0,0 +1,57 @@ +From 217bc2e4685050dddce9bdd2557b64f6b8c16622 Mon Sep 17 00:00:00 2001 +From: Kienan Stewart <kstewart@efficios.com> +Date: Mon, 25 Mar 2024 10:53:46 -0400 +Subject: [PATCH 4/4] Fix: dev_base_lock removed in linux 6.9-rc1 + +See upstream commit: + + commit 1b3ef46cb7f2618cc0b507393220a69810f6da12 + Author: Eric Dumazet <edumazet@google.com> + Date: Tue Feb 13 06:32:45 2024 +0000 + + net: remove dev_base_lock + + dev_base_lock is not needed anymore, all remaining users also hold RTNL. + +Upstream-Status: Backport [52eb2ee9 Fix: dev_base_lock removed in linux 6.9-rc1] + +Change-Id: I6b07e6eed07fd398302ca14d23162ed24d74df15 +Signed-off-by: Kienan Stewart <kstewart@efficios.com> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> +--- + src/lttng-statedump-impl.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +Index: lttng-modules-2.13.12/src/lttng-statedump-impl.c +=================================================================== +--- lttng-modules-2.13.12.orig/src/lttng-statedump-impl.c ++++ lttng-modules-2.13.12/src/lttng-statedump-impl.c +@@ -392,6 +392,20 @@ void lttng_enumerate_device(struct lttng + } + } + ++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,9,0)) ++static ++int lttng_enumerate_network_ip_interface(struct lttng_kernel_session *session) ++{ ++ struct net_device *dev; ++ ++ rtnl_lock(); ++ for_each_netdev(&init_net, dev) ++ lttng_enumerate_device(session, dev); ++ rtnl_unlock(); ++ ++ return 0; ++} ++#else + static + int lttng_enumerate_network_ip_interface(struct lttng_kernel_session *session) + { +@@ -404,6 +418,7 @@ int lttng_enumerate_network_ip_interface + + return 0; + } ++#endif /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,9,0)) */ + #else /* CONFIG_INET */ + static inline + int lttng_enumerate_network_ip_interface(struct lttng_kernel_session *session) diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch deleted file mode 100644 index e29c07252c..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001 -From: Michael Jeanson <mjeanson@efficios.com> -Date: Mon, 24 Aug 2020 15:26:04 -0400 -Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list - (v5.9) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -See upstream commit: - - commit 27bc446e2def38db3244a6eb4bb1d6312936610a - Author: brookxu <brookxu.cn@gmail.com> - Date: Mon Aug 17 15:36:15 2020 +0800 - - ext4: limit the length of per-inode prealloc list - - In the scenario of writing sparse files, the per-inode prealloc list may - be very long, resulting in high overhead for ext4_mb_use_preallocated(). - To circumvent this problem, we limit the maximum length of per-inode - prealloc list to 512 and allow users to modify it. - - After patching, we observed that the sys ratio of cpu has dropped, and - the system throughput has increased significantly. We created a process - to write the sparse file, and the running time of the process on the - fixed kernel was significantly reduced, as follows: - - Running time on unfixed kernel: - [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat - real 0m2.051s - user 0m0.008s - sys 0m2.026s - - Running time on fixed kernel: - [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat - real 0m0.471s - user 0m0.004s - sys 0m0.395s - -Upstream-Status: Backport - -Signed-off-by: Michael Jeanson <mjeanson@efficios.com> -Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> -Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053 ---- - instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h -index 5f7ab28..72ad4c9 100644 ---- a/instrumentation/events/lttng-module/ext4.h -+++ b/instrumentation/events/lttng-module/ext4.h -@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa, - ) - #endif - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)) -+LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations, -+ TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed), -+ -+ TP_ARGS(inode, len, needed), -+ -+ TP_FIELDS( -+ ctf_integer(dev_t, dev, inode->i_sb->s_dev) -+ ctf_integer(ino_t, ino, inode->i_ino) -+ ctf_integer(unsigned int, len, len) -+ ctf_integer(unsigned int, needed, needed) -+ ) -+) -+#else - LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations, - TP_PROTO(struct inode *inode), - -@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations, - ctf_integer(ino_t, ino, inode->i_ino) - ) - ) -+#endif - - LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations, - TP_PROTO(struct super_block *sb, int needed), --- -2.19.1 - diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch deleted file mode 100644 index f76e9698c8..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 52563d02a9234215b62c5f519aa1b5d8589ccd0a Mon Sep 17 00:00:00 2001 -From: Michael Jeanson <mjeanson@efficios.com> -Date: Mon, 24 Aug 2020 15:37:50 -0400 -Subject: [PATCH 05/10] =?UTF-8?q?fix:=20ext4:=20indicate=20via=20a=20block?= - =?UTF-8?q?=20bitmap=20read=20is=20prefetched=E2=80=A6=20(v5.9)?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -See upstream commit: - - commit ab74c7b23f3770935016e3eb3ecdf1e42b73efaa - Author: Theodore Ts'o <tytso@mit.edu> - Date: Wed Jul 15 11:48:55 2020 -0400 - - ext4: indicate via a block bitmap read is prefetched via a tracepoint - - Modify the ext4_read_block_bitmap_load tracepoint so that it tells us - whether a block bitmap is being prefetched. - -Upstream-Status: Backport - -Signed-off-by: Michael Jeanson <mjeanson@efficios.com> -Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> -Change-Id: I0e5e2c5b8004223d0928235c092449ee16a940e1 ---- - instrumentation/events/lttng-module/ext4.h | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h -index 72ad4c9..4476abb 100644 ---- a/instrumentation/events/lttng-module/ext4.h -+++ b/instrumentation/events/lttng-module/ext4.h -@@ -893,12 +893,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_mb_buddy_bitmap_load, - TP_ARGS(sb, group) - ) - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)) -+LTTNG_TRACEPOINT_EVENT(ext4_read_block_bitmap_load, -+ TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch), -+ -+ TP_ARGS(sb, group, prefetch), -+ -+ TP_FIELDS( -+ ctf_integer(dev_t, dev, sb->s_dev) -+ ctf_integer(__u32, group, group) -+ ctf_integer(bool, prefetch, prefetch) -+ ) -+) -+#else - LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_read_block_bitmap_load, - - TP_PROTO(struct super_block *sb, unsigned long group), - - TP_ARGS(sb, group) - ) -+#endif - - LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_load_inode_bitmap, - --- -2.19.1 - diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch deleted file mode 100644 index 0970dd30aa..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch +++ /dev/null @@ -1,391 +0,0 @@ -From 57ccbfa6a8a79c7b84394c2097efaf7935607aa5 Mon Sep 17 00:00:00 2001 -From: Michael Jeanson <mjeanson@efficios.com> -Date: Tue, 25 Aug 2020 10:56:29 -0400 -Subject: [PATCH 06/10] fix: removal of [smp_]read_barrier_depends (v5.9) - -See upstream commits: - - commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb - Author: Will Deacon <will@kernel.org> - Date: Tue Oct 24 11:22:47 2017 +0100 - - locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE() - - In preparation for the removal of lockless_dereference(), which is the - same as READ_ONCE() on all architectures other than Alpha, add an - implicit smp_read_barrier_depends() to READ_ONCE() so that it can be - used to head dependency chains on all architectures. - - commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb - Author: Will Deacon <will.deacon@arm.com> - Date: Tue Oct 24 11:22:47 2017 +0100 - - locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE() - - In preparation for the removal of lockless_dereference(), which is the - same as READ_ONCE() on all architectures other than Alpha, add an - implicit smp_read_barrier_depends() to READ_ONCE() so that it can be - used to head dependency chains on all architectures. - -Upstream-Status: Backport - -Change-Id: Ife8880bd9378dca2972da8838f40fc35ccdfaaac -Signed-off-by: Michael Jeanson <mjeanson@efficios.com> -Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> ---- - instrumentation/events/lttng-module/i2c.h | 4 ++-- - lib/ringbuffer/backend.h | 2 +- - lib/ringbuffer/backend_internal.h | 2 +- - lib/ringbuffer/frontend.h | 4 ++-- - lib/ringbuffer/ring_buffer_frontend.c | 4 ++-- - lib/ringbuffer/ring_buffer_iterator.c | 2 +- - lttng-events.c | 8 ++++---- - probes/lttng-kprobes.c | 6 +++--- - probes/lttng-kretprobes.c | 6 +++--- - probes/lttng-tracepoint-event-impl.h | 12 ++++++------ - probes/lttng-uprobes.c | 6 +++--- - wrapper/compiler.h | 18 ++++++++++++++++++ - wrapper/trace-clock.h | 15 +++++---------- - 13 files changed, 51 insertions(+), 38 deletions(-) - -diff --git a/instrumentation/events/lttng-module/i2c.h b/instrumentation/events/lttng-module/i2c.h -index dcbabf6..131d134 100644 ---- a/instrumentation/events/lttng-module/i2c.h -+++ b/instrumentation/events/lttng-module/i2c.h -@@ -23,7 +23,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_write, - - TP_code_pre( - tp_locvar->extract_sensitive_payload = -- READ_ONCE(extract_sensitive_payload); -+ LTTNG_READ_ONCE(extract_sensitive_payload); - ), - - TP_FIELDS( -@@ -78,7 +78,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_reply, - - TP_code_pre( - tp_locvar->extract_sensitive_payload = -- READ_ONCE(extract_sensitive_payload); -+ LTTNG_READ_ONCE(extract_sensitive_payload); - ), - - TP_FIELDS( -diff --git a/lib/ringbuffer/backend.h b/lib/ringbuffer/backend.h -index da937f2..43e1d47 100644 ---- a/lib/ringbuffer/backend.h -+++ b/lib/ringbuffer/backend.h -@@ -156,7 +156,7 @@ size_t lib_ring_buffer_do_strcpy(const struct lib_ring_buffer_config *config, - * Only read source character once, in case it is - * modified concurrently. - */ -- c = READ_ONCE(src[count]); -+ c = LTTNG_READ_ONCE(src[count]); - if (!c) - break; - lib_ring_buffer_do_copy(config, &dest[count], &c, 1); -diff --git a/lib/ringbuffer/backend_internal.h b/lib/ringbuffer/backend_internal.h -index 2d6a345..1226fd8 100644 ---- a/lib/ringbuffer/backend_internal.h -+++ b/lib/ringbuffer/backend_internal.h -@@ -367,7 +367,7 @@ void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config, - * Performing a volatile access to read the sb_pages, because we want to - * read a coherent version of the pointer and the associated noref flag. - */ -- id = READ_ONCE(bufb->buf_wsb[idx].id); -+ id = LTTNG_READ_ONCE(bufb->buf_wsb[idx].id); - for (;;) { - /* This check is called on the fast path for each record. */ - if (likely(!subbuffer_id_is_noref(config, id))) { -diff --git a/lib/ringbuffer/frontend.h b/lib/ringbuffer/frontend.h -index 6f516d9..41382fe 100644 ---- a/lib/ringbuffer/frontend.h -+++ b/lib/ringbuffer/frontend.h -@@ -79,7 +79,7 @@ void *channel_destroy(struct channel *chan); - #define for_each_channel_cpu(cpu, chan) \ - for ((cpu) = -1; \ - ({ (cpu) = cpumask_next(cpu, (chan)->backend.cpumask); \ -- smp_read_barrier_depends(); (cpu) < nr_cpu_ids; });) -+ smp_rmb(); (cpu) < nr_cpu_ids; });) - - extern struct lib_ring_buffer *channel_get_ring_buffer( - const struct lib_ring_buffer_config *config, -@@ -155,7 +155,7 @@ static inline - int lib_ring_buffer_is_finalized(const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *buf) - { -- int finalized = READ_ONCE(buf->finalized); -+ int finalized = LTTNG_READ_ONCE(buf->finalized); - /* - * Read finalized before counters. - */ -diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c -index 3cab365..4980d20 100644 ---- a/lib/ringbuffer/ring_buffer_frontend.c -+++ b/lib/ringbuffer/ring_buffer_frontend.c -@@ -1074,7 +1074,7 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf, - int finalized; - - retry: -- finalized = READ_ONCE(buf->finalized); -+ finalized = LTTNG_READ_ONCE(buf->finalized); - /* - * Read finalized before counters. - */ -@@ -1245,7 +1245,7 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf, - return -EBUSY; - } - retry: -- finalized = READ_ONCE(buf->finalized); -+ finalized = LTTNG_READ_ONCE(buf->finalized); - /* - * Read finalized before counters. - */ -diff --git a/lib/ringbuffer/ring_buffer_iterator.c b/lib/ringbuffer/ring_buffer_iterator.c -index d25db72..7b4f20a 100644 ---- a/lib/ringbuffer/ring_buffer_iterator.c -+++ b/lib/ringbuffer/ring_buffer_iterator.c -@@ -46,7 +46,7 @@ restart: - switch (iter->state) { - case ITER_GET_SUBBUF: - ret = lib_ring_buffer_get_next_subbuf(buf); -- if (ret && !READ_ONCE(buf->finalized) -+ if (ret && !LTTNG_READ_ONCE(buf->finalized) - && config->alloc == RING_BUFFER_ALLOC_GLOBAL) { - /* - * Use "pull" scheme for global buffers. The reader -diff --git a/lttng-events.c b/lttng-events.c -index be7e389..d719294 100644 ---- a/lttng-events.c -+++ b/lttng-events.c -@@ -1719,7 +1719,7 @@ int lttng_metadata_printf(struct lttng_session *session, - size_t len; - va_list ap; - -- WARN_ON_ONCE(!READ_ONCE(session->active)); -+ WARN_ON_ONCE(!LTTNG_READ_ONCE(session->active)); - - va_start(ap, fmt); - str = kvasprintf(GFP_KERNEL, fmt, ap); -@@ -2305,7 +2305,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session, - { - int ret = 0; - -- if (event->metadata_dumped || !READ_ONCE(session->active)) -+ if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active)) - return 0; - if (chan->channel_type == METADATA_CHANNEL) - return 0; -@@ -2377,7 +2377,7 @@ int _lttng_channel_metadata_statedump(struct lttng_session *session, - { - int ret = 0; - -- if (chan->metadata_dumped || !READ_ONCE(session->active)) -+ if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active)) - return 0; - - if (chan->channel_type == METADATA_CHANNEL) -@@ -2604,7 +2604,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session) - struct lttng_event *event; - int ret = 0; - -- if (!READ_ONCE(session->active)) -+ if (!LTTNG_READ_ONCE(session->active)) - return 0; - - lttng_metadata_begin(session); -diff --git a/probes/lttng-kprobes.c b/probes/lttng-kprobes.c -index a44eaa1..38fb72e 100644 ---- a/probes/lttng-kprobes.c -+++ b/probes/lttng-kprobes.c -@@ -31,11 +31,11 @@ int lttng_kprobes_handler_pre(struct kprobe *p, struct pt_regs *regs) - int ret; - unsigned long data = (unsigned long) p->addr; - -- if (unlikely(!READ_ONCE(chan->session->active))) -+ if (unlikely(!LTTNG_READ_ONCE(chan->session->active))) - return 0; -- if (unlikely(!READ_ONCE(chan->enabled))) -+ if (unlikely(!LTTNG_READ_ONCE(chan->enabled))) - return 0; -- if (unlikely(!READ_ONCE(event->enabled))) -+ if (unlikely(!LTTNG_READ_ONCE(event->enabled))) - return 0; - - lib_ring_buffer_ctx_init(&ctx, chan->chan, <tng_probe_ctx, sizeof(data), -diff --git a/probes/lttng-kretprobes.c b/probes/lttng-kretprobes.c -index ab98ff2..a6bcd21 100644 ---- a/probes/lttng-kretprobes.c -+++ b/probes/lttng-kretprobes.c -@@ -51,11 +51,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi, - unsigned long parent_ip; - } payload; - -- if (unlikely(!READ_ONCE(chan->session->active))) -+ if (unlikely(!LTTNG_READ_ONCE(chan->session->active))) - return 0; -- if (unlikely(!READ_ONCE(chan->enabled))) -+ if (unlikely(!LTTNG_READ_ONCE(chan->enabled))) - return 0; -- if (unlikely(!READ_ONCE(event->enabled))) -+ if (unlikely(!LTTNG_READ_ONCE(event->enabled))) - return 0; - - payload.ip = (unsigned long) krpi->rp->kp.addr; -diff --git a/probes/lttng-tracepoint-event-impl.h b/probes/lttng-tracepoint-event-impl.h -index 77b8638..72a669e 100644 ---- a/probes/lttng-tracepoint-event-impl.h -+++ b/probes/lttng-tracepoint-event-impl.h -@@ -1132,11 +1132,11 @@ static void __event_probe__##_name(void *__data, _proto) \ - \ - if (!_TP_SESSION_CHECK(session, __session)) \ - return; \ -- if (unlikely(!READ_ONCE(__session->active))) \ -+ if (unlikely(!LTTNG_READ_ONCE(__session->active))) \ - return; \ -- if (unlikely(!READ_ONCE(__chan->enabled))) \ -+ if (unlikely(!LTTNG_READ_ONCE(__chan->enabled))) \ - return; \ -- if (unlikely(!READ_ONCE(__event->enabled))) \ -+ if (unlikely(!LTTNG_READ_ONCE(__event->enabled))) \ - return; \ - __lf = lttng_rcu_dereference(__session->pid_tracker.p); \ - if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid))) \ -@@ -1225,11 +1225,11 @@ static void __event_probe__##_name(void *__data) \ - \ - if (!_TP_SESSION_CHECK(session, __session)) \ - return; \ -- if (unlikely(!READ_ONCE(__session->active))) \ -+ if (unlikely(!LTTNG_READ_ONCE(__session->active))) \ - return; \ -- if (unlikely(!READ_ONCE(__chan->enabled))) \ -+ if (unlikely(!LTTNG_READ_ONCE(__chan->enabled))) \ - return; \ -- if (unlikely(!READ_ONCE(__event->enabled))) \ -+ if (unlikely(!LTTNG_READ_ONCE(__event->enabled))) \ - return; \ - __lf = lttng_rcu_dereference(__session->pid_tracker.p); \ - if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid))) \ -diff --git a/probes/lttng-uprobes.c b/probes/lttng-uprobes.c -index bc10128..bda1d9b 100644 ---- a/probes/lttng-uprobes.c -+++ b/probes/lttng-uprobes.c -@@ -40,11 +40,11 @@ int lttng_uprobes_handler_pre(struct uprobe_consumer *uc, struct pt_regs *regs) - unsigned long ip; - } payload; - -- if (unlikely(!READ_ONCE(chan->session->active))) -+ if (unlikely(!LTTNG_READ_ONCE(chan->session->active))) - return 0; -- if (unlikely(!READ_ONCE(chan->enabled))) -+ if (unlikely(!LTTNG_READ_ONCE(chan->enabled))) - return 0; -- if (unlikely(!READ_ONCE(event->enabled))) -+ if (unlikely(!LTTNG_READ_ONCE(event->enabled))) - return 0; - - lib_ring_buffer_ctx_init(&ctx, chan->chan, <tng_probe_ctx, -diff --git a/wrapper/compiler.h b/wrapper/compiler.h -index 1496f33..b9f8c51 100644 ---- a/wrapper/compiler.h -+++ b/wrapper/compiler.h -@@ -9,6 +9,7 @@ - #define _LTTNG_WRAPPER_COMPILER_H - - #include <linux/compiler.h> -+#include <linux/version.h> - - /* - * Don't allow compiling with buggy compiler. -@@ -39,4 +40,21 @@ - # define WRITE_ONCE(x, val) ({ ACCESS_ONCE(x) = val; }) - #endif - -+/* -+ * In v4.15 a smp read barrier was added to READ_ONCE to replace -+ * lockless_dereference(), replicate this behavior on prior kernels -+ * and remove calls to smp_read_barrier_depends which was dropped -+ * in v5.9. -+ */ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)) -+#define LTTNG_READ_ONCE(x) READ_ONCE(x) -+#else -+#define LTTNG_READ_ONCE(x) \ -+({ \ -+ typeof(x) __val = READ_ONCE(x); \ -+ smp_read_barrier_depends(); \ -+ __val; \ -+}) -+#endif -+ - #endif /* _LTTNG_WRAPPER_COMPILER_H */ -diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h -index 9f4e366..187fc82 100644 ---- a/wrapper/trace-clock.h -+++ b/wrapper/trace-clock.h -@@ -160,33 +160,30 @@ static inline void put_trace_clock(void) - - static inline u64 trace_clock_read64(void) - { -- struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock); -+ struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock); - - if (likely(!ltc)) { - return trace_clock_read64_monotonic(); - } else { -- read_barrier_depends(); /* load ltc before content */ - return ltc->read64(); - } - } - - static inline u64 trace_clock_freq(void) - { -- struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock); -+ struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock); - - if (!ltc) { - return trace_clock_freq_monotonic(); - } else { -- read_barrier_depends(); /* load ltc before content */ - return ltc->freq(); - } - } - - static inline int trace_clock_uuid(char *uuid) - { -- struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock); -+ struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock); - -- read_barrier_depends(); /* load ltc before content */ - /* Use default UUID cb when NULL */ - if (!ltc || !ltc->uuid) { - return trace_clock_uuid_monotonic(uuid); -@@ -197,24 +194,22 @@ static inline int trace_clock_uuid(char *uuid) - - static inline const char *trace_clock_name(void) - { -- struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock); -+ struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock); - - if (!ltc) { - return trace_clock_name_monotonic(); - } else { -- read_barrier_depends(); /* load ltc before content */ - return ltc->name(); - } - } - - static inline const char *trace_clock_description(void) - { -- struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock); -+ struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock); - - if (!ltc) { - return trace_clock_description_monotonic(); - } else { -- read_barrier_depends(); /* load ltc before content */ - return ltc->description(); - } - } --- -2.19.1 - diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch deleted file mode 100644 index 2843c9cb62..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch +++ /dev/null @@ -1,59 +0,0 @@ -From eae02feb58064eee5ce15a9f6bdffd107c47da05 Mon Sep 17 00:00:00 2001 -From: Michael Jeanson <mjeanson@efficios.com> -Date: Mon, 31 Aug 2020 11:41:38 -0400 -Subject: [PATCH 07/10] fix: writeback: Drop I_DIRTY_TIME_EXPIRE (v5.9) - -See upstream commit: - - commit 5fcd57505c002efc5823a7355e21f48dd02d5a51 - Author: Jan Kara <jack@suse.cz> - Date: Fri May 29 16:24:43 2020 +0200 - - writeback: Drop I_DIRTY_TIME_EXPIRE - - The only use of I_DIRTY_TIME_EXPIRE is to detect in - __writeback_single_inode() that inode got there because flush worker - decided it's time to writeback the dirty inode time stamps (either - because we are syncing or because of age). However we can detect this - directly in __writeback_single_inode() and there's no need for the - strange propagation with I_DIRTY_TIME_EXPIRE flag. - -Upstream-Status: Backport - -Signed-off-by: Michael Jeanson <mjeanson@efficios.com> -Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> -Change-Id: I92e37c2ff3ec36d431e8f9de5c8e37c5a2da55ea ---- - instrumentation/events/lttng-module/writeback.h | 16 +++++++++++++++- - 1 file changed, 15 insertions(+), 1 deletion(-) - -diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h -index affb4eb..ece67ad 100644 ---- a/instrumentation/events/lttng-module/writeback.h -+++ b/instrumentation/events/lttng-module/writeback.h -@@ -46,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode) - - #endif - --#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)) -+#define show_inode_state(state) \ -+ __print_flags(state, "|", \ -+ {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \ -+ {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \ -+ {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \ -+ {I_NEW, "I_NEW"}, \ -+ {I_WILL_FREE, "I_WILL_FREE"}, \ -+ {I_FREEING, "I_FREEING"}, \ -+ {I_CLEAR, "I_CLEAR"}, \ -+ {I_SYNC, "I_SYNC"}, \ -+ {I_DIRTY_TIME, "I_DIRTY_TIME"}, \ -+ {I_REFERENCED, "I_REFERENCED"} \ -+ ) -+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) - #define show_inode_state(state) \ - __print_flags(state, "|", \ - {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \ --- -2.19.1 - diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch deleted file mode 100644 index 7a0d9a38b8..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 87b2affc3eb06f3fb2d0923f18af37713eb6814b Mon Sep 17 00:00:00 2001 -From: Michael Jeanson <mjeanson@efficios.com> -Date: Mon, 31 Aug 2020 14:16:01 -0400 -Subject: [PATCH 08/10] fix: writeback: Fix sync livelock due to b_dirty_time - processing (v5.9) - -See upstream commit: - - commit f9cae926f35e8230330f28c7b743ad088611a8de - Author: Jan Kara <jack@suse.cz> - Date: Fri May 29 16:08:58 2020 +0200 - - writeback: Fix sync livelock due to b_dirty_time processing - - When we are processing writeback for sync(2), move_expired_inodes() - didn't set any inode expiry value (older_than_this). This can result in - writeback never completing if there's steady stream of inodes added to - b_dirty_time list as writeback rechecks dirty lists after each writeback - round whether there's more work to be done. Fix the problem by using - sync(2) start time is inode expiry value when processing b_dirty_time - list similarly as for ordinarily dirtied inodes. This requires some - refactoring of older_than_this handling which simplifies the code - noticeably as a bonus. - -Upstream-Status: Backport - -Change-Id: I8b894b13ccc14d9b8983ee4c2810a927c319560b -Signed-off-by: Michael Jeanson <mjeanson@efficios.com> -Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> ---- - .../events/lttng-module/writeback.h | 39 ++++++++++++------- - 1 file changed, 26 insertions(+), 13 deletions(-) - -diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h -index ece67ad..e9018dd 100644 ---- a/instrumentation/events/lttng-module/writeback.h -+++ b/instrumentation/events/lttng-module/writeback.h -@@ -384,34 +384,48 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc - #endif - LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage) - --#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)) -+LTTNG_TRACEPOINT_EVENT(writeback_queue_io, -+ TP_PROTO(struct bdi_writeback *wb, -+ struct wb_writeback_work *work, -+ unsigned long dirtied_before, -+ int moved), -+ TP_ARGS(wb, work, dirtied_before, moved), -+ TP_FIELDS( -+ ctf_array_text(char, name, dev_name(wb->bdi->dev), 32) -+ ctf_integer(unsigned long, older, dirtied_before) -+ ctf_integer(int, moved, moved) -+ ) -+) -+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - LTTNG_TRACEPOINT_EVENT(writeback_queue_io, - TP_PROTO(struct bdi_writeback *wb, --#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - struct wb_writeback_work *work, --#else -- unsigned long *older_than_this, --#endif - int moved), --#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - TP_ARGS(wb, work, moved), --#else -+ TP_FIELDS( -+ ctf_array_text(char, name, dev_name(wb->bdi->dev), 32) -+ ctf_integer(int, moved, moved) -+ ) -+) -+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) -+LTTNG_TRACEPOINT_EVENT(writeback_queue_io, -+ TP_PROTO(struct bdi_writeback *wb, -+ unsigned long *older_than_this, -+ int moved), - TP_ARGS(wb, older_than_this, moved), --#endif - TP_FIELDS( - ctf_array_text(char, name, dev_name(wb->bdi->dev), 32) --#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) --#else - ctf_integer(unsigned long, older, - older_than_this ? *older_than_this : 0) - ctf_integer(long, age, - older_than_this ? - (jiffies - *older_than_this) * 1000 / HZ - : -1) --#endif - ctf_integer(int, moved, moved) - ) - ) -+#endif - - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)) - LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state, -@@ -460,7 +474,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state, - ctf_integer(unsigned long, dirty_limit, global_dirty_limit) - ) - ) --#else -+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) - LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state, - - writeback_global_dirty_state, -@@ -485,7 +499,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state, - ) - ) - #endif --#endif - - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - --- -2.19.1 - diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch deleted file mode 100644 index 346e1d63ad..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch +++ /dev/null @@ -1,52 +0,0 @@ -From b74b25f349e92d7b5bdc8684e406d6a889f13773 Mon Sep 17 00:00:00 2001 -From: Michael Jeanson <mjeanson@efficios.com> -Date: Fri, 4 Sep 2020 11:52:51 -0400 -Subject: [PATCH 09/10] fix: version ranges for ext4_discard_preallocations and - writeback_queue_io - -Upstream-Status: Backport - -Signed-off-by: Michael Jeanson <mjeanson@efficios.com> -Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> -Change-Id: Id4fa53cb2e713cbda651e1a75deed91013115592 ---- - instrumentation/events/lttng-module/ext4.h | 3 ++- - instrumentation/events/lttng-module/writeback.h | 8 +++++++- - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h -index 4476abb..b172c8d 100644 ---- a/instrumentation/events/lttng-module/ext4.h -+++ b/instrumentation/events/lttng-module/ext4.h -@@ -460,7 +460,8 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa, - ) - #endif - --#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \ -+ LTTNG_KERNEL_RANGE(5,8,6, 5,9,0)) - LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations, - TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed), - -diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h -index e9018dd..09637d7 100644 ---- a/instrumentation/events/lttng-module/writeback.h -+++ b/instrumentation/events/lttng-module/writeback.h -@@ -384,7 +384,13 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc - #endif - LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage) - --#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \ -+ LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \ -+ LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \ -+ LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \ -+ LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \ -+ LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \ -+ LTTNG_KERNEL_RANGE(4,4,235, 4,5,0)) - LTTNG_TRACEPOINT_EVENT(writeback_queue_io, - TP_PROTO(struct bdi_writeback *wb, - struct wb_writeback_work *work, --- -2.19.1 - diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch deleted file mode 100644 index a16750ddb3..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch +++ /dev/null @@ -1,918 +0,0 @@ -From ad594e3a953db1b0c3c059fde45b5a5494f6be78 Mon Sep 17 00:00:00 2001 -From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> -Date: Tue, 28 Jan 2020 16:02:44 -0500 -Subject: [PATCH 10/10] Fix: system call filter table - -The system call filter table has effectively been unused for a long -time due to system call name prefix mismatch. This means the overhead of -selective system call tracing was larger than it should have been because -the event payload preparation would be done for all system calls as soon -as a single system call is traced. - -However, fixing this underlying issue unearths several issues that crept -unnoticed when the "enabler" concept was introduced (after the original -implementation of the system call filter table). - -Here is a list of the issues which are resolved here: - -- Split lttng_syscalls_unregister into an unregister and destroy - function, thus awaiting for a grace period (and therefore quiescence - of the users) after unregistering the system call tracepoints before - freeing the system call filter data structures. This effectively fixes - a use-after-free. - -- The state for enabling "all" system calls vs enabling specific system - calls (and sequences of enable-disable) was incorrect with respect to - the "enablers" semantic. This is solved by always tracking the - bitmap of enabled system calls, and keeping this bitmap even when - enabling all system calls. The sc_filter is now always allocated - before system call tracing is registered to tracepoints, which means - it does not need to be RCU dereferenced anymore. - -Padding fields in the ABI are reserved to select whether to: - -- Trace either native or compat system call (or both, which is the - behavior currently implemented), -- Trace either system call entry or exit (or both, which is the - behavior currently implemented), -- Select the system call to trace by name (behavior currently - implemented) or by system call number, - -Upstream-Status: Backport - -Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> ---- - lttng-abi.c | 43 ++++++ - lttng-abi.h | 26 ++++ - lttng-events.c | 112 +++++++++++++-- - lttng-events.h | 31 ++++- - lttng-syscalls.c | 348 +++++++++++++++++++++++++---------------------- - 5 files changed, 380 insertions(+), 180 deletions(-) - -diff --git a/lttng-abi.c b/lttng-abi.c -index 64ea99d..b33879d 100644 ---- a/lttng-abi.c -+++ b/lttng-abi.c -@@ -1264,6 +1264,46 @@ nomem: - return ret; - } - -+static -+int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param) -+{ -+ /* Limit ABI to implemented features. */ -+ switch (event_param->instrumentation) { -+ case LTTNG_KERNEL_SYSCALL: -+ switch (event_param->u.syscall.entryexit) { -+ case LTTNG_KERNEL_SYSCALL_ENTRYEXIT: -+ break; -+ default: -+ return -EINVAL; -+ } -+ switch (event_param->u.syscall.abi) { -+ case LTTNG_KERNEL_SYSCALL_ABI_ALL: -+ break; -+ default: -+ return -EINVAL; -+ } -+ switch (event_param->u.syscall.match) { -+ case LTTNG_SYSCALL_MATCH_NAME: -+ break; -+ default: -+ return -EINVAL; -+ } -+ break; -+ -+ case LTTNG_KERNEL_TRACEPOINT: /* Fallthrough */ -+ case LTTNG_KERNEL_KPROBE: /* Fallthrough */ -+ case LTTNG_KERNEL_KRETPROBE: /* Fallthrough */ -+ case LTTNG_KERNEL_NOOP: /* Fallthrough */ -+ case LTTNG_KERNEL_UPROBE: -+ break; -+ -+ case LTTNG_KERNEL_FUNCTION: /* Fallthrough */ -+ default: -+ return -EINVAL; -+ } -+ return 0; -+} -+ - static - int lttng_abi_create_event(struct file *channel_file, - struct lttng_kernel_event *event_param) -@@ -1305,6 +1345,9 @@ int lttng_abi_create_event(struct file *channel_file, - ret = -EOVERFLOW; - goto refcount_error; - } -+ ret = lttng_abi_validate_event_param(event_param); -+ if (ret) -+ goto event_error; - if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT - || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) { - struct lttng_enabler *enabler; -diff --git a/lttng-abi.h b/lttng-abi.h -index 1d356ab..51d60e5 100644 ---- a/lttng-abi.h -+++ b/lttng-abi.h -@@ -90,6 +90,31 @@ struct lttng_kernel_event_callsite { - } u; - } __attribute__((packed)); - -+enum lttng_kernel_syscall_entryexit { -+ LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0, -+ LTTNG_KERNEL_SYSCALL_ENTRY = 1, /* Not implemented. */ -+ LTTNG_KERNEL_SYSCALL_EXIT = 2, /* Not implemented. */ -+}; -+ -+enum lttng_kernel_syscall_abi { -+ LTTNG_KERNEL_SYSCALL_ABI_ALL = 0, -+ LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1, /* Not implemented. */ -+ LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2, /* Not implemented. */ -+}; -+ -+enum lttng_kernel_syscall_match { -+ LTTNG_SYSCALL_MATCH_NAME = 0, -+ LTTNG_SYSCALL_MATCH_NR = 1, /* Not implemented. */ -+}; -+ -+struct lttng_kernel_syscall { -+ uint8_t entryexit; /* enum lttng_kernel_syscall_entryexit */ -+ uint8_t abi; /* enum lttng_kernel_syscall_abi */ -+ uint8_t match; /* enum lttng_kernel_syscall_match */ -+ uint8_t padding; -+ uint32_t nr; /* For LTTNG_SYSCALL_MATCH_NR */ -+} __attribute__((packed)); -+ - /* - * For syscall tracing, name = "*" means "enable all". - */ -@@ -106,6 +131,7 @@ struct lttng_kernel_event { - struct lttng_kernel_kprobe kprobe; - struct lttng_kernel_function_tracer ftrace; - struct lttng_kernel_uprobe uprobe; -+ struct lttng_kernel_syscall syscall; - char padding[LTTNG_KERNEL_EVENT_PADDING2]; - } u; - } __attribute__((packed)); -diff --git a/lttng-events.c b/lttng-events.c -index d719294..4c0b04a 100644 ---- a/lttng-events.c -+++ b/lttng-events.c -@@ -201,6 +201,10 @@ void lttng_session_destroy(struct lttng_session *session) - WARN_ON(ret); - } - synchronize_trace(); /* Wait for in-flight events to complete */ -+ list_for_each_entry(chan, &session->chan, list) { -+ ret = lttng_syscalls_destroy(chan); -+ WARN_ON(ret); -+ } - list_for_each_entry_safe(enabler, tmpenabler, - &session->enablers_head, node) - lttng_enabler_destroy(enabler); -@@ -740,6 +744,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan, - event->enabled = 0; - event->registered = 0; - event->desc = event_desc; -+ switch (event_param->u.syscall.entryexit) { -+ case LTTNG_KERNEL_SYSCALL_ENTRYEXIT: -+ ret = -EINVAL; -+ goto register_error; -+ case LTTNG_KERNEL_SYSCALL_ENTRY: -+ event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY; -+ break; -+ case LTTNG_KERNEL_SYSCALL_EXIT: -+ event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT; -+ break; -+ } -+ switch (event_param->u.syscall.abi) { -+ case LTTNG_KERNEL_SYSCALL_ABI_ALL: -+ ret = -EINVAL; -+ goto register_error; -+ case LTTNG_KERNEL_SYSCALL_ABI_NATIVE: -+ event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE; -+ break; -+ case LTTNG_KERNEL_SYSCALL_ABI_COMPAT: -+ event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT; -+ break; -+ } - if (!event->desc) { - ret = -EINVAL; - goto register_error; -@@ -826,8 +852,7 @@ void register_event(struct lttng_event *event) - event); - break; - case LTTNG_KERNEL_SYSCALL: -- ret = lttng_syscall_filter_enable(event->chan, -- desc->name); -+ ret = lttng_syscall_filter_enable(event->chan, event); - break; - case LTTNG_KERNEL_KPROBE: - case LTTNG_KERNEL_UPROBE: -@@ -870,8 +895,7 @@ int _lttng_event_unregister(struct lttng_event *event) - ret = 0; - break; - case LTTNG_KERNEL_SYSCALL: -- ret = lttng_syscall_filter_disable(event->chan, -- desc->name); -+ ret = lttng_syscall_filter_disable(event->chan, event); - break; - case LTTNG_KERNEL_NOOP: - ret = 0; -@@ -1203,39 +1227,87 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc, - struct lttng_enabler *enabler) - { - const char *desc_name, *enabler_name; -+ bool compat = false, entry = false; - - enabler_name = enabler->event_param.name; - switch (enabler->event_param.instrumentation) { - case LTTNG_KERNEL_TRACEPOINT: - desc_name = desc->name; -+ switch (enabler->type) { -+ case LTTNG_ENABLER_STAR_GLOB: -+ return lttng_match_enabler_star_glob(desc_name, enabler_name); -+ case LTTNG_ENABLER_NAME: -+ return lttng_match_enabler_name(desc_name, enabler_name); -+ default: -+ return -EINVAL; -+ } - break; - case LTTNG_KERNEL_SYSCALL: - desc_name = desc->name; -- if (!strncmp(desc_name, "compat_", strlen("compat_"))) -+ if (!strncmp(desc_name, "compat_", strlen("compat_"))) { - desc_name += strlen("compat_"); -+ compat = true; -+ } - if (!strncmp(desc_name, "syscall_exit_", - strlen("syscall_exit_"))) { - desc_name += strlen("syscall_exit_"); - } else if (!strncmp(desc_name, "syscall_entry_", - strlen("syscall_entry_"))) { - desc_name += strlen("syscall_entry_"); -+ entry = true; - } else { - WARN_ON_ONCE(1); - return -EINVAL; - } -+ switch (enabler->event_param.u.syscall.entryexit) { -+ case LTTNG_KERNEL_SYSCALL_ENTRYEXIT: -+ break; -+ case LTTNG_KERNEL_SYSCALL_ENTRY: -+ if (!entry) -+ return 0; -+ break; -+ case LTTNG_KERNEL_SYSCALL_EXIT: -+ if (entry) -+ return 0; -+ break; -+ default: -+ return -EINVAL; -+ } -+ switch (enabler->event_param.u.syscall.abi) { -+ case LTTNG_KERNEL_SYSCALL_ABI_ALL: -+ break; -+ case LTTNG_KERNEL_SYSCALL_ABI_NATIVE: -+ if (compat) -+ return 0; -+ break; -+ case LTTNG_KERNEL_SYSCALL_ABI_COMPAT: -+ if (!compat) -+ return 0; -+ break; -+ default: -+ return -EINVAL; -+ } -+ switch (enabler->event_param.u.syscall.match) { -+ case LTTNG_SYSCALL_MATCH_NAME: -+ switch (enabler->type) { -+ case LTTNG_ENABLER_STAR_GLOB: -+ return lttng_match_enabler_star_glob(desc_name, enabler_name); -+ case LTTNG_ENABLER_NAME: -+ return lttng_match_enabler_name(desc_name, enabler_name); -+ default: -+ return -EINVAL; -+ } -+ break; -+ case LTTNG_SYSCALL_MATCH_NR: -+ return -EINVAL; /* Not implemented. */ -+ default: -+ return -EINVAL; -+ } - break; - default: - WARN_ON_ONCE(1); - return -EINVAL; - } -- switch (enabler->type) { -- case LTTNG_ENABLER_STAR_GLOB: -- return lttng_match_enabler_star_glob(desc_name, enabler_name); -- case LTTNG_ENABLER_NAME: -- return lttng_match_enabler_name(desc_name, enabler_name); -- default: -- return -EINVAL; -- } - } - - static -@@ -1361,9 +1433,21 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler) - static - int lttng_enabler_ref_events(struct lttng_enabler *enabler) - { -- struct lttng_session *session = enabler->chan->session; -+ struct lttng_channel *chan = enabler->chan; -+ struct lttng_session *session = chan->session; - struct lttng_event *event; - -+ if (enabler->event_param.instrumentation == LTTNG_KERNEL_SYSCALL && -+ enabler->event_param.u.syscall.entryexit == LTTNG_KERNEL_SYSCALL_ENTRYEXIT && -+ enabler->event_param.u.syscall.abi == LTTNG_KERNEL_SYSCALL_ABI_ALL && -+ enabler->event_param.u.syscall.match == LTTNG_SYSCALL_MATCH_NAME && -+ !strcmp(enabler->event_param.name, "*")) { -+ if (enabler->enabled) -+ WRITE_ONCE(chan->syscall_all, 1); -+ else -+ WRITE_ONCE(chan->syscall_all, 0); -+ } -+ - /* First ensure that probe events are created for this enabler. */ - lttng_create_event_if_missing(enabler); - -diff --git a/lttng-events.h b/lttng-events.h -index a36a312..d4d9976 100644 ---- a/lttng-events.h -+++ b/lttng-events.h -@@ -292,6 +292,16 @@ struct lttng_uprobe_handler { - struct list_head node; - }; - -+enum lttng_syscall_entryexit { -+ LTTNG_SYSCALL_ENTRY, -+ LTTNG_SYSCALL_EXIT, -+}; -+ -+enum lttng_syscall_abi { -+ LTTNG_SYSCALL_ABI_NATIVE, -+ LTTNG_SYSCALL_ABI_COMPAT, -+}; -+ - /* - * lttng_event structure is referred to by the tracing fast path. It must be - * kept small. -@@ -318,6 +328,11 @@ struct lttng_event { - struct inode *inode; - struct list_head head; - } uprobe; -+ struct { -+ char *syscall_name; -+ enum lttng_syscall_entryexit entryexit; -+ enum lttng_syscall_abi abi; -+ } syscall; - } u; - struct list_head list; /* Event list in session */ - unsigned int metadata_dumped:1; -@@ -457,10 +472,10 @@ struct lttng_channel { - struct lttng_syscall_filter *sc_filter; - int header_type; /* 0: unset, 1: compact, 2: large */ - enum channel_type channel_type; -+ int syscall_all; - unsigned int metadata_dumped:1, - sys_enter_registered:1, - sys_exit_registered:1, -- syscall_all:1, - tstate:1; /* Transient enable state */ - }; - -@@ -653,10 +668,11 @@ void lttng_clock_unref(void); - #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS) - int lttng_syscalls_register(struct lttng_channel *chan, void *filter); - int lttng_syscalls_unregister(struct lttng_channel *chan); -+int lttng_syscalls_destroy(struct lttng_channel *chan); - int lttng_syscall_filter_enable(struct lttng_channel *chan, -- const char *name); -+ struct lttng_event *event); - int lttng_syscall_filter_disable(struct lttng_channel *chan, -- const char *name); -+ struct lttng_event *event); - long lttng_channel_syscall_mask(struct lttng_channel *channel, - struct lttng_kernel_syscall_mask __user *usyscall_mask); - #else -@@ -670,14 +686,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan) - return 0; - } - -+static inline int lttng_syscalls_destroy(struct lttng_channel *chan) -+{ -+ return 0; -+} -+ - static inline int lttng_syscall_filter_enable(struct lttng_channel *chan, -- const char *name) -+ struct lttng_event *event); - { - return -ENOSYS; - } - - static inline int lttng_syscall_filter_disable(struct lttng_channel *chan, -- const char *name) -+ struct lttng_event *event); - { - return -ENOSYS; - } -diff --git a/lttng-syscalls.c b/lttng-syscalls.c -index 97f1ba9..26cead6 100644 ---- a/lttng-syscalls.c -+++ b/lttng-syscalls.c -@@ -367,8 +367,10 @@ const struct trace_syscall_entry compat_sc_exit_table[] = { - #undef CREATE_SYSCALL_TABLE - - struct lttng_syscall_filter { -- DECLARE_BITMAP(sc, NR_syscalls); -- DECLARE_BITMAP(sc_compat, NR_compat_syscalls); -+ DECLARE_BITMAP(sc_entry, NR_syscalls); -+ DECLARE_BITMAP(sc_exit, NR_syscalls); -+ DECLARE_BITMAP(sc_compat_entry, NR_compat_syscalls); -+ DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls); - }; - - static void syscall_entry_unknown(struct lttng_event *event, -@@ -391,29 +393,23 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id) - size_t table_len; - - if (unlikely(in_compat_syscall())) { -- struct lttng_syscall_filter *filter; -- -- filter = lttng_rcu_dereference(chan->sc_filter); -- if (filter) { -- if (id < 0 || id >= NR_compat_syscalls -- || !test_bit(id, filter->sc_compat)) { -- /* System call filtered out. */ -- return; -- } -+ struct lttng_syscall_filter *filter = chan->sc_filter; -+ -+ if (id < 0 || id >= NR_compat_syscalls -+ || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) { -+ /* System call filtered out. */ -+ return; - } - table = compat_sc_table; - table_len = ARRAY_SIZE(compat_sc_table); - unknown_event = chan->sc_compat_unknown; - } else { -- struct lttng_syscall_filter *filter; -- -- filter = lttng_rcu_dereference(chan->sc_filter); -- if (filter) { -- if (id < 0 || id >= NR_syscalls -- || !test_bit(id, filter->sc)) { -- /* System call filtered out. */ -- return; -- } -+ struct lttng_syscall_filter *filter = chan->sc_filter; -+ -+ if (id < 0 || id >= NR_syscalls -+ || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) { -+ /* System call filtered out. */ -+ return; - } - table = sc_table; - table_len = ARRAY_SIZE(sc_table); -@@ -545,29 +541,23 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret) - - id = syscall_get_nr(current, regs); - if (unlikely(in_compat_syscall())) { -- struct lttng_syscall_filter *filter; -- -- filter = lttng_rcu_dereference(chan->sc_filter); -- if (filter) { -- if (id < 0 || id >= NR_compat_syscalls -- || !test_bit(id, filter->sc_compat)) { -- /* System call filtered out. */ -- return; -- } -+ struct lttng_syscall_filter *filter = chan->sc_filter; -+ -+ if (id < 0 || id >= NR_compat_syscalls -+ || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_exit))) { -+ /* System call filtered out. */ -+ return; - } - table = compat_sc_exit_table; - table_len = ARRAY_SIZE(compat_sc_exit_table); - unknown_event = chan->compat_sc_exit_unknown; - } else { -- struct lttng_syscall_filter *filter; -- -- filter = lttng_rcu_dereference(chan->sc_filter); -- if (filter) { -- if (id < 0 || id >= NR_syscalls -- || !test_bit(id, filter->sc)) { -- /* System call filtered out. */ -- return; -- } -+ struct lttng_syscall_filter *filter = chan->sc_filter; -+ -+ if (id < 0 || id >= NR_syscalls -+ || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_exit))) { -+ /* System call filtered out. */ -+ return; - } - table = sc_exit_table; - table_len = ARRAY_SIZE(sc_exit_table); -@@ -713,27 +703,23 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len, - memset(&ev, 0, sizeof(ev)); - switch (type) { - case SC_TYPE_ENTRY: -- strncpy(ev.name, SYSCALL_ENTRY_STR, -- LTTNG_KERNEL_SYM_NAME_LEN); -+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY; -+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE; - break; - case SC_TYPE_EXIT: -- strncpy(ev.name, SYSCALL_EXIT_STR, -- LTTNG_KERNEL_SYM_NAME_LEN); -+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT; -+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE; - break; - case SC_TYPE_COMPAT_ENTRY: -- strncpy(ev.name, COMPAT_SYSCALL_ENTRY_STR, -- LTTNG_KERNEL_SYM_NAME_LEN); -+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY; -+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT; - break; - case SC_TYPE_COMPAT_EXIT: -- strncpy(ev.name, COMPAT_SYSCALL_EXIT_STR, -- LTTNG_KERNEL_SYM_NAME_LEN); -- break; -- default: -- BUG_ON(1); -+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT; -+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT; - break; - } -- strncat(ev.name, desc->name, -- LTTNG_KERNEL_SYM_NAME_LEN - strlen(ev.name) - 1); -+ strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN); - ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; - ev.instrumentation = LTTNG_KERNEL_SYSCALL; - chan_table[i] = _lttng_event_create(chan, &ev, filter, -@@ -803,6 +789,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter) - strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN); - ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; - ev.instrumentation = LTTNG_KERNEL_SYSCALL; -+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY; -+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE; - chan->sc_unknown = _lttng_event_create(chan, &ev, filter, - desc, - ev.instrumentation); -@@ -820,6 +808,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter) - strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN); - ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; - ev.instrumentation = LTTNG_KERNEL_SYSCALL; -+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY; -+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT; - chan->sc_compat_unknown = _lttng_event_create(chan, &ev, filter, - desc, - ev.instrumentation); -@@ -837,6 +827,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter) - strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN); - ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; - ev.instrumentation = LTTNG_KERNEL_SYSCALL; -+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT; -+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT; - chan->compat_sc_exit_unknown = _lttng_event_create(chan, &ev, - filter, desc, - ev.instrumentation); -@@ -854,6 +846,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter) - strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN); - ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; - ev.instrumentation = LTTNG_KERNEL_SYSCALL; -+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT; -+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE; - chan->sc_exit_unknown = _lttng_event_create(chan, &ev, filter, - desc, ev.instrumentation); - WARN_ON_ONCE(!chan->sc_exit_unknown); -@@ -883,6 +877,14 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter) - if (ret) - return ret; - #endif -+ -+ if (!chan->sc_filter) { -+ chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter), -+ GFP_KERNEL); -+ if (!chan->sc_filter) -+ return -ENOMEM; -+ } -+ - if (!chan->sys_enter_registered) { - ret = lttng_wrapper_tracepoint_probe_register("sys_enter", - (void *) syscall_entry_probe, chan); -@@ -930,7 +932,11 @@ int lttng_syscalls_unregister(struct lttng_channel *chan) - return ret; - chan->sys_exit_registered = 0; - } -- /* lttng_event destroy will be performed by lttng_session_destroy() */ -+ return 0; -+} -+ -+int lttng_syscalls_destroy(struct lttng_channel *chan) -+{ - kfree(chan->sc_table); - kfree(chan->sc_exit_table); - #ifdef CONFIG_COMPAT -@@ -993,136 +999,150 @@ uint32_t get_sc_tables_len(void) - return ARRAY_SIZE(sc_table) + ARRAY_SIZE(compat_sc_table); - } - --int lttng_syscall_filter_enable(struct lttng_channel *chan, -- const char *name) -+static -+const char *get_syscall_name(struct lttng_event *event) - { -- int syscall_nr, compat_syscall_nr, ret; -- struct lttng_syscall_filter *filter; -+ size_t prefix_len = 0; - -- WARN_ON_ONCE(!chan->sc_table); -+ WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL); - -- if (!name) { -- /* Enable all system calls by removing filter */ -- if (chan->sc_filter) { -- filter = chan->sc_filter; -- rcu_assign_pointer(chan->sc_filter, NULL); -- synchronize_trace(); -- kfree(filter); -+ switch (event->u.syscall.entryexit) { -+ case LTTNG_SYSCALL_ENTRY: -+ switch (event->u.syscall.abi) { -+ case LTTNG_SYSCALL_ABI_NATIVE: -+ prefix_len = strlen(SYSCALL_ENTRY_STR); -+ break; -+ case LTTNG_SYSCALL_ABI_COMPAT: -+ prefix_len = strlen(COMPAT_SYSCALL_ENTRY_STR); -+ break; - } -- chan->syscall_all = 1; -- return 0; -- } -- -- if (!chan->sc_filter) { -- if (chan->syscall_all) { -- /* -- * All syscalls are already enabled. -- */ -- return -EEXIST; -+ break; -+ case LTTNG_SYSCALL_EXIT: -+ switch (event->u.syscall.abi) { -+ case LTTNG_SYSCALL_ABI_NATIVE: -+ prefix_len = strlen(SYSCALL_EXIT_STR); -+ break; -+ case LTTNG_SYSCALL_ABI_COMPAT: -+ prefix_len = strlen(COMPAT_SYSCALL_EXIT_STR); -+ break; - } -- filter = kzalloc(sizeof(struct lttng_syscall_filter), -- GFP_KERNEL); -- if (!filter) -- return -ENOMEM; -- } else { -- filter = chan->sc_filter; -+ break; - } -- syscall_nr = get_syscall_nr(name); -- compat_syscall_nr = get_compat_syscall_nr(name); -- if (syscall_nr < 0 && compat_syscall_nr < 0) { -- ret = -ENOENT; -- goto error; -+ WARN_ON_ONCE(prefix_len == 0); -+ return event->desc->name + prefix_len; -+} -+ -+int lttng_syscall_filter_enable(struct lttng_channel *chan, -+ struct lttng_event *event) -+{ -+ struct lttng_syscall_filter *filter = chan->sc_filter; -+ const char *syscall_name; -+ unsigned long *bitmap; -+ int syscall_nr; -+ -+ WARN_ON_ONCE(!chan->sc_table); -+ -+ syscall_name = get_syscall_name(event); -+ -+ switch (event->u.syscall.abi) { -+ case LTTNG_SYSCALL_ABI_NATIVE: -+ syscall_nr = get_syscall_nr(syscall_name); -+ break; -+ case LTTNG_SYSCALL_ABI_COMPAT: -+ syscall_nr = get_compat_syscall_nr(syscall_name); -+ break; -+ default: -+ return -EINVAL; - } -- if (syscall_nr >= 0) { -- if (test_bit(syscall_nr, filter->sc)) { -- ret = -EEXIST; -- goto error; -+ if (syscall_nr < 0) -+ return -ENOENT; -+ -+ -+ switch (event->u.syscall.entryexit) { -+ case LTTNG_SYSCALL_ENTRY: -+ switch (event->u.syscall.abi) { -+ case LTTNG_SYSCALL_ABI_NATIVE: -+ bitmap = filter->sc_entry; -+ break; -+ case LTTNG_SYSCALL_ABI_COMPAT: -+ bitmap = filter->sc_compat_entry; -+ break; - } -- bitmap_set(filter->sc, syscall_nr, 1); -- } -- if (compat_syscall_nr >= 0) { -- if (test_bit(compat_syscall_nr, filter->sc_compat)) { -- ret = -EEXIST; -- goto error; -+ break; -+ case LTTNG_SYSCALL_EXIT: -+ switch (event->u.syscall.abi) { -+ case LTTNG_SYSCALL_ABI_NATIVE: -+ bitmap = filter->sc_exit; -+ break; -+ case LTTNG_SYSCALL_ABI_COMPAT: -+ bitmap = filter->sc_compat_exit; -+ break; - } -- bitmap_set(filter->sc_compat, compat_syscall_nr, 1); -+ break; -+ default: -+ return -EINVAL; - } -- if (!chan->sc_filter) -- rcu_assign_pointer(chan->sc_filter, filter); -+ if (test_bit(syscall_nr, bitmap)) -+ return -EEXIST; -+ bitmap_set(bitmap, syscall_nr, 1); - return 0; -- --error: -- if (!chan->sc_filter) -- kfree(filter); -- return ret; - } - - int lttng_syscall_filter_disable(struct lttng_channel *chan, -- const char *name) -+ struct lttng_event *event) - { -- int syscall_nr, compat_syscall_nr, ret; -- struct lttng_syscall_filter *filter; -+ struct lttng_syscall_filter *filter = chan->sc_filter; -+ const char *syscall_name; -+ unsigned long *bitmap; -+ int syscall_nr; - - WARN_ON_ONCE(!chan->sc_table); - -- if (!chan->sc_filter) { -- if (!chan->syscall_all) -- return -EEXIST; -- filter = kzalloc(sizeof(struct lttng_syscall_filter), -- GFP_KERNEL); -- if (!filter) -- return -ENOMEM; -- /* Trace all system calls, then apply disable. */ -- bitmap_set(filter->sc, 0, NR_syscalls); -- bitmap_set(filter->sc_compat, 0, NR_compat_syscalls); -- } else { -- filter = chan->sc_filter; -+ syscall_name = get_syscall_name(event); -+ -+ switch (event->u.syscall.abi) { -+ case LTTNG_SYSCALL_ABI_NATIVE: -+ syscall_nr = get_syscall_nr(syscall_name); -+ break; -+ case LTTNG_SYSCALL_ABI_COMPAT: -+ syscall_nr = get_compat_syscall_nr(syscall_name); -+ break; -+ default: -+ return -EINVAL; - } -+ if (syscall_nr < 0) -+ return -ENOENT; - -- if (!name) { -- /* Fail if all syscalls are already disabled. */ -- if (bitmap_empty(filter->sc, NR_syscalls) -- && bitmap_empty(filter->sc_compat, -- NR_compat_syscalls)) { -- ret = -EEXIST; -- goto error; -- } - -- /* Disable all system calls */ -- bitmap_clear(filter->sc, 0, NR_syscalls); -- bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls); -- goto apply_filter; -- } -- syscall_nr = get_syscall_nr(name); -- compat_syscall_nr = get_compat_syscall_nr(name); -- if (syscall_nr < 0 && compat_syscall_nr < 0) { -- ret = -ENOENT; -- goto error; -- } -- if (syscall_nr >= 0) { -- if (!test_bit(syscall_nr, filter->sc)) { -- ret = -EEXIST; -- goto error; -+ switch (event->u.syscall.entryexit) { -+ case LTTNG_SYSCALL_ENTRY: -+ switch (event->u.syscall.abi) { -+ case LTTNG_SYSCALL_ABI_NATIVE: -+ bitmap = filter->sc_entry; -+ break; -+ case LTTNG_SYSCALL_ABI_COMPAT: -+ bitmap = filter->sc_compat_entry; -+ break; - } -- bitmap_clear(filter->sc, syscall_nr, 1); -- } -- if (compat_syscall_nr >= 0) { -- if (!test_bit(compat_syscall_nr, filter->sc_compat)) { -- ret = -EEXIST; -- goto error; -+ break; -+ case LTTNG_SYSCALL_EXIT: -+ switch (event->u.syscall.abi) { -+ case LTTNG_SYSCALL_ABI_NATIVE: -+ bitmap = filter->sc_exit; -+ break; -+ case LTTNG_SYSCALL_ABI_COMPAT: -+ bitmap = filter->sc_compat_exit; -+ break; - } -- bitmap_clear(filter->sc_compat, compat_syscall_nr, 1); -+ break; -+ default: -+ return -EINVAL; - } --apply_filter: -- if (!chan->sc_filter) -- rcu_assign_pointer(chan->sc_filter, filter); -- chan->syscall_all = 0; -- return 0; -+ if (!test_bit(syscall_nr, bitmap)) -+ return -EEXIST; -+ bitmap_clear(bitmap, syscall_nr, 1); - --error: -- if (!chan->sc_filter) -- kfree(filter); -- return ret; -+ return 0; - } - - static -@@ -1236,6 +1256,9 @@ const struct file_operations lttng_syscall_list_fops = { - .release = seq_release, - }; - -+/* -+ * A syscall is enabled if it is traced for either entry or exit. -+ */ - long lttng_channel_syscall_mask(struct lttng_channel *channel, - struct lttng_kernel_syscall_mask __user *usyscall_mask) - { -@@ -1262,8 +1285,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel, - char state; - - if (channel->sc_table) { -- if (filter) -- state = test_bit(bit, filter->sc); -+ if (!READ_ONCE(channel->syscall_all) && filter) -+ state = test_bit(bit, filter->sc_entry) -+ || test_bit(bit, filter->sc_exit); - else - state = 1; - } else { -@@ -1275,9 +1299,11 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel, - char state; - - if (channel->compat_sc_table) { -- if (filter) -+ if (!READ_ONCE(channel->syscall_all) && filter) - state = test_bit(bit - ARRAY_SIZE(sc_table), -- filter->sc_compat); -+ filter->sc_compat_entry) -+ || test_bit(bit - ARRAY_SIZE(sc_table), -+ filter->sc_compat_exit); - else - state = 1; - } else { --- -2.19.1 - diff --git a/meta/recipes-kernel/lttng/lttng-modules/BUILD_RUNTIME_BUG_ON-vs-gcc7.patch b/meta/recipes-kernel/lttng/lttng-modules/BUILD_RUNTIME_BUG_ON-vs-gcc7.patch deleted file mode 100644 index 76063607a8..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/BUILD_RUNTIME_BUG_ON-vs-gcc7.patch +++ /dev/null @@ -1,43 +0,0 @@ -From ab07574ef90fa510f293c37897d577066a88fe0d Mon Sep 17 00:00:00 2001 -From: Nathan Lynch <nathan_lynch@mentor.com> -Date: Tue, 25 Apr 2017 16:26:57 -0500 -Subject: [PATCH] BUILD_RUNTIME_BUG_ON vs gcc7 - -Avoid using LTTng's BUILD_RUNTIME_BUG_ON macro, as it appears to run -into a similar problem as Linux experienced with ilog2. - -See: -https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=474c90156c8dcc2fa815e6716cc9394d7930cb9c -https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785 - -Upstream-Status: Pending -Signed-off-by: Nathan Lynch <nathan_lynch@mentor.com> ---- - lib/align.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/lib/align.h b/lib/align.h -index 5b91ae87410b..5e134cd485fe 100644 ---- a/lib/align.h -+++ b/lib/align.h -@@ -48,7 +48,7 @@ - */ - #define offset_align(align_drift, alignment) \ - ({ \ -- BUILD_RUNTIME_BUG_ON((alignment) == 0 \ -+ BUG_ON((alignment) == 0 \ - || ((alignment) & ((alignment) - 1))); \ - (((alignment) - (align_drift)) & ((alignment) - 1)); \ - }) -@@ -63,7 +63,7 @@ - */ - #define offset_align_floor(align_drift, alignment) \ - ({ \ -- BUILD_RUNTIME_BUG_ON((alignment) == 0 \ -+ BUG_ON((alignment) == 0 \ - || ((alignment) & ((alignment) - 1))); \ - (((align_drift) - (alignment)) & ((alignment) - 1)); \ - }) --- -2.9.3 - diff --git a/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch b/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch deleted file mode 100644 index e411242272..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 1b0e574d680101105a6c1e8931c78824f5a97a42 Mon Sep 17 00:00:00 2001 -From: Otavio Salvador <otavio@ossystems.com.br> -Date: Mon, 5 Sep 2016 17:08:56 +0000 -Subject: [PATCH] Makefile: Do not fail if CONFIG_TRACEPOINTS is not enabled -Organization: O.S. Systems Software LTDA. - -The lttng-modules are being pulled by the tools-profile image feature, -however, not every kernel has the CONFIG_TRACEPOINTS feature enabled. - -This change makes the build do not fail when CONFIG_TRACEPOINTS is not -available, allowing it to be kept being pulled by default. - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> ---- - Makefile | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/Makefile b/Makefile -index 8602649..75550cc 100644 ---- a/Makefile -+++ b/Makefile -@@ -8,10 +8,7 @@ ifneq ($(KERNELRELEASE),) - # and defines the modules to be built. - - ifdef CONFIG_LOCALVERSION # Check if dot-config is included. -- ifeq ($(CONFIG_TRACEPOINTS),) -- $(error The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration) -- endif # CONFIG_TRACEPOINTS -- endif # ifdef CONFIG_LOCALVERSION -+ ifneq ($(CONFIG_TRACEPOINTS),) - - TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST))) - -@@ -94,6 +91,10 @@ ifneq ($(KERNELRELEASE),) - obj-$(CONFIG_LTTNG) += lib/ - obj-$(CONFIG_LTTNG) += tests/ - -+ else -+ $(warning The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration) -+ endif # CONFIG_TRACEPOINTS -+ endif # ifdef CONFIG_LOCALVERSION - else # KERNELRELEASE - - # This part of the Makefile is used when the 'make' command is runned in the --- -2.1.4 - diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb deleted file mode 100644 index e36b327a08..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb +++ /dev/null @@ -1,52 +0,0 @@ -SECTION = "devel" -SUMMARY = "Linux Trace Toolkit KERNEL MODULE" -DESCRIPTION = "The lttng-modules 2.0 package contains the kernel tracer modules" -LICENSE = "LGPLv2.1 & GPLv2 & MIT" -LIC_FILES_CHKSUM = "file://LICENSE;md5=3f882d431dc0f32f1f44c0707aa41128" - -inherit module - -include lttng-platforms.inc - -SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \ - file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \ - file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \ - file://0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch \ - file://0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch \ - file://0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch \ - file://0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch \ - file://0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch \ - file://0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch \ - file://0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch \ - file://0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch \ - file://0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch \ - file://0010-Fix-system-call-filter-table.patch \ - " - -SRC_URI[sha256sum] = "df50bc3bd58679705714f17721acf619a8b0cedc694f8a97052aa5099626feca" - -export INSTALL_MOD_DIR="kernel/lttng-modules" - -EXTRA_OEMAKE += "KERNELDIR='${STAGING_KERNEL_DIR}'" - -do_install_append() { - # Delete empty directories to avoid QA failures if no modules were built - find ${D}/${nonarch_base_libdir} -depth -type d -empty -exec rmdir {} \; -} - -python do_package_prepend() { - if not os.path.exists(os.path.join(d.getVar('D'), d.getVar('nonarch_base_libdir')[1:], 'modules')): - bb.warn("%s: no modules were created; this may be due to CONFIG_TRACEPOINTS not being enabled in your kernel." % d.getVar('PN')) -} - -BBCLASSEXTEND = "devupstream:target" -LIC_FILES_CHKSUM_class-devupstream = "file://LICENSE;md5=3f882d431dc0f32f1f44c0707aa41128" -DEFAULT_PREFERENCE_class-devupstream = "-1" -SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.12 \ - file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \ - file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \ - " -SRCREV_class-devupstream = "ad594e3a953db1b0c3c059fde45b5a5494f6be78" -PV_class-devupstream = "2.12.2+git${SRCPV}" -S_class-devupstream = "${WORKDIR}/git" -SRCREV_FORMAT ?= "lttng_git" diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.13.12.bb b/meta/recipes-kernel/lttng/lttng-modules_2.13.12.bb new file mode 100644 index 0000000000..95d5e2d615 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules_2.13.12.bb @@ -0,0 +1,45 @@ +SECTION = "devel" +SUMMARY = "Linux Trace Toolkit KERNEL MODULE" +DESCRIPTION = "The lttng-modules 2.0 package contains the kernel tracer modules" +HOMEPAGE = "https://lttng.org/" +LICENSE = "LGPL-2.1-only & GPL-2.0-only & MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=0464cff101a009c403cd2ed65d01d4c4" + +inherit module + +include lttng-platforms.inc + +SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \ + file://0001-Fix-ASoC-snd_doc_dapm-on-linux-6.9-rc1.patch \ + file://0002-Fix-ASoC-add-component-to-set_bias_level-events-in-l.patch \ + file://0003-Fix-mm_compaction_migratepages-changed-in-linux-6.9-.patch \ + file://0004-Fix-dev_base_lock-removed-in-linux-6.9-rc1.patch \ + " + +# Use :append here so that the patch is applied also when using devupstream +SRC_URI:append = " file://0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch" + +SRC_URI[sha256sum] = "d85fcb66c7bd31003ab8735e8c77700e5e4f417b4c22fe1f20112cf435abad79" + +export INSTALL_MOD_DIR="kernel/lttng-modules" + +EXTRA_OEMAKE += "KERNELDIR='${STAGING_KERNEL_DIR}'" + +MODULES_MODULE_SYMVERS_LOCATION = "src" + +do_install:append() { + # Delete empty directories to avoid QA failures if no modules were built + if [ -d ${D}/${nonarch_base_libdir} ]; then + find ${D}/${nonarch_base_libdir} -depth -type d -empty -exec rmdir {} \; + fi +} + +python do_package:prepend() { + if not os.path.exists(os.path.join(d.getVar('D'), d.getVar('nonarch_base_libdir')[1:], 'modules')): + bb.warn("%s: no modules were created; this may be due to CONFIG_TRACEPOINTS not being enabled in your kernel." % d.getVar('PN')) +} + +BBCLASSEXTEND = "devupstream:target" +SRC_URI:class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.13;protocol=https" +SRCREV:class-devupstream = "7584cfc04914cb0842a986e9808686858b9c8630" +SRCREV_FORMAT ?= "lttng_git" diff --git a/meta/recipes-kernel/lttng/lttng-platforms.inc b/meta/recipes-kernel/lttng/lttng-platforms.inc index aa8220bbb4..900e36df82 100644 --- a/meta/recipes-kernel/lttng/lttng-platforms.inc +++ b/meta/recipes-kernel/lttng/lttng-platforms.inc @@ -2,16 +2,20 @@ # Whether the platform supports kernel tracing # LTTNGMODULES = "lttng-modules" -LTTNGMODULES_arc = "" -LTTNGMODULES_riscv64 = "" +LTTNGMODULES:arc = "" +LTTNGMODULES:riscv64 = "" -COMPATIBLE_HOST_riscv64_pn-lttng-modules = "null" -COMPATIBLE_HOST_arc_pn-lttng-modules = "null" +COMPATIBLE_HOST:riscv64:pn-lttng-modules = "null" +COMPATIBLE_HOST:arc:pn-lttng-modules = "null" # Whether the platform supports userspace tracing # lttng-ust uses sched_getcpu() which is not there on for some platforms. LTTNGUST = "lttng-ust" -LTTNGUST_arc = "" +LTTNGUST:arc = "" -COMPATIBLE_HOST_arc_pn-lttng-ust = "null" +COMPATIBLE_HOST:arc:pn-lttng-ust = "null" +# Whether the platform supports lttng-tools +# lttng-tools requires SYS_ppoll and SYS_pselect6 which are not supported on riscv32. +# It's also turned off for riscv32 in meta-riscv. See https://github.com/riscv/meta-riscv/blob/master/conf/layer.conf +COMPATIBLE_HOST:riscv32:pn-lttng-tools = "null" diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-rotation-destroy-flush-fix-session-daemon-abort-.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-rotation-destroy-flush-fix-session-daemon-abort-.patch new file mode 100644 index 0000000000..3286dfb5c1 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-rotation-destroy-flush-fix-session-daemon-abort-.patch @@ -0,0 +1,56 @@ +From 6b45c5f80d20e7bbf3d98c1fa17d2cf8716af3bb Mon Sep 17 00:00:00 2001 +From: Xiangyu Chen <xiangyu.chen@windriver.com> +Date: Mon, 25 Mar 2024 18:20:14 +0800 +Subject: [PATCH] Fix: rotation-destroy-flush: fix session daemon abort if no + kernel module present + +Testing rotation-destroy-flush when no lttng kernel modules present, it would +be failed with error message: + + Error: Unable to load required module lttng-ring-buffer-client-discard + not ok 1 - Start session daemon + Failed test 'Start session daemon' + not ok 2 - Create session rotation_destroy_flush in -o /tmp/tmp.test_rot ... + ... + +This because test script that sets the LTTNG_ABORT_ON_ERROR environment +variable. It's this environment variable that causes the sessiond to handle the +kernel module loading failure as an abort rather than a warning. + +Using "check_skip_kernel_test" to detect whether the kernel module fails to +load is expected or not. If the failure is expected, the script won't set that +environment variable any more. + +Fixes: 3a174400 +("tests:add check_skip_kernel_test to check root user and lttng kernel modules") + +Upstream-Status: Submitted [https://review.lttng.org/c/lttng-tools/+/12155] + +Change-Id: I371e9ba717613e2940186f710cf3cccd35baed6c +Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com> +--- + .../ust/rotation-destroy-flush/test_rotation_destroy_flush | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush b/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush +index 669bcbc43..64161768f 100755 +--- a/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush ++++ b/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush +@@ -23,11 +23,11 @@ SIZE_LIMIT=$PAGE_SIZE + NR_ITER=10 + NUM_TESTS=$((15*$NR_ITER)) + +-# Ensure the daemons invoke abort on error. +-export LTTNG_ABORT_ON_ERROR=1 +- + source $TESTDIR/utils/utils.sh + ++# Ensure the daemons invoke abort on error. ++check_skip_kernel_test || export LTTNG_ABORT_ON_ERROR=1 ++ + # MUST set TESTDIR before calling those functions + function run_app() + { +-- +2.25.1 + diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch new file mode 100644 index 0000000000..4e21d1e9f1 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch @@ -0,0 +1,74 @@ +From 74b3844737b03492756b4f896c938b504b069f14 Mon Sep 17 00:00:00 2001 +From: Jérémie Galarneau <jeremie.galarneau@efficios.com> +Date: Tue, 17 Jan 2023 16:57:35 -0500 +Subject: [PATCH] compat: off64_t is not defined by musl + +This helps compile with latest musl, where off64_t is not defined unless +_LARGEFILE64_SOURCE is defined. On glibc, _LARGEFILE64_SOURCE is defined +if _GNU_SOURCE is defined, so the problem is only seen with musl. + +Since the project uses AC_SYS_LARGEFILE, which from the autoconf doc: +"arrange for 64-bit file offsets, known as large-file support." + +As such, it is safe to assume off_t is 64-bit wide. This is checked by a +static_assert to catch any platform where autoconf would let a 32-bit +off_t slip. + +Upstream-Status: Submitted [https://review.lttng.org/c/lttng-tools/+/9268] +Reported-by: Khem Raj <raj.khem@gmail.com> +Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> +Change-Id: If2c6007a8c85bc3f3065002af8a7538b882fb4a8 +--- + +--- a/src/common/compat/compat-fcntl.c ++++ b/src/common/compat/compat-fcntl.c +@@ -8,14 +8,17 @@ + #define _LGPL_SOURCE + #include <common/compat/fcntl.h> + #include <common/macros.h> ++#include <common/bug.h> ++#include <stdint.h> + #include <unistd.h> + + #ifdef __linux__ + + LTTNG_HIDDEN +-int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes, ++int compat_sync_file_range(int fd, off_t offset, off_t nbytes, + unsigned int flags) + { ++ LTTNG_BUILD_BUG_ON(sizeof(off_t) != sizeof(int64_t)); + #ifdef HAVE_SYNC_FILE_RANGE + return sync_file_range(fd, offset, nbytes, flags); + #else +--- a/src/common/compat/fcntl.h ++++ b/src/common/compat/fcntl.h +@@ -13,16 +13,12 @@ + + #include <common/compat/errno.h> + +-#if (defined(__CYGWIN__)) +-typedef long long off64_t; +-#endif +- + #if (defined(__FreeBSD__) || defined(__sun__)) + typedef off64_t loff_t; + #endif + + #ifdef __linux__ +-extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes, ++extern int compat_sync_file_range(int fd, off_t offset, off_t nbytes, + unsigned int flags); + #define lttng_sync_file_range(fd, offset, nbytes, flags) \ + compat_sync_file_range(fd, offset, nbytes, flags) +@@ -37,8 +33,8 @@ extern int compat_sync_file_range(int fd + #define SYNC_FILE_RANGE_WAIT_BEFORE 0 + #define SYNC_FILE_RANGE_WRITE 0 + +-static inline int lttng_sync_file_range(int fd, off64_t offset, +- off64_t nbytes, unsigned int flags) ++static inline int lttng_sync_file_range(int fd, off_t offset, ++ off_t nbytes, unsigned int flags) + { + return -ENOSYS; + } diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-tests-add-check_skip_kernel_test-to-check-root-user-.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-tests-add-check_skip_kernel_test-to-check-root-user-.patch new file mode 100644 index 0000000000..2671a1908e --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-tools/0001-tests-add-check_skip_kernel_test-to-check-root-user-.patch @@ -0,0 +1,1246 @@ +From cf558f802b259a33605fe0ede4d74ae2ff6be699 Mon Sep 17 00:00:00 2001 +From: Xiangyu Chen <xiangyu.chen@windriver.com> +Date: Mon, 12 Feb 2024 09:23:54 -0500 +Subject: [PATCH] tests: add check_skip_kernel_test to check root user and + lttng kernel modules +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The current tests will run both userspace and kernel testing. Some of +use cases only use lttng for one kind of tracing on an embedded +device (e.g. userspace), so in this scenario, the kernel modules might +not install to target rootfs, the test cases would be fail and exit. + +Add LTTNG_TOOLS_DISABLE_KERNEL_TESTS to skip the lttng kernel features +test, this flag can be set via "make": + + make check LTTNG_TOOLS_DISABLE_KERNEL_TESTS=1 + +When this flag was set, all kernel related testcases would be marked as +SKIP in result. + +Since the the LTTNG_TOOLS_DISABLE_KERNEL_TESTS was checked in function +check_skip_kernel_test, lots of testcases also need to check root +permission, so merging the root permission checking into +check_skip_kernel_test. + +Upstream-Status: Backport from +[https://git.lttng.org/?p=lttng-tools.git;a=commit;h=3a1744008331a0604479d3d7461f77056fad3a64] + +Change-Id: I49a1f642a9869c21a69e0186c296fd917bd7b525 +Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com> +Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> +--- + tests/destructive/metadata-regeneration | 8 +---- + tests/perf/test_perf_raw.in | 8 +---- + tests/regression/kernel/test_all_events | 8 +---- + tests/regression/kernel/test_callstack | 8 +---- + tests/regression/kernel/test_channel | 8 +---- + tests/regression/kernel/test_clock_override | 8 +---- + tests/regression/kernel/test_event_basic | 8 +---- + tests/regression/kernel/test_kernel_function | 8 +---- + tests/regression/kernel/test_lttng_logger | 8 +---- + tests/regression/kernel/test_ns_contexts | 8 +---- + .../regression/kernel/test_ns_contexts_change | 9 +---- + .../kernel/test_rotation_destroy_flush | 8 +---- + .../regression/kernel/test_select_poll_epoll | 8 +---- + tests/regression/kernel/test_syscall | 8 +---- + tests/regression/kernel/test_userspace_probe | 8 +---- + tests/regression/tools/clear/test_kernel | 8 +---- + .../tools/filtering/test_invalid_filter | 8 +---- + .../tools/filtering/test_unsupported_op | 8 +---- + .../tools/filtering/test_valid_filter | 8 +---- + tests/regression/tools/health/test_health.sh | 10 ++---- + tests/regression/tools/health/test_thread_ok | 9 +---- + tests/regression/tools/live/test_kernel | 10 +++--- + tests/regression/tools/live/test_lttng_kernel | 8 +---- + tests/regression/tools/metadata/test_kernel | 8 +---- + .../test_notification_kernel_buffer_usage | 36 +++++++++---------- + .../test_notification_kernel_capture | 23 ++++++------ + .../test_notification_kernel_error | 23 ++++++------ + .../test_notification_kernel_instrumentation | 23 ++++++------ + .../test_notification_kernel_syscall | 19 +++++----- + .../test_notification_kernel_userspace_probe | 20 +++++------ + .../notification/test_notification_multi_app | 14 +++----- + ...test_notification_notifier_discarded_count | 9 +++-- + .../tools/regen-metadata/test_kernel | 8 +---- + .../tools/regen-statedump/test_kernel | 8 +---- + tests/regression/tools/rotation/test_kernel | 8 +---- + tests/regression/tools/snapshots/test_kernel | 8 +---- + .../tools/snapshots/test_kernel_streaming | 8 +---- + .../streaming/test_high_throughput_limits | 8 +---- + tests/regression/tools/streaming/test_kernel | 8 +---- + .../tools/tracker/test_event_tracker | 8 +---- + .../tools/trigger/test_add_trigger_cli | 12 ++----- + .../tools/trigger/test_list_triggers_cli | 26 +++++--------- + .../tools/wildcard/test_event_wildcard | 8 +---- + .../test_relayd_working_directory | 4 +-- + .../ust/namespaces/test_ns_contexts_change | 7 +--- + tests/regression/ust/test_event_perf | 8 +---- + tests/utils/utils.sh | 35 ++++++++++++++++++ + 47 files changed, 166 insertions(+), 363 deletions(-) + +diff --git a/tests/destructive/metadata-regeneration b/tests/destructive/metadata-regeneration +index b81e7af32..36b130d17 100755 +--- a/tests/destructive/metadata-regeneration ++++ b/tests/destructive/metadata-regeneration +@@ -185,19 +185,13 @@ function test_ust_streaming () + rm -f ${file_sync_before_last} + } + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- + if ! destructive_tests_enabled ; then + echo 'You need to set the LTTNG_ENABLE_DESTRUCTIVE_TESTS to "will-break-my-system" as argument to run this test' + echo 'Moreover, please make sure that ntp is not running while executing this test' + exit 0 + fi + +-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || ++check_skip_kernel_test $NUM_TESTS "Skipping all tests." || + { + start_lttng_relayd "-o $TRACE_PATH" + start_lttng_sessiond +diff --git a/tests/perf/test_perf_raw.in b/tests/perf/test_perf_raw.in +index f293ccd71..d35529a87 100644 +--- a/tests/perf/test_perf_raw.in ++++ b/tests/perf/test_perf_raw.in +@@ -137,12 +137,6 @@ function test_kernel_raw() + rm -rf $TRACE_PATH + } + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- + # MUST set TESTDIR before calling those functions + plan_tests $NUM_TESTS + +@@ -154,7 +148,7 @@ have_libpfm + + test_ust_raw + +-skip $isroot "Root access is needed for kernel testing, skipping." 9 || ++check_skip_kernel_test 9 || + { + modprobe lttng-test + test_kernel_raw +diff --git a/tests/regression/kernel/test_all_events b/tests/regression/kernel/test_all_events +index 2e20888df..044f9b65f 100755 +--- a/tests/regression/kernel/test_all_events ++++ b/tests/regression/kernel/test_all_events +@@ -43,13 +43,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + validate_lttng_modules_present + start_lttng_sessiond +diff --git a/tests/regression/kernel/test_callstack b/tests/regression/kernel/test_callstack +index a4477fd7c..d8d6b5e0f 100755 +--- a/tests/regression/kernel/test_callstack ++++ b/tests/regression/kernel/test_callstack +@@ -134,13 +134,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + validate_lttng_modules_present + start_lttng_sessiond +diff --git a/tests/regression/kernel/test_channel b/tests/regression/kernel/test_channel +index 9cc74c4e8..4c377bd2a 100755 +--- a/tests/regression/kernel/test_channel ++++ b/tests/regression/kernel/test_channel +@@ -47,13 +47,7 @@ function test_channel_buffer_too_large() + plan_tests $NUM_TESTS + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + start_lttng_sessiond + +diff --git a/tests/regression/kernel/test_clock_override b/tests/regression/kernel/test_clock_override +index 72892898b..48a3f926a 100755 +--- a/tests/regression/kernel/test_clock_override ++++ b/tests/regression/kernel/test_clock_override +@@ -172,13 +172,7 @@ TESTS=( + TEST_COUNT=${#TESTS[@]} + i=0 + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + validate_lttng_modules_present + trap signal_cleanup SIGTERM SIGINT +diff --git a/tests/regression/kernel/test_event_basic b/tests/regression/kernel/test_event_basic +index ac9ec0549..387e2f733 100755 +--- a/tests/regression/kernel/test_event_basic ++++ b/tests/regression/kernel/test_event_basic +@@ -73,13 +73,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || ++check_skip_kernel_test $NUM_TESTS "Skipping all tests." || + { + validate_lttng_modules_present + start_lttng_sessiond +diff --git a/tests/regression/kernel/test_kernel_function b/tests/regression/kernel/test_kernel_function +index b1d5491fc..ea16cdeef 100755 +--- a/tests/regression/kernel/test_kernel_function ++++ b/tests/regression/kernel/test_kernel_function +@@ -43,13 +43,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + start_lttng_sessiond_notap + validate_lttng_modules_present +diff --git a/tests/regression/kernel/test_lttng_logger b/tests/regression/kernel/test_lttng_logger +index b8f7ded82..00eaae823 100755 +--- a/tests/regression/kernel/test_lttng_logger ++++ b/tests/regression/kernel/test_lttng_logger +@@ -110,13 +110,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + validate_lttng_modules_present + start_lttng_sessiond +diff --git a/tests/regression/kernel/test_ns_contexts b/tests/regression/kernel/test_ns_contexts +index 0c8718d78..59e2568f6 100755 +--- a/tests/regression/kernel/test_ns_contexts ++++ b/tests/regression/kernel/test_ns_contexts +@@ -108,13 +108,7 @@ plan_tests $NUM_TESTS + print_test_banner "$TEST_DESC" + + +-isroot=0 +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0 +- ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." && exit 0 + + system_has_ns=0 + if [ -d "/proc/$$/ns" ]; then +diff --git a/tests/regression/kernel/test_ns_contexts_change b/tests/regression/kernel/test_ns_contexts_change +index 42a61276b..3f5e4eeab 100755 +--- a/tests/regression/kernel/test_ns_contexts_change ++++ b/tests/regression/kernel/test_ns_contexts_change +@@ -162,14 +162,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +- +-isroot=0 +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0 +- ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." && exit 0 + + system_has_ns=0 + if [ -d "/proc/$$/ns" ]; then +diff --git a/tests/regression/kernel/test_rotation_destroy_flush b/tests/regression/kernel/test_rotation_destroy_flush +index cb773d7df..0af514b49 100755 +--- a/tests/regression/kernel/test_rotation_destroy_flush ++++ b/tests/regression/kernel/test_rotation_destroy_flush +@@ -120,13 +120,7 @@ TESTS=( + TEST_COUNT=${#TESTS[@]} + i=0 + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + validate_lttng_modules_present + trap signal_cleanup SIGTERM SIGINT +diff --git a/tests/regression/kernel/test_select_poll_epoll b/tests/regression/kernel/test_select_poll_epoll +index d8245a0e7..20f0ef0ae 100755 +--- a/tests/regression/kernel/test_select_poll_epoll ++++ b/tests/regression/kernel/test_select_poll_epoll +@@ -374,13 +374,7 @@ if test $? != 0; then + exit 0 + fi + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + validate_lttng_modules_present + +diff --git a/tests/regression/kernel/test_syscall b/tests/regression/kernel/test_syscall +index 401a18a8d..219d94703 100755 +--- a/tests/regression/kernel/test_syscall ++++ b/tests/regression/kernel/test_syscall +@@ -664,13 +664,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + validate_lttng_modules_present + start_lttng_sessiond +diff --git a/tests/regression/kernel/test_userspace_probe b/tests/regression/kernel/test_userspace_probe +index 1091ee65e..5d984d666 100755 +--- a/tests/regression/kernel/test_userspace_probe ++++ b/tests/regression/kernel/test_userspace_probe +@@ -815,13 +815,7 @@ fi + plan_tests $NUM_TESTS + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + validate_lttng_modules_present + start_lttng_sessiond +diff --git a/tests/regression/tools/clear/test_kernel b/tests/regression/tools/clear/test_kernel +index 06fb1c368..48250a742 100755 +--- a/tests/regression/tools/clear/test_kernel ++++ b/tests/regression/tools/clear/test_kernel +@@ -536,12 +536,6 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- + streaming_tests=(test_kernel_streaming + test_kernel_streaming_rotate_clear + test_kernel_streaming_clear_rotate +@@ -563,7 +557,7 @@ snapshot_tests=(test_kernel_streaming_snapshot + test_kernel_local_snapshot + ) + +-skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping kernel streaming tests." || + { + trap signal_cleanup SIGTERM SIGINT + +diff --git a/tests/regression/tools/filtering/test_invalid_filter b/tests/regression/tools/filtering/test_invalid_filter +index 7d9e524d9..8435e5546 100755 +--- a/tests/regression/tools/filtering/test_invalid_filter ++++ b/tests/regression/tools/filtering/test_invalid_filter +@@ -168,13 +168,7 @@ done + + test_bytecode_limit -u + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all kernel invalid filter tests." $NUM_KERNEL_TESTS || ++check_skip_kernel_test "$NUM_KERNEL_TESTS" "Skipping kernel invalid filter tests." || + { + diag "Test kernel filters" + i=0 +diff --git a/tests/regression/tools/filtering/test_unsupported_op b/tests/regression/tools/filtering/test_unsupported_op +index 299247a3c..91eb86d21 100755 +--- a/tests/regression/tools/filtering/test_unsupported_op ++++ b/tests/regression/tools/filtering/test_unsupported_op +@@ -103,13 +103,7 @@ while [ "$i" -lt "$OP_COUNT" ]; do + let "i++" + done + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all kernel unsupported filter operations tests." $NUM_KERNEL_TESTS || ++check_skip_kernel_test $NUM_KERNEL_TESTS "Skipping kernel unsupported filter operations tests." || + { + diag "Test kernel unsupported filter operations" + +diff --git a/tests/regression/tools/filtering/test_valid_filter b/tests/regression/tools/filtering/test_valid_filter +index e76ffa25f..1ba7c79bb 100755 +--- a/tests/regression/tools/filtering/test_valid_filter ++++ b/tests/regression/tools/filtering/test_valid_filter +@@ -1452,13 +1452,7 @@ KERNEL_FILTERS=( + + IFS=$OLDIFS + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all kernel valid filter tests." $NUM_KERNEL_TESTS || ++check_skip_kernel_test "$NUM_KERNEL_TESTS" "Skipping kernel valid filter tests." || + { + diag "Test kernel valid filters" + +diff --git a/tests/regression/tools/health/test_health.sh b/tests/regression/tools/health/test_health.sh +index b3d6419d2..68716e6b9 100644 +--- a/tests/regression/tools/health/test_health.sh ++++ b/tests/regression/tools/health/test_health.sh +@@ -82,7 +82,7 @@ function test_health + diag "With UST consumer daemons" + enable_ust_lttng_event_ok $SESSION_NAME $UST_EVENT_NAME $CHANNEL_NAME + +- skip $isroot "Root access is needed. Skipping kernel consumer health check test." "1" || ++ check_skip_kernel_test "1" "Skipping kernel consumer health check test." || + { + diag "With kernel consumer daemon" + lttng_enable_kernel_event $SESSION_NAME $KERNEL_EVENT_NAME $CHANNEL_NAME +@@ -113,7 +113,7 @@ function test_health + + + if [ ${test_needs_root} -eq 1 ]; then +- skip ${isroot} "Root access needed for test \"${test_thread_name}\"." "1" || ++ check_skip_kernel_test "1" "Skipping \"${test_thread_name}\"." || + { + report_errors "${test_thread_error_string}" "${test_relayd}" + } +@@ -276,12 +276,6 @@ STDERR_PATH=$(mktemp --tmpdir tmp.test_health_stderr_path.XXXXXX) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_health_trace_path.XXXXXX) + HEALTH_PATH=$(mktemp --tmpdir -d tmp.test_health_trace_path.XXXXXX) + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- + THREAD_COUNT=${#THREAD[@]} + i=0 + while [ "$i" -lt "$THREAD_COUNT" ]; do +diff --git a/tests/regression/tools/health/test_thread_ok b/tests/regression/tools/health/test_thread_ok +index e84adb611..e5e23543f 100755 +--- a/tests/regression/tools/health/test_thread_ok ++++ b/tests/regression/tools/health/test_thread_ok +@@ -67,7 +67,7 @@ function test_thread_ok + $CURDIR/$HEALTH_CHECK_BIN > ${STDOUT_PATH} 2> ${STDERR_PATH} + report_errors + +- skip $isroot "Root access is needed. Skipping kernel consumer health check test." "5" || ++ check_skip_kernel_test "5" "Skipping kernel consumer health check test." || + { + diag "With kernel consumer daemon" + create_lttng_session_no_output $SESSION_NAME +@@ -115,13 +115,6 @@ STDERR_PATH=$(mktemp --tmpdir tmp.test_thread_ok_stderr_path.XXXXXX) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_thread_ok_trace_path.XXXXXX) + HEALTH_PATH=$(mktemp --tmpdir -d tmp.test_thread_ok_trace_path.XXXXXX) + +-# The manage kernel thread is only spawned if we are root +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- + test_thread_ok + + rm -rf ${HEALTH_PATH} +diff --git a/tests/regression/tools/live/test_kernel b/tests/regression/tools/live/test_kernel +index b622b5214..fdaa09f0d 100755 +--- a/tests/regression/tools/live/test_kernel ++++ b/tests/regression/tools/live/test_kernel +@@ -39,13 +39,11 @@ function clean_live_tracing() + rm -rf $TRACE_PATH + } + +-# Need root access for kernel tracing. +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- plan_skip_all "Root access is needed. Skipping all tests." ++check_skip_kernel_test && ++{ ++ plan_skip_all "Skipping all tests." + exit 0 +-fi ++} + + modprobe lttng-test + +diff --git a/tests/regression/tools/live/test_lttng_kernel b/tests/regression/tools/live/test_lttng_kernel +index a23d9373a..1b933648f 100755 +--- a/tests/regression/tools/live/test_lttng_kernel ++++ b/tests/regression/tools/live/test_lttng_kernel +@@ -45,13 +45,7 @@ function clean_live_tracing() + } + + # Need root access for kernel tracing. +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + modprobe lttng-test + +diff --git a/tests/regression/tools/metadata/test_kernel b/tests/regression/tools/metadata/test_kernel +index 57cace6ea..26e95d93a 100755 +--- a/tests/regression/tools/metadata/test_kernel ++++ b/tests/regression/tools/metadata/test_kernel +@@ -91,13 +91,7 @@ plan_tests $NUM_TESTS + print_test_banner "$TEST_DESC" + + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all kernel metadata tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping kernel metadata tests." || + { + validate_lttng_modules_present + modprobe lttng-test +diff --git a/tests/regression/tools/notification/test_notification_kernel_buffer_usage b/tests/regression/tools/notification/test_notification_kernel_buffer_usage +index 76e69a77e..8fdaabb3e 100755 +--- a/tests/regression/tools/notification/test_notification_kernel_buffer_usage ++++ b/tests/regression/tools/notification/test_notification_kernel_buffer_usage +@@ -60,29 +60,27 @@ function test_buffer_usage_notification + wait $APP_PID 2> /dev/null + } + +-if [ "$(id -u)" == "0" ]; then +- +- validate_lttng_modules_present +- ++check_skip_kernel_test && ++{ ++ plan_skip_all "Skipping all tests." ++ rm -rf "$TEST_TMPDIR" ++ exit 0 ++} + +- modprobe lttng-test ++validate_lttng_modules_present + +- # Used on sessiond launch. +- LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 \ +- CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} \ +- LD_PRELOAD=${TESTPOINT}" +- start_lttng_sessiond_notap ++modprobe lttng-test + +- test_buffer_usage_notification ++# Used on sessiond launch. ++LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 \ ++ CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} \ ++ LD_PRELOAD=${TESTPOINT}" ++start_lttng_sessiond_notap + +- stop_lttng_sessiond_notap +- rmmod lttng-test ++test_buffer_usage_notification + +- rm -rf "${consumerd_pipe[@]}" 2> /dev/null +-else +- # Kernel tests are skipped. +- plan_tests $NUM_TESTS +- skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS +-fi ++stop_lttng_sessiond_notap ++rmmod lttng-test + ++rm -rf "${consumerd_pipe[@]}" 2> /dev/null + rm -rf "$TEST_TMPDIR" +diff --git a/tests/regression/tools/notification/test_notification_kernel_capture b/tests/regression/tools/notification/test_notification_kernel_capture +index 88f123d3d..0f8a2bc6f 100755 +--- a/tests/regression/tools/notification/test_notification_kernel_capture ++++ b/tests/regression/tools/notification/test_notification_kernel_capture +@@ -31,22 +31,21 @@ function test_basic_error_path + } + + +-if [ "$(id -u)" == "0" ]; then +- validate_lttng_modules_present ++check_skip_kernel_test && ++{ ++ plan_skip_all "Skipping all tests." ++ exit 0 ++} + +- modprobe lttng-test ++validate_lttng_modules_present + +- start_lttng_sessiond_notap ++modprobe lttng-test + +- test_basic_error_path ++start_lttng_sessiond_notap + +- stop_lttng_sessiond_notap +- rmmod lttng-test ++test_basic_error_path + +-else +- # Kernel tests are skipped. +- plan_tests $NUM_TESTS +- skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS +-fi ++stop_lttng_sessiond_notap ++rmmod lttng-test + + rm -f "$TESTAPP_STATE_PATH" +diff --git a/tests/regression/tools/notification/test_notification_kernel_error b/tests/regression/tools/notification/test_notification_kernel_error +index 80fe6e5b5..b757ec2b4 100755 +--- a/tests/regression/tools/notification/test_notification_kernel_error ++++ b/tests/regression/tools/notification/test_notification_kernel_error +@@ -30,23 +30,22 @@ function test_basic_error_path + wait $APP_PID 2> /dev/null + } + ++check_skip_kernel_test && ++{ ++ plan_skip_all "Skipping all tests." ++ exit 0 ++} + +-if [ "$(id -u)" == "0" ]; then +- validate_lttng_modules_present ++validate_lttng_modules_present + +- modprobe lttng-test ++modprobe lttng-test + +- start_lttng_sessiond_notap ++start_lttng_sessiond_notap + +- test_basic_error_path ++test_basic_error_path + +- stop_lttng_sessiond_notap +- rmmod lttng-test ++stop_lttng_sessiond_notap ++rmmod lttng-test + +-else +- # Kernel tests are skipped. +- plan_tests $NUM_TESTS +- skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS +-fi + + rm -f "$TESTAPP_STATE_PATH" +diff --git a/tests/regression/tools/notification/test_notification_kernel_instrumentation b/tests/regression/tools/notification/test_notification_kernel_instrumentation +index 90545a541..705f7703d 100755 +--- a/tests/regression/tools/notification/test_notification_kernel_instrumentation ++++ b/tests/regression/tools/notification/test_notification_kernel_instrumentation +@@ -28,22 +28,21 @@ function test_kernel_instrumentation_notification + wait $APP_PID 2> /dev/null + } + +-if [ "$(id -u)" == "0" ]; then +- validate_lttng_modules_present ++check_skip_kernel_test && ++{ ++ plan_skip_all "Skipping all tests." ++ exit 0 ++} + +- modprobe lttng-test ++validate_lttng_modules_present + +- start_lttng_sessiond_notap ++modprobe lttng-test + +- test_kernel_instrumentation_notification ++start_lttng_sessiond_notap + +- stop_lttng_sessiond_notap +- rmmod lttng-test ++test_kernel_instrumentation_notification + +-else +- # Kernel tests are skipped. +- plan_tests $NUM_TESTS +- skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS +-fi ++stop_lttng_sessiond_notap ++rmmod lttng-test + + rm -f "$TESTAPP_STATE_PATH" +diff --git a/tests/regression/tools/notification/test_notification_kernel_syscall b/tests/regression/tools/notification/test_notification_kernel_syscall +index d273cb55d..7fa235388 100755 +--- a/tests/regression/tools/notification/test_notification_kernel_syscall ++++ b/tests/regression/tools/notification/test_notification_kernel_syscall +@@ -31,19 +31,18 @@ function test_kernel_syscall_notification + wait $APP_PID 2> /dev/null + } + +-if [ "$(id -u)" == "0" ]; then +- validate_lttng_modules_present ++check_skip_kernel_test && ++{ ++ plan_skip_all "Skipping all tests." ++ exit 0 ++} + +- start_lttng_sessiond_notap ++validate_lttng_modules_present + +- test_kernel_syscall_notification ++start_lttng_sessiond_notap + +- stop_lttng_sessiond_notap ++test_kernel_syscall_notification + +-else +- # Kernel tests are skipped. +- plan_tests $NUM_TESTS +- skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS +-fi ++stop_lttng_sessiond_notap + + rm -f "$TESTAPP_STATE_PATH" +diff --git a/tests/regression/tools/notification/test_notification_kernel_userspace_probe b/tests/regression/tools/notification/test_notification_kernel_userspace_probe +index 8ef8d708d..abddd9be7 100755 +--- a/tests/regression/tools/notification/test_notification_kernel_userspace_probe ++++ b/tests/regression/tools/notification/test_notification_kernel_userspace_probe +@@ -29,18 +29,18 @@ function test_kernel_userspace_probe_notification + wait $APP_PID 2> /dev/null + } + +-if [ "$(id -u)" == "0" ]; then +- validate_lttng_modules_present ++check_skip_kernel_test && ++{ ++ plan_skip_all "Skipping all tests." ++ exit 0 ++} ++ ++validate_lttng_modules_present + +- start_lttng_sessiond_notap ++start_lttng_sessiond_notap + +- test_kernel_userspace_probe_notification ++test_kernel_userspace_probe_notification + +- stop_lttng_sessiond_notap +-else +- # Kernel tests are skipped. +- plan_tests $NUM_TESTS +- skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS +-fi ++stop_lttng_sessiond_notap + + rm -f "$TESTAPP_STATE_PATH" +diff --git a/tests/regression/tools/notification/test_notification_multi_app b/tests/regression/tools/notification/test_notification_multi_app +index d8b639225..61891b56f 100755 +--- a/tests/regression/tools/notification/test_notification_multi_app ++++ b/tests/regression/tools/notification/test_notification_multi_app +@@ -411,22 +411,18 @@ function test_on_register_evaluation () + rm -rf "$output_dir" + } + +- + TESTS=( + test_multi_app_ust + test_on_register_evaluation_ust + ) + +-if [ "$(id -u)" == "0" ]; then ++check_skip_kernel_test "$NUM_TEST_KERNEL" "Skipping kernel multi-app notification tests." || { + validate_lttng_modules_present + TESTS+=( +- test_multi_app_kernel +- test_on_register_evaluation_kernel +-) +-else +- skip 0 "Root access is needed. Skipping all kernel multi-app notification tests." $NUM_TEST_KERNEL +-fi +- ++ test_multi_app_kernel ++ test_on_register_evaluation_kernel ++ ) ++} + + for fct_test in ${TESTS[@]}; + do +diff --git a/tests/regression/tools/notification/test_notification_notifier_discarded_count b/tests/regression/tools/notification/test_notification_notifier_discarded_count +index c9235393e..a6c31a728 100755 +--- a/tests/regression/tools/notification/test_notification_notifier_discarded_count ++++ b/tests/regression/tools/notification/test_notification_notifier_discarded_count +@@ -391,7 +391,8 @@ function test_ust_notifier_discarded_regardless_trigger_owner + test_ust_notifier_discarded_count + test_ust_notifier_discarded_count_max_bucket + +-if [ "$(id -u)" == "0" ]; then ++check_skip_kernel_test "$KERNEL_NUM_TESTS" "Skipping kernel notification tests." || ++{ + + validate_lttng_modules_present + +@@ -413,9 +414,7 @@ if [ "$(id -u)" == "0" ]; then + modprobe --remove lttng-test + + rm -rf "${sessiond_pipe[@]}" 2> /dev/null +-else +- # Kernel tests are skipped. +- skip 0 "Root access is needed. Skipping all kernel notification tests." $KERNEL_NUM_TESTS +-fi ++ ++} + + rm -rf "$TEST_TMPDIR" +diff --git a/tests/regression/tools/regen-metadata/test_kernel b/tests/regression/tools/regen-metadata/test_kernel +index 49eea32a7..555a4e2ce 100755 +--- a/tests/regression/tools/regen-metadata/test_kernel ++++ b/tests/regression/tools/regen-metadata/test_kernel +@@ -99,13 +99,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + validate_lttng_modules_present + +diff --git a/tests/regression/tools/regen-statedump/test_kernel b/tests/regression/tools/regen-statedump/test_kernel +index 8a261355d..bbbac3942 100755 +--- a/tests/regression/tools/regen-statedump/test_kernel ++++ b/tests/regression/tools/regen-statedump/test_kernel +@@ -39,13 +39,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + validate_lttng_modules_present + start_lttng_sessiond +diff --git a/tests/regression/tools/rotation/test_kernel b/tests/regression/tools/rotation/test_kernel +index f5f1f5553..efe3fd359 100755 +--- a/tests/regression/tools/rotation/test_kernel ++++ b/tests/regression/tools/rotation/test_kernel +@@ -82,13 +82,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + validate_lttng_modules_present + +diff --git a/tests/regression/tools/snapshots/test_kernel b/tests/regression/tools/snapshots/test_kernel +index abb243563..d91876867 100755 +--- a/tests/regression/tools/snapshots/test_kernel ++++ b/tests/regression/tools/snapshots/test_kernel +@@ -217,13 +217,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all kernel snapshot tests" $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + + validate_lttng_modules_present +diff --git a/tests/regression/tools/snapshots/test_kernel_streaming b/tests/regression/tools/snapshots/test_kernel_streaming +index 0c92dc710..dd965afee 100755 +--- a/tests/regression/tools/snapshots/test_kernel_streaming ++++ b/tests/regression/tools/snapshots/test_kernel_streaming +@@ -145,13 +145,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all kernel streaming tests" $NUM_TESTS || ++check_skip_kernel_test $NUM_TESTS "Skipping all tests." || + { + validate_lttng_modules_present + +diff --git a/tests/regression/tools/streaming/test_high_throughput_limits b/tests/regression/tools/streaming/test_high_throughput_limits +index 2b9e3ad39..c55d51098 100755 +--- a/tests/regression/tools/streaming/test_high_throughput_limits ++++ b/tests/regression/tools/streaming/test_high_throughput_limits +@@ -170,13 +170,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed to set bandwith limits. Skipping all tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + + # Catch sigint and try to cleanup limits +diff --git a/tests/regression/tools/streaming/test_kernel b/tests/regression/tools/streaming/test_kernel +index 33334229f..113eea7bf 100755 +--- a/tests/regression/tools/streaming/test_kernel ++++ b/tests/regression/tools/streaming/test_kernel +@@ -47,13 +47,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." || + { + validate_lttng_modules_present + +diff --git a/tests/regression/tools/tracker/test_event_tracker b/tests/regression/tools/tracker/test_event_tracker +index cc0f698d2..de0c79d36 100755 +--- a/tests/regression/tools/tracker/test_event_tracker ++++ b/tests/regression/tools/tracker/test_event_tracker +@@ -466,13 +466,7 @@ test_event_track_untrack ust 0 "${EVENT_NAME}" "--pid --all" # backward compat + test_event_tracker ust 1 "${EVENT_NAME}" "--pid --all" # backward compat + test_event_pid_tracker ust 1 "${EVENT_NAME}" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all kernel tracker tests." $NUM_KERNEL_TESTS || ++check_skip_kernel_test "$NUM_KERNEL_TESTS" "Skipping kernel tracker tests." || + { + diag "Test kernel tracker" + +diff --git a/tests/regression/tools/trigger/test_add_trigger_cli b/tests/regression/tools/trigger/test_add_trigger_cli +index 98ecf6272..d1763aa2e 100755 +--- a/tests/regression/tools/trigger/test_add_trigger_cli ++++ b/tests/regression/tools/trigger/test_add_trigger_cli +@@ -34,12 +34,6 @@ tmp_stdout=$(mktemp --tmpdir -t test_parse_cli_trigger_stdout.XXXXXX) + tmp_stderr=$(mktemp --tmpdir -t test_parse_cli_trigger_stderr.XXXXXX) + uprobe_elf_binary="${TESTDIR}/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary" + +-if [ "$(id -u)" == "0" ]; then +- ist_root=1 +-else +- ist_root=0 +-fi +- + function test_success () + { + local test_name="$1" +@@ -223,7 +217,7 @@ test_success "--exclude-name two" "trigger5" \ + --condition event-rule-matches --type=user --name='jean-*' --exclude-name jean-chretien -x jean-charest \ + --action notify + +-skip $ist_root "non-root user: skipping kprobe tests" 18 || { ++check_skip_kernel_test 18 "Skipping kprobe tests." || { + i=0 + + for type in kprobe kernel:kprobe; do +@@ -262,7 +256,7 @@ skip $ist_root "non-root user: skipping kprobe tests" 18 || { + done + } + +-skip $ist_root "non-root user: skipping uprobe tests" 6 || { ++check_skip_kernel_test 6 "Skipping uprobe tests." || { + test_success "--condition event-rule-matches uprobe" "uprobe-trigger-0" \ + --name="uprobe-trigger-0" \ + --condition event-rule-matches --type=kernel:uprobe --location=${uprobe_elf_binary}:test_function --event-name=ma-probe \ +@@ -274,7 +268,7 @@ skip $ist_root "non-root user: skipping uprobe tests" 6 || { + --action notify + } + +-skip $ist_root "non-root user: skipping syscall tests" 30 || { ++check_skip_kernel_test 30 "Skipping syscall tests." || { + test_success "--condition event-rule-matches one syscall" "syscall-trigger-0" \ + --name="syscall-trigger-0" \ + --condition event-rule-matches --type=syscall --name=open \ +diff --git a/tests/regression/tools/trigger/test_list_triggers_cli b/tests/regression/tools/trigger/test_list_triggers_cli +index a04018013..02c3de3e9 100755 +--- a/tests/regression/tools/trigger/test_list_triggers_cli ++++ b/tests/regression/tools/trigger/test_list_triggers_cli +@@ -36,22 +36,12 @@ uprobe_sdt_binary=$(realpath "${TESTDIR}/utils/testapp/userspace-probe-sdt-binar + register_some_triggers_bin=$(realpath "${CURDIR}/utils/register-some-triggers") + + uid=$(id --user) +-gid=$(id --group) + +-if [ "$uid" == "0" ]; then +- ist_root=1 +- ls "$uprobe_sdt_binary" >/dev/null 2>&1 +- if test $? == 0; then +- hast_sdt_binary=1 +- else +- hast_sdt_binary=0 +- fi +-else +- ist_root=0 +- hast_sdt_binary=0 ++sdt_binary_present=0 ++if [ -f "$uprobe_sdt_binary" ]; then ++ sdt_binary_present=1 + fi + +- + test_top_level_options () + { + diag "Listing top level options" +@@ -2695,10 +2685,12 @@ start_lttng_sessiond_notap + + test_top_level_options + test_event_rule_matches_tracepoint +-skip $ist_root "non-root user: skipping kprobe tests" 13 || test_event_rule_matches_probe +-skip $ist_root "non-root user: skipping uprobe tests" 9 || test_event_rule_matches_userspace_probe_elf +-skip $(($ist_root && $hast_sdt_binary)) "skipping userspace probe SDT tests" 9 || test_event_rule_matches_userspace_probe_sdt +-skip $ist_root "non-root user: skipping syscall tests" 17 || test_event_rule_matches_syscall ++check_skip_kernel_test 48 "Skipping kprobe, uprobe, SDT and syscall tests." || { ++ test_event_rule_matches_probe ++ test_event_rule_matches_userspace_probe_elf ++ skip $sdt_binary_present "No SDT binary. Skipping userspace probe SDT tests" 9 || test_event_rule_matches_userspace_probe_sdt ++ test_event_rule_matches_syscall ++} + test_session_consumed_size_condition + test_buffer_usage_conditions + test_session_rotation_conditions +diff --git a/tests/regression/tools/wildcard/test_event_wildcard b/tests/regression/tools/wildcard/test_event_wildcard +index f69baffc4..14d9bb88a 100755 +--- a/tests/regression/tools/wildcard/test_event_wildcard ++++ b/tests/regression/tools/wildcard/test_event_wildcard +@@ -124,13 +124,7 @@ test_event_wildcard ust 1 'tp*tptest' + test_event_wildcard ust 1 'tp**tptest' + test_event_wildcard ust 1 'tp*test' + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- +-skip $isroot "Root access is needed. Skipping all kernel wildcard tests." $NUM_KERNEL_TESTS || ++check_skip_kernel_test "$NUM_KERNEL_TESTS" "Skipping kernel wildcard tests." || + { + diag "Test kernel wildcards" + +diff --git a/tests/regression/tools/working-directory/test_relayd_working_directory b/tests/regression/tools/working-directory/test_relayd_working_directory +index c7e784cca..6bd1e504a 100755 +--- a/tests/regression/tools/working-directory/test_relayd_working_directory ++++ b/tests/regression/tools/working-directory/test_relayd_working_directory +@@ -145,9 +145,9 @@ function test_relayd_debug_permission() + diag "Test lttng-relayd change working directory on non writable directory" + + if [ "$(id -u)" == "0" ]; then +- is_user=0 ++ is_user=0 + else +- is_user=1 ++ is_user=1 + fi + + skip $is_user "Skipping permission debug output test; operation can't fail as root" 6 || +diff --git a/tests/regression/ust/namespaces/test_ns_contexts_change b/tests/regression/ust/namespaces/test_ns_contexts_change +index 8a4b62ce3..622241f7b 100755 +--- a/tests/regression/ust/namespaces/test_ns_contexts_change ++++ b/tests/regression/ust/namespaces/test_ns_contexts_change +@@ -101,12 +101,7 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-isroot=0 +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-fi +- +-skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0 ++check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." && exit 0 + + system_has_ns=0 + if [ -d "/proc/$$/ns" ]; then +diff --git a/tests/regression/ust/test_event_perf b/tests/regression/ust/test_event_perf +index 33aab2981..178959a19 100755 +--- a/tests/regression/ust/test_event_perf ++++ b/tests/regression/ust/test_event_perf +@@ -119,17 +119,11 @@ plan_tests $NUM_TESTS + + print_test_banner "$TEST_DESC" + +-if [ "$(id -u)" == "0" ]; then +- isroot=1 +-else +- isroot=0 +-fi +- + start_lttng_sessiond + + test_parsing_raw + +-skip $isroot "Root access is needed. Skipping UST perf tests." 8 || ++check_skip_kernel_test 8 "Skipping UST perf tests." || + { + test_event_basic + } +diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh +index faa87e783..da0e0569d 100644 +--- a/tests/utils/utils.sh ++++ b/tests/utils/utils.sh +@@ -318,6 +318,41 @@ function conf_proc_count() + echo + } + ++# Usage: ++# check_skip_kernel_test [NB_TESTS] [SKIP_MESSAGE] ++# Return 0 if LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set or the current user is not a root user ++# If NB_TESTS is set, call skip() to skip number of tests. ++# If NB_TESTS is empty, just output a reason with diag. ++# An optional message can be added. ++ ++function check_skip_kernel_test () ++{ ++ local num_tests="$1" ++ local skip_message="$2" ++ ++ # Check for skip test kernel flag ++ if [ "$LTTNG_TOOLS_DISABLE_KERNEL_TESTS" == "1" ]; then ++ if ! test -z "$num_tests"; then ++ skip 0 "LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set.${skip_message+ }${skip_message}" "$num_tests" ++ else ++ diag "LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set.${skip_message+ }${skip_message}" ++ fi ++ return 0 ++ fi ++ ++ # Check if we are running as root ++ if [ "$(id -u)" != "0" ]; then ++ if ! test -z "$num_tests"; then ++ skip 0 "Root access is needed for kernel testing.${skip_message+ }${skip_message}" "$num_tests" ++ else ++ diag "Root access is needed for kernel testing.${skip_message+ }${skip_message}" ++ fi ++ return 0 ++ fi ++ ++ return 1 ++} ++ + # Check if base lttng-modules are present. + # Bail out on failure + function validate_lttng_modules_present () +-- +2.25.1 + diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-tests-do-not-strip-a-helper-library.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-tests-do-not-strip-a-helper-library.patch index 2d08b08879..2f95889c4b 100644 --- a/meta/recipes-kernel/lttng/lttng-tools/0001-tests-do-not-strip-a-helper-library.patch +++ b/meta/recipes-kernel/lttng/lttng-tools/0001-tests-do-not-strip-a-helper-library.patch @@ -1,4 +1,4 @@ -From ab238c213fac190972f55e73cf3e0bb1c7846eb8 Mon Sep 17 00:00:00 2001 +From 2237748af00467ad8250a7ccd944200f811db69a Mon Sep 17 00:00:00 2001 From: Alexander Kanavin <alex.kanavin@gmail.com> Date: Thu, 12 Dec 2019 16:52:07 +0100 Subject: [PATCH] tests: do not strip a helper library @@ -10,10 +10,10 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am b/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am -index 03f5d5a..d12c343 100644 +index 836f13e..e19a554 100644 --- a/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am +++ b/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am -@@ -12,7 +12,7 @@ userspace_probe_elf_binary_LDADD = libfoo.la +@@ -14,7 +14,7 @@ userspace_probe_elf_binary_LDADD = libfoo.la libfoo.strip: libfoo.la $(OBJCOPY) --strip-all .libs/libfoo.so @@ -22,6 +22,3 @@ index 03f5d5a..d12c343 100644 @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ for script in $(EXTRA_DIST); do \ cp -f $(srcdir)/$$script $(builddir); \ --- -2.17.1 - diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-tests-regression-disable-the-tools-live-tests.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-tests-regression-disable-the-tools-live-tests.patch deleted file mode 100644 index f2c14ecc94..0000000000 --- a/meta/recipes-kernel/lttng/lttng-tools/0001-tests-regression-disable-the-tools-live-tests.patch +++ /dev/null @@ -1,34 +0,0 @@ -From c69b68e5c03f1d260025fb1dd9ab7345e31e15ef Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin <alex.kanavin@gmail.com> -Date: Fri, 24 Jan 2020 18:03:25 +0100 -Subject: [PATCH] tests/regression: disable the tools/live tests - -They have been found to sporadically fail; the issue has been -reported upstream and they will work to investigate and fix: -https://bugs.lttng.org/issues/1217 - -Upstream-Status: Inappropriate [upstream is working on a real fix] -Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> ---- - tests/regression/Makefile.am | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/tests/regression/Makefile.am b/tests/regression/Makefile.am -index 73eb9f7..b92bdbd 100644 ---- a/tests/regression/Makefile.am -+++ b/tests/regression/Makefile.am -@@ -9,14 +9,10 @@ TESTS = tools/filtering/test_invalid_filter \ - tools/filtering/test_valid_filter \ - tools/streaming/test_ust \ - tools/health/test_thread_ok \ -- tools/live/test_ust \ -- tools/live/test_ust_tracefile_count \ -- tools/live/test_lttng_ust \ - tools/tracefile-limits/test_tracefile_count \ - tools/tracefile-limits/test_tracefile_size \ - tools/exclusion/test_exclusion \ - tools/snapshots/test_ust_fast \ -- tools/snapshots/test_ust_streaming \ - tools/save-load/test_save \ - tools/save-load/test_load \ - tools/save-load/test_autoload \ diff --git a/meta/recipes-kernel/lttng/lttng-tools/disable-tests.patch b/meta/recipes-kernel/lttng/lttng-tools/disable-tests.patch new file mode 100644 index 0000000000..3a77ea2e43 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-tools/disable-tests.patch @@ -0,0 +1,34 @@ +Upstream-Status: Inappropriate [need to root cause the test hangs] + +We keep seeing hangs in the tools/notifications tests on x86 and arm for +a variety of distros. Exclude them for now to work out if this is the +only place we see them and give SWAT/triage a break from the stream +of them. + +https://bugzilla.yoctoproject.org/show_bug.cgi?id=14263 + +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> + +Index: lttng-tools-2.13.1/tests/regression/Makefile.am +=================================================================== +--- lttng-tools-2.13.1.orig/tests/regression/Makefile.am ++++ lttng-tools-2.13.1/tests/regression/Makefile.am +@@ -29,18 +29,6 @@ TESTS = tools/base-path/test_ust \ + tools/crash/test_crash \ + tools/regen-metadata/test_ust \ + tools/regen-statedump/test_ust \ +- tools/notification/test_notification_ust_error \ +- tools/notification/test_notification_ust_buffer_usage \ +- tools/notification/test_notification_ust_capture \ +- tools/notification/test_notification_ust_event_rule_condition_exclusion \ +- tools/notification/test_notification_kernel_error \ +- tools/notification/test_notification_kernel_buffer_usage \ +- tools/notification/test_notification_kernel_capture \ +- tools/notification/test_notification_kernel_instrumentation \ +- tools/notification/test_notification_kernel_syscall \ +- tools/notification/test_notification_notifier_discarded_count \ +- tools/notification/test_notification_kernel_userspace_probe \ +- tools/notification/test_notification_multi_app \ + tools/rotation/test_ust \ + tools/rotation/test_kernel \ + tools/rotation/test_save_load_mi \ diff --git a/meta/recipes-kernel/lttng/lttng-tools/run-ptest b/meta/recipes-kernel/lttng/lttng-tools/run-ptest index eaa2e7b29d..39d93e2bbf 100755 --- a/meta/recipes-kernel/lttng/lttng-tools/run-ptest +++ b/meta/recipes-kernel/lttng/lttng-tools/run-ptest @@ -1,6 +1,45 @@ #!/bin/sh # Without --ignore-exit, the tap harness causes any FAILs within a # test plan to raise ERRORs; this is just noise. -makeargs="LOG_DRIVER_FLAGS=--ignore-exit top_srcdir=$PWD top_builddir=$PWD" -make -k -t all >/dev/null 2>&1 -exec make -k -s $makeargs check 2>/dev/null | sed -e 's#/tmp/tmp\...........#/tmp/tmp.XXXXXXXXXX#g' + +#Detecting whether current system has lttng kernel modules +LTTNG_KMOD_PATH=/lib/modules/$(uname -r)/kernel/lttng-modules/lttng-tracer.ko +function validate_lttng_modules_present() +{ + # Check for loadable modules. + if [ -f "$LTTNG_KMOD_PATH" ]; then + return 0 + fi + + # Check for builtin modules. + ls /proc/lttng > /dev/null 2>&1 + if [ $? -eq 0 ]; then + return 0 + fi + + return 1 +} + +export LD_LIBRARY_PATH=FIXMEPTESTPATH/tests/utils/testapp/userspace-probe-elf-binary/.libs +makeargs="LOG_DRIVER_FLAGS=--ignore-exit top_srcdir=FIXMEPTESTPATH top_builddir=FIXMEPTESTPATH" + +#If current system doesn't have lttng kernel modules, disable lttng kernel related tests. +validate_lttng_modules_present || { + makeargs="$makeargs LTTNG_TOOLS_DISABLE_KERNEL_TESTS=1" +} + +make -k -t all >error.log 2>&1 +# Can specify a test e.g.: +# -C tests/regression/ check TESTS='kernel/test_callstack' +make -k -s $makeargs check 2>error.log | sed -e 's#/tmp/tmp\...........#/tmp/tmp.XXXXXXXXXX#g' +exitcode=$? +if [ -e error.log ]; then + cat error.log +fi +if [ -e tests/unit/test-suite.log ]; then + cat tests/unit/test-suite.log +fi +if [ -e tests/regression/test-suite.log ]; then + cat tests/regression/test-suite.log +fi +exit $exitcode diff --git a/meta/recipes-kernel/lttng/lttng-tools_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-tools_2.13.13.bb index 0787e04d19..e73dd4801a 100644 --- a/meta/recipes-kernel/lttng/lttng-tools_2.12.2.bb +++ b/meta/recipes-kernel/lttng/lttng-tools_2.13.13.bb @@ -3,28 +3,29 @@ SUMMARY = "Linux Trace Toolkit Control" DESCRIPTION = "The Linux trace toolkit is a suite of tools designed \ to extract program execution details from the Linux operating system \ and interpret them." +HOMEPAGE = "https://github.com/lttng/lttng-tools" -LICENSE = "GPLv2 & LGPLv2.1" +LICENSE = "GPL-2.0-only & LGPL-2.1-only" LIC_FILES_CHKSUM = "file://LICENSE;md5=40ef17463fbd6f377db3c47b1cbaded8 \ file://LICENSES/GPL-2.0;md5=e68f69a54b44ba526ad7cb963e18fbce \ file://LICENSES/LGPL-2.1;md5=9920968d0f2ff585ce61fae30344dd95" include lttng-platforms.inc -DEPENDS = "liburcu popt libxml2 util-linux" -RDEPENDS_${PN} = "libgcc" -RRECOMMENDS_${PN} += "${LTTNGMODULES}" -RDEPENDS_${PN}-ptest += "make perl bash gawk babeltrace procps perl-module-overloading coreutils util-linux kmod ${LTTNGMODULES} sed python3-core" -RDEPENDS_${PN}-ptest_append_libc-glibc = " glibc-utils" -RDEPENDS_${PN}-ptest_append_libc-musl = " musl-utils" +DEPENDS = "liburcu popt libxml2 util-linux bison-native" +RDEPENDS:${PN} = "libgcc" +RRECOMMENDS:${PN} += "${LTTNGMODULES}" +RDEPENDS:${PN}-ptest += "make perl bash gawk babeltrace procps perl-module-overloading coreutils util-linux kmod ${LTTNGMODULES} sed python3-core grep binutils" +RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils" +RDEPENDS:${PN}-ptest:append:libc-musl = " musl-utils" # babelstats.pl wants getopt-long -RDEPENDS_${PN}-ptest += "perl-module-getopt-long" +RDEPENDS:${PN}-ptest += "perl-module-getopt-long" PYTHON_OPTION = "am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \ am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \ PYTHON_INCLUDE='-I${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}' \ " -PACKAGECONFIG ??= "${LTTNGUST}" +PACKAGECONFIG ??= "${LTTNGUST} kmod" PACKAGECONFIG[python] = "--enable-python-bindings ${PYTHON_OPTION},,python3 swig-native" PACKAGECONFIG[lttng-ust] = "--with-lttng-ust, --without-lttng-ust, lttng-ust" PACKAGECONFIG[kmod] = "--with-kmod, --without-kmod, kmod" @@ -34,47 +35,59 @@ SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \ file://0001-tests-do-not-strip-a-helper-library.patch \ file://run-ptest \ file://lttng-sessiond.service \ - file://0001-tests-regression-disable-the-tools-live-tests.patch \ + file://disable-tests.patch \ + file://0001-compat-Define-off64_t-as-off_t-on-linux.patch \ + file://0001-tests-add-check_skip_kernel_test-to-check-root-user-.patch \ + file://0001-Fix-rotation-destroy-flush-fix-session-daemon-abort-.patch \ " -SRC_URI[sha256sum] = "9ed9161795ff023b076f9f95afaa4f1f822ec42495c0fa04c586ab8fa74e84f1" +SRC_URI[sha256sum] = "ff5f4f00b081dac66092afe8e72b7c790670931cf1c1ee0deaa7f80fbc53883e" inherit autotools ptest pkgconfig useradd python3-dir manpages systemd -SYSTEMD_SERVICE_${PN} = "lttng-sessiond.service" +CACHED_CONFIGUREVARS = "PGREP=/usr/bin/pgrep" + +SYSTEMD_SERVICE:${PN} = "lttng-sessiond.service" SYSTEMD_AUTO_ENABLE = "disable" USERADD_PACKAGES = "${PN}" -GROUPADD_PARAM_${PN} = "tracing" +GROUPADD_PARAM:${PN} = "tracing" -FILES_${PN} += "${libdir}/lttng/libexec/* ${datadir}/xml/lttng \ +FILES:${PN} += "${libdir}/lttng/libexec/* ${datadir}/xml/lttng \ ${PYTHON_SITEPACKAGES_DIR}/*" -FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" -FILES_${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la" +FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" +FILES:${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la" # Since files are installed into ${libdir}/lttng/libexec we match # the libexec insane test so skip it. # Python module needs to keep _lttng.so -INSANE_SKIP_${PN} = "libexec dev-so" -INSANE_SKIP_${PN}-dbg = "libexec" +INSANE_SKIP:${PN} = "libexec dev-so" +INSANE_SKIP:${PN}-dbg = "libexec" -PRIVATE_LIBS_${PN}-ptest = "libfoo.so" +PRIVATE_LIBS:${PN}-ptest = "libfoo.so" -do_install_append () { +do_install:append () { # install systemd unit file - install -d ${D}${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/lttng-sessiond.service ${D}${systemd_unitdir}/system + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${UNPACKDIR}/lttng-sessiond.service ${D}${systemd_system_unitdir} } do_install_ptest () { - for f in Makefile tests/Makefile tests/utils/utils.sh tests/regression/tools/save-load/load-42*.lttng tests/regression/tools/save-load/configuration/load-42*.lttng tests/regression/tools/health/test_health.sh tests/regression/tools/metadata/utils.sh tests/regression/tools/rotation/rotate_utils.sh; do + for f in Makefile tests/Makefile tests/utils/utils.sh tests/regression/tools/save-load/*.lttng \ + tests/regression/tools/save-load/configuration/load-42*.lttng tests/regression/tools/health/test_health.sh \ + tests/regression/tools/metadata/utils.sh tests/regression/tools/rotation/rotate_utils.sh \ + tests/regression/tools/notification/util_event_generator.sh \ + tests/regression/tools/base-path/*.lttng; do install -D "${B}/$f" "${D}${PTEST_PATH}/$f" done - for f in config/tap-driver.sh config/test-driver src/common/config/session.xsd src/common/mi-lttng-4.0.xsd; do + for f in tests/utils/tap-driver.sh config/test-driver src/common/config/session.xsd src/common/mi-lttng-4.1.xsd; do install -D "${S}/$f" "${D}${PTEST_PATH}/$f" done + # Patch in the correct path for the custom libraries a helper executable needs + sed -i -e 's!FIXMEPTESTPATH!${PTEST_PATH}!g' "${D}${PTEST_PATH}/run-ptest" + # Prevent 'make check' from recursing into non-test subdirectories. sed -i -e 's!^SUBDIRS = .*!SUBDIRS = tests!' "${D}${PTEST_PATH}/Makefile" @@ -102,7 +115,7 @@ do_install_ptest () { for f in $(find "${B}/tests/$d" -maxdepth 1 -executable -type f -printf '%P ') ; do cp ${B}/tests/$d/$f ${D}${PTEST_PATH}/tests/`dirname $d`/$f case $f in - *.so) + *.so|userspace-probe-elf-*) install -d ${D}${PTEST_PATH}/tests/$d/ ln -s ../$f ${D}${PTEST_PATH}/tests/$d/$f # Remove any rpath/runpath to pass QA check. @@ -113,6 +126,9 @@ do_install_ptest () { done chrpath --delete ${D}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary + chrpath --delete ${D}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/userspace-probe-elf-cxx-binary + chrpath --delete ${D}${PTEST_PATH}/tests/regression/ust/ust-dl/libbar.so + chrpath --delete ${D}${PTEST_PATH}/tests/regression/ust/ust-dl/libfoo.so # # Use the versioned libs of liblttng-ust-dl. @@ -150,6 +166,10 @@ do_install_ptest () { -e 's#\(^test.*LDADD.=\)#disable\1#g' \ -i ${D}${PTEST_PATH}/tests/unit/Makefile + # Fix hardcoded build path + sed -e 's#TESTAPP_PATH=.*/tests/regression/#TESTAPP_PATH="${PTEST_PATH}/tests/regression/#' \ + -i ${D}${PTEST_PATH}/tests/regression/ust/python-logging/test_python_logging + # Substitute links to installed binaries. for prog in lttng lttng-relayd lttng-sessiond lttng-consumerd lttng-crash; do exedir="${D}${PTEST_PATH}/src/bin/${prog}" @@ -164,3 +184,14 @@ do_install_ptest () { esac done } + +INHIBIT_PACKAGE_STRIP_FILES = "\ + ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary \ + ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary \ + ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/userspace-probe-elf-cxx-binary \ + ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/.libs/userspace-probe-elf-cxx-binary \ + ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events/gen-syscall-events \ + ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events/.libs/gen-syscall-events \ + ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack \ + ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events-callstack/.libs/gen-syscall-events-callstack \ + " diff --git a/meta/recipes-kernel/lttng/lttng-ust/0001-Makefile.am-update-rpath-link.patch b/meta/recipes-kernel/lttng/lttng-ust/0001-Makefile.am-update-rpath-link.patch new file mode 100644 index 0000000000..6aca8f85fa --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-ust/0001-Makefile.am-update-rpath-link.patch @@ -0,0 +1,33 @@ +From 7d053804ab3823d40ae10d90f4efc49dbfb4cb66 Mon Sep 17 00:00:00 2001 +From: Changqing Li <changqing.li@windriver.com> +Date: Wed, 22 Sep 2021 16:33:10 +0800 +Subject: [PATCH] Makefile.am: update rpath link + +since commit 6339062 Move liblttng-ust to 'src/lib/', +liblttng-ust.so/liblttng-ust-common.so/liblttng-ust-tracepoint.so +'s location changed from one dir to multiple dirs. which make below +error: +ld: warning: liblttng-ust-common.so.1, needed by ../../../src/lib/lttng-ust/.libs/liblttng-ust.so, not found (try using -rpath or -rpath-link) +ld: warning: liblttng-ust-tracepoint.so.1, needed by ../../../src/lib/lttng-ust/.libs/liblttng-ust.so, not found (try using -rpath or -rpath-link) + +Upstream-Status: Submitted [https://github.com/lttng/lttng-ust/pull/61] + +Signed-off-by: Changqing Li <changqing.li@windriver.com> + +--- + doc/examples/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am +index 57782cc..d46caa6 100644 +--- a/doc/examples/Makefile.am ++++ b/doc/examples/Makefile.am +@@ -167,7 +167,7 @@ all-local: + CFLAGS='$(CFLAGS)' \ + AM_CFLAGS='$(AM_CFLAGS)' \ + LDFLAGS="$(LDFLAGS)" \ +- AM_LDFLAGS='$(AM_LDFLAGS) -L../../../src/lib/lttng-ust/.libs -Wl,-rpath="$(PWD)/../../src/lib/lttng-ust/.libs/" -Wl,-rpath-link="$(PWD)/../../src/lib/lttng-ust/.libs/"' \ ++ AM_LDFLAGS='$(AM_LDFLAGS) -L../../../src/lib/lttng-ust/.libs -Wl,-rpath="$(PWD)/../../src/lib/lttng-ust/.libs/" -Wl,-rpath-link="$(PWD)/../../src/lib/lttng-ust/.libs/:$(PWD)/../../src/lib/lttng-ust-tracepoint/.libs:$(PWD)/../../src/lib/lttng-ust-common/.libs/"' \ + LTTNG_GEN_TP_PATH="$$rel_src_subdir$(top_srcdir)/tools/" \ + AM_V_P="$(AM_V_P)" \ + AM_V_at="$(AM_V_at)" \ diff --git a/meta/recipes-kernel/lttng/lttng-ust/0001-lttng-ust-common-link-with-liburcu-explicitly.patch b/meta/recipes-kernel/lttng/lttng-ust/0001-lttng-ust-common-link-with-liburcu-explicitly.patch new file mode 100644 index 0000000000..e85dbdb439 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-ust/0001-lttng-ust-common-link-with-liburcu-explicitly.patch @@ -0,0 +1,26 @@ +From 27402453f25fbdb5a9fb1a1b88d1c4d9852187d2 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <alex@linutronix.de> +Date: Sun, 5 Sep 2021 10:44:19 +0200 +Subject: [PATCH] lttng-ust-common: link with liburcu explicitly + +Otherwise linking errors are seen on x86-32. + +Upstream-Status: Submitted [by email to lttng-dev, Francis, Jonathan] +Signed-off-by: Alexander Kanavin <alex@linutronix.de> + +--- + src/lib/lttng-ust-common/Makefile.am | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/lib/lttng-ust-common/Makefile.am b/src/lib/lttng-ust-common/Makefile.am +index 1ccc290..6531fa0 100644 +--- a/src/lib/lttng-ust-common/Makefile.am ++++ b/src/lib/lttng-ust-common/Makefile.am +@@ -16,6 +16,7 @@ liblttng_ust_common_la_SOURCES = \ + + liblttng_ust_common_la_LIBADD = \ + $(top_builddir)/src/common/libcommon.la \ ++ $(URCU_LIBS) \ + $(DL_LIBS) + + liblttng_ust_common_la_LDFLAGS = -no-undefined -version-info $(LTTNG_UST_LIBRARY_VERSION) diff --git a/meta/recipes-kernel/lttng/lttng-ust/0001-python-lttngust-Makefile.am-Add-install-lib-to-setup.patch b/meta/recipes-kernel/lttng/lttng-ust/0001-python-lttngust-Makefile.am-Add-install-lib-to-setup.patch index c2028d0e1a..7c49583e0d 100644 --- a/meta/recipes-kernel/lttng/lttng-ust/0001-python-lttngust-Makefile.am-Add-install-lib-to-setup.patch +++ b/meta/recipes-kernel/lttng/lttng-ust/0001-python-lttngust-Makefile.am-Add-install-lib-to-setup.patch @@ -1,6 +1,6 @@ -From f79dac30af9adda12996da7f6aa6667d3b580537 Mon Sep 17 00:00:00 2001 -From: Robert Yang <liezhi.yang@windriver.com> -Date: Thu, 26 Sep 2019 17:54:00 +0800 +From f65efd963e52de51d35e2e03fb773f33dd64f565 Mon Sep 17 00:00:00 2001 +From: Richard Purdie <richard.purdie@linuxfoundation.org> +Date: Tue, 20 Feb 2024 12:19:06 +0000 Subject: [PATCH] python-lttngust/Makefile.am: Add --install-lib to setup.py Otherwise it may install to /usr/lib, but should be /usr/lib64 when cross @@ -9,23 +9,21 @@ building. Upstream-Status: Submitted [https://github.com/lttng/lttng-ust/pull/59] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> + --- - python-lttngust/Makefile.am | 2 +- + src/python-lttngust/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/python-lttngust/Makefile.am b/python-lttngust/Makefile.am -index 6c0d20d..38b51b8 100644 ---- a/python-lttngust/Makefile.am -+++ b/python-lttngust/Makefile.am -@@ -9,7 +9,7 @@ install-exec-local: +diff --git a/src/python-lttngust/Makefile.am b/src/python-lttngust/Makefile.am +index d53e21d..283901e 100644 +--- a/src/python-lttngust/Makefile.am ++++ b/src/python-lttngust/Makefile.am +@@ -45,7 +45,7 @@ install-exec-local: build-python-bindings.stamp if [ "$(DESTDIR)" != "" ]; then \ opts="$$opts --root=$(DESTDIR)"; \ fi; \ -- $(PYTHON) setup.py install $$opts; -+ $(PYTHON) setup.py install $$opts --install-lib=$(pythondir); +- $(PYTHON) $(builddir)/setup.py install $(PY_INSTALL_OPTS) $$opts; ++ $(PYTHON) $(builddir)/setup.py install $(PY_INSTALL_OPTS) $$opts --install-lib=$(pythondir); clean-local: rm -rf $(builddir)/build --- -2.7.4 - diff --git a/meta/recipes-kernel/lttng/lttng-ust_2.12.0.bb b/meta/recipes-kernel/lttng/lttng-ust_2.13.8.bb index 67a4307c7b..dddd3a5004 100644 --- a/meta/recipes-kernel/lttng/lttng-ust_2.12.0.bb +++ b/meta/recipes-kernel/lttng/lttng-ust_2.13.8.bb @@ -3,38 +3,38 @@ DESCRIPTION = "The LTTng UST 2.x package contains the userspace tracer library t HOMEPAGE = "http://lttng.org/ust" BUGTRACKER = "https://bugs.lttng.org/projects/lttng-ust" -LICENSE = "LGPLv2.1+ & MIT & GPLv2" -LIC_FILES_CHKSUM = "file://COPYING;md5=c963eb366b781252b0bf0fdf1624d9e9 \ - file://snprintf/snprintf.c;endline=32;md5=d3d544959d8a3782b2e07451be0a903c \ - file://snprintf/various.h;endline=31;md5=89f2509b6b4682c4fc95255eec4abe44" +LICENSE = "LGPL-2.1-or-later & MIT & GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSE;md5=a46577a38ad0c36ff6ff43ccf40c480f" PYTHON_OPTION = "am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \ am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \ PYTHON_INCLUDE='-I${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}' \ " -inherit autotools lib_package manpages python3native +inherit autotools lib_package manpages python3native pkgconfig include lttng-platforms.inc EXTRA_OECONF = "--disable-numa" +CPPFLAGS:append:arm = "${@oe.utils.vartrue('DEBUG_BUILD', '-DUATOMIC_NO_LINK_ERROR', '', d)}" DEPENDS = "liburcu util-linux" -RDEPENDS_${PN}-bin = "python3-core" +RDEPENDS:${PN}-bin = "python3-core" # For backwards compatibility after rename -RPROVIDES_${PN} = "lttng2-ust" -RREPLACES_${PN} = "lttng2-ust" -RCONFLICTS_${PN} = "lttng2-ust" +RPROVIDES:${PN} = "lttng2-ust" +RREPLACES:${PN} = "lttng2-ust" +RCONFLICTS:${PN} = "lttng2-ust" PE = "2" SRC_URI = "https://lttng.org/files/lttng-ust/lttng-ust-${PV}.tar.bz2 \ file://0001-python-lttngust-Makefile.am-Add-install-lib-to-setup.patch \ + file://0001-lttng-ust-common-link-with-liburcu-explicitly.patch \ + file://0001-Makefile.am-update-rpath-link.patch \ " -SRC_URI[md5sum] = "3bf4a04c305271d13cf6596c4e7b9b3c" -SRC_URI[sha256sum] = "1983edb525f3f27e3494088d8d5389b4c71af66bbfe63c6f1df2ad95aa44a528" +SRC_URI[sha256sum] = "d4ef98dab9a37ad4f524ccafdfd50af4f266039b528dd5afabce78e49024d937" CVE_PRODUCT = "ust" @@ -42,11 +42,11 @@ PACKAGECONFIG[examples] = "--enable-examples, --disable-examples," PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages, asciidoc-native xmlto-native libxslt-native" PACKAGECONFIG[python3-agent] = "--enable-python-agent ${PYTHON_OPTION}, --disable-python-agent, python3, python3" -FILES_${PN} += " ${PYTHON_SITEPACKAGES_DIR}/*" -FILES_${PN}-staticdev += " ${PYTHON_SITEPACKAGES_DIR}/*.a" -FILES_${PN}-dev += " ${PYTHON_SITEPACKAGES_DIR}/*.la" +FILES:${PN} += " ${PYTHON_SITEPACKAGES_DIR}/*" +FILES:${PN}-staticdev += " ${PYTHON_SITEPACKAGES_DIR}/*.a" +FILES:${PN}-dev += " ${PYTHON_SITEPACKAGES_DIR}/*.la" -do_install_append() { +do_install:append() { # Patch python tools to use Python 3; they should be source compatible, but # still refer to Python 2 in the shebang sed -i -e '1s,#!.*python.*,#!${bindir}/python3,' ${D}${bindir}/lttng-gen-tp |