lttng-modules: Backport fixes for kernel instrumentation
PATCH 1/1 lttng-modules: Backport fixes for kernel instrumentation
This backport fixes from upcoming 2.9.4 release. Those are:
- Fix: vmalloc wrapper on kernel < 2.6.38
- Fix: vmalloc wrapper on kernel >= 4.12
- Add kmalloc failover to vmalloc
- Fix: mmap: caches aliased on virtual addresses
- Fix: update ext4 instrumentation for kernel 4.13
- Fix: Sleeping function called from invalid context
- Fix: sched for v4.11.5-rt1
- Fix: handle missing ftrace header on v4.12
This fix failures in some BSP layers which are using Linux 4.13 already.
Signed-off-by Otavio Salvador <[email protected]>
---
...Fix-handle-missing-ftrace-header-on-v4.12.patch | 96 ++++ .../0002-Fix-sched-for-v4.11.5-rt1.patch | 31 ++ ...ping-function-called-from-invalid-context.patch | 133 ++++++ ...date-ext4-instrumentation-for-kernel-4.13.patch | 189 ++++++++ ...-mmap-caches-aliased-on-virtual-addresses.patch | 100 ++++ .../0006-Add-kmalloc-failover-to-vmalloc.patch | 519 +++++++++++++++++++++ .../0007-Fix-vmalloc-wrapper-on-kernel-4.12.patch | 37 ++ ...0008-Fix-vmalloc-wrapper-on-kernel-2.6.38.patch | 34 ++ meta/recipes-kernel/lttng/lttng-modules_2.9.3.bb | 10 +- 9 files changed, 1148 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-Fix-handle-missing-ftrace-header-on-v4.12.patch create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0002-Fix-sched-for-v4.11.5-rt1.patch create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0003-Fix-Sleeping-function-called-from-invalid-context.patch create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0004-Fix-update-ext4-instrumentation-for-kernel-4.13.patch create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0005-Fix-mmap-caches-aliased-on-virtual-addresses.patch create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0006-Add-kmalloc-failover-to-vmalloc.patch create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0007-Fix-vmalloc-wrapper-on-kernel-4.12.patch create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0008-Fix-vmalloc-wrapper-on-kernel-2.6.38.patch
meta/recipes-kernel/lttng/lttng-modules/0001-Fix-handle-missing-ftrace-header-on-v4.12.patch new file +96 -0
@@ -0,0 +1,96 @@ +From fea65d0c097a42cf163bf7035985a6da330b9a1f Mon Sep 17 00:00:00 2001 +From: Michael Jeanson <[email protected]> +Date: Fri, 23 Jun 2017 14:29:42 -0400 +Subject: [PATCH 1/8] Fix: handle missing ftrace header on v4.12 +Organization: O.S. Systems Software LTDA. + +Properly handle the case where we build against the distro headers of a +kernel >= 4.12 and ftrace is enabled but the private header is +unavailable. + +Upstream-Status: Backport [2.9.4] + +Signed-off-by: Michael Jeanson <[email protected]> +Signed-off-by: Mathieu Desnoyers <[email protected]> +--- + Makefile.ABI.workarounds | 21 +++++++++++++++++++++ + lttng-events.h | 2 +- + probes/Kbuild | 19 ++++--------------- + 3 files changed, 26 insertions(+), 16 deletions(-) + +diff --git a/Makefile.ABI.workarounds b/Makefile.ABI.workarounds +index c3717f8..2e6c4aa 100644 +--- a/Makefile.ABI.workarounds ++++ b/Makefile.ABI.workarounds +@@ -27,3 +27,24 @@ RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/rt-patch-version.sh $(CURDIR) + ifneq ($(RT_PATCH_VERSION), 0) + ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION) + endif ++ ++# Starting with kernel 4.12, the ftrace header was moved to private headers ++# and as such is not available when building against distro headers instead ++# of the full kernel sources. In the situation, define LTTNG_FTRACE_MISSING_HEADER ++# so we can enable the compat code even if CONFIG_DYNAMIC_FTRACE is enabled. ++ifneq ($(CONFIG_DYNAMIC_FTRACE),) ++ ftrace_dep = $(srctree)/kernel/trace/trace.h ++ ftrace_dep_check = $(wildcard $(ftrace_dep)) ++ have_ftrace_header = $(shell \ ++ if [ $(VERSION) -ge 5 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -ge 12 \) ] ; then \ ++ if [ -z "$(ftrace_dep_check)" ] ; then \ ++ echo "no" ; \ ++ exit ; \ ++ fi; \ ++ fi; \ ++ echo "yes" ; \ ++ ) ++ ifeq ($(have_ftrace_header), no) ++ ccflags-y += -DLTTNG_FTRACE_MISSING_HEADER ++ endif ++endif +diff --git a/lttng-events.h b/lttng-events.h +index 173f369..5a96bf3 100644 +--- a/lttng-events.h ++++ b/lttng-events.h +@@ -810,7 +810,7 @@ int lttng_kretprobes_event_enable_state(struct lttng_event *event, + } + #endif + +-#ifdef CONFIG_DYNAMIC_FTRACE ++#if defined(CONFIG_DYNAMIC_FTRACE) && !defined(LTTNG_FTRACE_MISSING_HEADER) + int lttng_ftrace_register(const char *name, + const char *symbol_name, + struct lttng_event *event); +diff --git a/probes/Kbuild b/probes/Kbuild +index 78bf3fb..cc1c065 100644 +--- a/probes/Kbuild ++++ b/probes/Kbuild +@@ -259,22 +259,11 @@ ifneq ($(CONFIG_KRETPROBES),) + endif # CONFIG_KRETPROBES + + ifneq ($(CONFIG_DYNAMIC_FTRACE),) +- ftrace_dep = $(srctree)/kernel/trace/trace.h +- ftrace_dep_check = $(wildcard $(ftrace_dep)) +- ftrace = $(shell \ +- if [ $(VERSION) -ge 5 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -ge 12 \) ] ; then \ +- if [ -z "$(ftrace_dep_check)" ] ; then \ +- echo "warn" ; \ +- exit ; \ +- fi; \ +- fi; \ +- echo "lttng-ftrace.o" ; \ +- ) +- ifeq ($(ftrace),warn) ++ ifeq ($(have_ftrace_header),yes) ++ obj-$(CONFIG_LTTNG) += lttng-ftrace.o ++ else + $(warning Files $(ftrace_dep) not found. Probe "ftrace" is disabled. Use full kernel source tree to enable it.) +- ftrace = +- endif # $(ftrace),warn +- obj-$(CONFIG_LTTNG) += $(ftrace) ++ endif + endif # CONFIG_DYNAMIC_FTRACE + + # vim:syntax=make +-- +2.14.1 +
meta/recipes-kernel/lttng/lttng-modules/0002-Fix-sched-for-v4.11.5-rt1.patch new file +31 -0
@@ -0,0 +1,31 @@ +From 8db274f8dda050c4f2ee3dbd0f36a5ad8f8bd993 Mon Sep 17 00:00:00 2001 +From: Michael Jeanson <[email protected]> +Date: Mon, 10 Jul 2017 18:13:11 -0400 +Subject: [PATCH 2/8] Fix: sched for v4.11.5-rt1 +Organization: O.S. Systems Software LTDA. + +Upstream-Status: Backport [2.9.4] + +Signed-off-by: Michael Jeanson <[email protected]> +Signed-off-by: Mathieu Desnoyers <[email protected]> +--- + instrumentation/events/lttng-module/sched.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/instrumentation/events/lttng-module/sched.h b/instrumentation/events/lttng-module/sched.h +index e6f36b1..cb5b5b2 100644 +--- a/instrumentation/events/lttng-module/sched.h ++++ b/instrumentation/events/lttng-module/sched.h +@@ -541,7 +541,8 @@ LTTNG_TRACEPOINT_EVENT(sched_stat_runtime, + #endif + + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0) || \ +- LTTNG_RT_KERNEL_RANGE(4,9,27,18, 4,10,0,0)) ++ LTTNG_RT_KERNEL_RANGE(4,9,27,18, 4,10,0,0) || \ ++ LTTNG_RT_KERNEL_RANGE(4,11,5,1, 4,12,0,0)) + /* + * Tracepoint for showing priority inheritance modifying a tasks + * priority. +-- +2.14.1 +
meta/recipes-kernel/lttng/lttng-modules/0003-Fix-Sleeping-function-called-from-invalid-context.patch new file +133 -0
133 lines not on this page · raw message
meta/recipes-kernel/lttng/lttng-modules/0004-Fix-update-ext4-instrumentation-for-kernel-4.13.patch new file +189 -0
189 lines not on this page · raw message
meta/recipes-kernel/lttng/lttng-modules/0005-Fix-mmap-caches-aliased-on-virtual-addresses.patch new file +100 -0
100 lines not on this page · raw message
meta/recipes-kernel/lttng/lttng-modules/0006-Add-kmalloc-failover-to-vmalloc.patch new file +519 -0
519 lines not on this page · raw message
meta/recipes-kernel/lttng/lttng-modules/0007-Fix-vmalloc-wrapper-on-kernel-4.12.patch new file +37 -0
@@ -0,0 +1,37 @@ +From ecda9325cd5ad6b69600fd4d88c46095d22f95e1 Mon Sep 17 00:00:00 2001 +From: Michael Jeanson <[email protected]> +Date: Tue, 26 Sep 2017 13:46:30 -0400 +Subject: [PATCH 7/8] Fix: vmalloc wrapper on kernel >= 4.12 +Organization: O.S. Systems Software LTDA. + +Upstream-Status: Backport [2.9.4] + +Signed-off-by: Michael Jeanson <[email protected]> +Signed-off-by: Mathieu Desnoyers <[email protected]> +--- + wrapper/vmalloc.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/wrapper/vmalloc.h b/wrapper/vmalloc.h +index 2dd06cb..e117584 100644 +--- a/wrapper/vmalloc.h ++++ b/wrapper/vmalloc.h +@@ -27,6 +27,7 @@ + + #include <linux/version.h> + #include <linux/vmalloc.h> ++#include <linux/mm.h> + + #ifdef CONFIG_KALLSYMS + +@@ -105,7 +106,6 @@ void lttng_kvfree(const void *addr) + #else + + #include <linux/slab.h> +-#include <linux/mm.h> + + /* + * kallsyms wrapper of __vmalloc_node with a fallback to kmalloc_node. +-- +2.14.1 +
meta/recipes-kernel/lttng/lttng-modules/0008-Fix-vmalloc-wrapper-on-kernel-2.6.38.patch new file +34 -0
@@ -0,0 +1,34 @@ +From a919317a3e3352038c8285a41055b370adc79478 Mon Sep 17 00:00:00 2001 +From: Michael Jeanson <[email protected]> +Date: Tue, 26 Sep 2017 14:16:47 -0400 +Subject: [PATCH 8/8] Fix: vmalloc wrapper on kernel < 2.6.38 +Organization: O.S. Systems Software LTDA. + +Ensure that all probes end up including the vmalloc wrapper through the +lttng-tracer.h header so the trace_*() static inlines are generated +through inclusion of include/trace/events/kmem.h before we define +CREATE_TRACE_POINTS. + +Upstream-Status: Backport [2.9.4] + +Signed-off-by: Michael Jeanson <[email protected]> +Signed-off-by: Mathieu Desnoyers <[email protected]> +--- + lttng-tracer.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lttng-tracer.h b/lttng-tracer.h +index 58a7a26..5da882b 100644 +--- a/lttng-tracer.h ++++ b/lttng-tracer.h +@@ -36,6 +36,7 @@ + + #include <wrapper/trace-clock.h> + #include <wrapper/compiler.h> ++#include <wrapper/vmalloc.h> + #include <lttng-tracer-core.h> + #include <lttng-events.h> + +-- +2.14.1 +
meta/recipes-kernel/lttng/lttng-modules_2.9.3.bb +9 -1
@@ -12,7 +12,15 @@ COMPATIBLE_HOST = '(x86_64|i.86|powerpc|aarch64|mips|nios2|arm).*-linux' 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://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \ + file://0001-Fix-handle-missing-ftrace-header-on-v4.12.patch \ + file://0002-Fix-sched-for-v4.11.5-rt1.patch \ + file://0003-Fix-Sleeping-function-called-from-invalid-context.patch \ + file://0004-Fix-update-ext4-instrumentation-for-kernel-4.13.patch \ + file://0005-Fix-mmap-caches-aliased-on-virtual-addresses.patch \ + file://0006-Add-kmalloc-failover-to-vmalloc.patch \ + file://0007-Fix-vmalloc-wrapper-on-kernel-4.12.patch \ + file://0008-Fix-vmalloc-wrapper-on-kernel-2.6.38.patch" SRC_URI[md5sum] = "9abf694dddcc197988189ef65b496f4c" SRC_URI[sha256sum] = "f911bca81b02a787474f3d100390dad7447f952525e6d041f50991940246bafe"
Signature · 1 line
2.14.1